Search - MODX Community Forums <![CDATA[SimpleSearch (2.1) and extractSource »Snippet«]]>

I'm not a developer and don't understand what it means. Does this means that SimleSearch would pass the content of all fields, there the search term applies, to the snippet. And it part of the snippet to handle the content?

Exists there a snippet for this, or can I use an other snippet like getResources or something like this?

I found thread this a similar problem, but they are talking about a plugin.

Thanks]]> Fri, 18 Jan 2019 11:38:45 +0000
<![CDATA[Advsearch multi context (BAbel) no results or err 500]]>
I'm setting on a bi context revo 2.33 with Babel, a global search with advsearch.

Not sure of what it does.
here's the call
[[!AdvSearch? &contexts=`[[*context_key]]` &parents=`[[BabelTranslation? &contextKey=`[[*context_key]]` &resourceId=`2`]]` &withTVs=`phase-applis,USP_phase`]]

I applied the patch about micro time, so when I search with nothing in the input except the default helping value,
I get what seams to be the full list of every words found in the web site tree.

I'm calling advsearch context dependant (and my 2 contexts are strictly the same in term of pages)
and still with no search word enterred I get actually 33 pages of results for the default web context (fr) Not a EN results , that's expected
and 55 pages for alternate en (eng) context... that's not correct, it includes then ALSO the web context documents !..

I can not be sure the context to search into seams to be correctly taken.


As soon as any word is entered into the search input (whatever the context is), the landing is a blank (500 err ?) page
the url of the landing page is them

We see the landing is the right one and the name of the submit button is correct too

here's the url of the web (fr) landing page

But ... I do see where investigaute now..
thank you
]]> Tue, 15 Jan 2019 07:20:53 +0000
<![CDATA[mSearch2 /mFilter2 - Grouping TV filters]]>
I've managed to buy, install, and get it successfully working...

The snippet call to get this is:
     &includeTVs=`productdescription, productno, productimage, onsale, sale-image, price` 

What I would like to do is be able to group some of the TV's together into a set of sorts... so I can visually do something similar to the category (Designers) list above it, but also be be able to have them as radio buttons so only one can be selected. However, in the templates they are individual checkboxes.

So, I want to have

Scoop/Wide Straps/Sweetheart/Sleeves/High Neck/Narrow Straps
Low Back /Illusion Back / Key Hole
Ballgown/Small A-line/

I also want to add in price range - again, from checkboxes in the MOdx Templates.

Once I have it working i'll style it, but it's impressive thus far!

All of the instructions / references I can find seem to refer to mShop. This is a website that's been using modx since 2009 - it's got lots of historical bits and pieces that are not really the way to do things now, but no other option existed then. So no mShop... these gowns are just resources, but they are also not available for online purchase.

Modx Revolution Version 2.6.5

]]> Fri, 21 Dec 2018 10:29:46 +0000
<![CDATA[AdvSearch + Tagger and using fieldPotency]]>
This is the snippet:


$modxTablePrefix = 'modx_';
$taggerModelPath = '{core_path}components/tagger/model/';

    'qhVersion' => '1.2',
    'joined' => array(
            'package' => 'tagger',
            'class' => 'TaggerTagResource',
            'packagePath' => $taggerModelPath,
            'withFields' => 'resource',
            'tablePrefix' => $modxTablePrefix,
            'joinCriteria' => 'TaggerTagResource.resource ='
            'package' => 'tagger',
            'class' => 'TaggerTag',
            'packagePath' => $taggerModelPath,
            'withFields' => 'tag',
            'tablePrefix' => $modxTablePrefix,
            'joinCriteria' => ' = TaggerTagResource.tag'

return true;  

And this is the advSearch snippet call. It works, however I can't get fieldPotency to take the Tagger field. I tried this:

&fieldPotency=`pagetitle:100, tag:80, content:50, introtext:30, description:10`
&sortby=`score DESC`

The problem is first of all I don't know how to reference the Tagger field (used 'tag', but not sure if that's correct) and second of all I don't know if it's possible to use a joined field in the fieldPotency field. For now, this example isn't working. The resource with a value in Tagger that is searched for IS found, but it's not on top of the list, as I would expect because of the fieldPotency.

Does anyone know if it's possible, and if so what I should do exactly?

Thanks a lot!]]> Thu, 20 Dec 2018 08:54:36 +0000
<![CDATA[Filter Results using AdvSearch and Tagger with Queryhooks]]> AdvSearch with QueryHooks. But I am lost where to start. Never used AdvSearch only SimpleSearch.

Tagger is setup with 3 different tagger groups [Type, Service L1, Service L2] to be used on my sites resources (blogs, news, articles) pages.

I will have a resources.html page that will show ALL available resources under Resources [19]. Each resource will be tagged appropriately in the Template Variable using Tagger. I will show available tags under each group on the side menu (sort-of a search by filtering menu) and need to Filter the results on the page. This will occur either by submitting a button to "Apply Filters" or it will happen "Live" as tags are selected. The Submit button is what I need working, but having it live filter would be ideal. Any guidance on where to start would be appreciated.

I have some code to reference:
[[!AdvSearchForm? &tpl=`AdvanceSearchForm_tpl`]]
<p>[[!AdvSearch? &parents=`19`&queryHook=`qhFilter`]]

<form class="advsea-search-form" action="[[~[[+landing]]]]" method="[[+method]]">
    <input type="hidden" name="id" value="[[+landing]]" />
    <input type="hidden" name="asId" value="[[+asId]]" />

	<div class="group1">
	  <select id="group1" name="group1">
		<option value="" selected="selected">-</option>
		[[TaggerGetTags? &ids=`[[!GetIds? &ids=`c19`]]` &groups=`1` &showUnused=`0` &rowTpl=`@INLINE <option value="[[+tag]]">[[+tag]]</option>`]]
	<div class="group2">
	  <label>Service L1</label>
	  <select id="group2" name="group2">
	  	<option value="" selected="selected">-</option>
		[[TaggerGetTags? &ids=`[[!GetIds? &ids=`c19`]]` &groups=`2` &showUnused=`0` &rowTpl=`@INLINE <option value="[[+tag]]">[[+tag]]</option>`]]
	<div class="group3">
	  <label>Service L2</label>
	  <select id="group3" name="group3">
	  	<option value="" selected="selected">-</option>
		[[TaggerGetTags? &ids=`[[!GetIds? &ids=`c19`]]` &groups=`3` &showUnused=`0` &rowTpl=`@INLINE <option value="[[+tag]]">[[+tag]]</option>`]]
    <input type="submit" name="sub" value="[[ &namespace=`advsearch` &topic=`default`]]" />

# Main for MODX
$main = array(
    'package' => 'modx',
    'packagePath' => '{core_path}model/',
    'class' => 'modResource',                         
    'fields' => 'id',                        
    'withFields' => 'id',                    
    'sortby' => 'TaggerTagResource.tag DESC',
    'tablePrefix' => 'modx_'
# Join with Tagger table
$joined = array(
        'package' => 'tagger',        
        'packagePath' => '{core_path}components/tagger/model/', 
        'class' => 'TaggerTagResource',
        'withFields' => 'resource, tag',
        'fields' => 'resource, tag',
        # On the resource ID
        'joinCriteria' => ' = TaggerTagResource.resource',
        'tablePrefix' => 'modx_'
$andConditions = array(
    # One tag/option
    'TaggerTagResource.tag:=' => '2',
    # Another tag/option
    'TaggerTagResource.tag:=' => '4'
# set the query hook declaration
$qhDeclaration = array(
    'qhVersion' => '1.3',
    'main' => $main,
    'joined' => $joined,
    'andConditions' => $andConditions
return true;
]]> Tue, 11 Dec 2018 12:02:42 +0000
<![CDATA[SimpleSearch: Empty results when properties are introduced]]>

I have a parent resource (with id 47) on which I have the search form call:

[[!SimpleSearchForm? &tpl=`DocSearchBOX` &landing=`50`]]

50 is the search result resource id. The parent (47) has some child resources and the search is intended to be only about the child resources. Here is the call on the result page:

[[!SimpleSearch &ids=`[[!GetIds? &ids=`c47`]]`]]

(GetID is a snippet call. The snippet help get the ids of the child child resources.

Without any property to the [[!SimpleSearch]] call results show up (but only show content limited to the parent). With the property (or any other property for that matter I get no results (just blank).

Please kindly advise.
]]> Sun, 01 Jul 2018 11:50:43 +0000
<![CDATA[mSearch2 extra / phpMorphy - Any feedback ?]]>
According information provided on msearch2 use Morphological search with morphological analyzer library : (Russian)

I am very curious about how phpMorphy works.

The library supports currently Russian, English and German languages. Then what will happen if a non-supported language is used with mSearch2 -- French for example ?

]]> Thu, 26 Apr 2018 04:35:52 +0000
<![CDATA[Override SimpleSearch Paging]]>
I have a custom pdoPage pset (@pdoPagination) that works nicely elsewhere and is "attached" to both the SimpleSearch and SimpleSearchForm elements but doesn't display despite using the correct [[+page.nav]] placeholder in place of SS [[+paging]] .

Is there a compatibility issue with SS or am I overlooking something obvious?]]> Wed, 28 Mar 2018 04:42:12 +0000
<![CDATA[ [Bug] SimpleSearch with includeTVs not show all resource.]]> SimpleSearch 1.9.2

By activating the search on the TV the result includes only the resources that do not have the TV empty.

in this way, if a resource has no content in the TV, it is not included in the results, although there are matches in content!!!


]]> Fri, 23 Feb 2018 11:38:21 +0000
<![CDATA[Simple Search: character displaying in results but not in content]]> We are using Simple Search on 3 sites that have been recently moved to new Windows servers with updated PHP 7.1. Old server was Linux with PHP 5.3.xx.
One the new servers, the Simple Search results are displaying a black triangle character. On the old server, I can see this "character" is " " and displays as a space.
On the new server, the character is breaking, I suspect maybe Simple Search is stripping something out of the " "

I've attached a screen shot of the results. If I edit the content and manually delete then re-add the space, it displays correctly.

Has anyone experienced this or have some insight into what could be happening and how to resolve? Not thrilled at the prospect of having to tell client th eneed to edit all their content manually to fix.

Thanks for any help/insights

Michael]]> Wed, 22 Nov 2017 07:12:47 +0000
<![CDATA[First/Last and Previous/Next Missing]]> SS 1.9.2

I have the SimpleSearch pagination (mostly) working, except that the First/Last and Previous/Next links are not rendering. I have all the pagination Chunks configured so I'm not sure what's missing.]]> Tue, 31 Oct 2017 04:47:24 +0000
<![CDATA[Simple search doesnt show update?]]>
1) Is version 1.9.2-pl and update for Splittingreds Simplesearch?
2) why does the installer not show me there is an update?
3) Howcome Splittingred is listed as the project owner ( even though the guy is long gone.
4) did someone else take over the project? and if so where is the repo?

thanks for answering
RDG]]> Wed, 11 Oct 2017 01:04:14 +0000
<![CDATA[AdvSearch with ajax]]> Is there a way to enable ajax for advsearch. Any Example is very useful. My Advsearch snippet is as follows.



]]> Sat, 23 Sep 2017 11:58:37 +0000
<![CDATA[SimpleSearch Ignores Custom Property-set]]> SS 1.9.2

I've used custom psets numerous times with a variety of Extras so I understand how to implement them, but for some reason SimpleSearch is ignoring my custom pset in favor of the default. Editing the default pset gives the desired result but obviously that's not ideal.

Is there a SS bug that I'm unaware of or is it me?

Thanks]]> Mon, 18 Sep 2017 04:46:52 +0000
<![CDATA[AdvSearch to show search value based on dropdown box]]>
For my dropdown select box I have four options.
<option value="all">All</option>
<option value="1">Category1</option>
<option value="2">Category2</option>
<option value="3">Category3</option>

When select any category except 'All' my search form show default option not the one I have selected before form submit.

I want selected option in form as I have selected before form submit. Means if I have selected "Category1" my search form will show "Category1" as selected. Now it shows "All"]]> Thu, 31 Aug 2017 07:05:12 +0000
<![CDATA[Modx search with select dropdown]]> Thanks for the great modx cms and community support. I have a requirement where I need search with select dropdown of dates(I am using a Template variable) . I need to show results on both textbox and dropdown filters.
I tried SimpleSearch is returning results based text field.
My query is :--
1. Is there a way to incorporate or filter results with dropdown value using simple search
2. OR I need to Use AdvSearch extra , Then Is there a guide how to achieve it.
I have attached my requirment snapshot for reference.

Please guide me.Iam using Modx Revo 2.5.7

]]> Thu, 31 Aug 2017 06:57:40 +0000
<![CDATA[AdvSearch won't return anything from a custom Search filter form and queryHook (but works fine via 'off the shelf' search input)]]>
I've got AdvSearch running fine with an 'off the shelf' search via input field, returning results fine in the standard format. It's running in Revolution 2.5.5-pl, via MAMP on MacOS 10.12.4, PHP 5.5.10, MySQL 5.5.34. I have Zend lib 1.2 installed in what I think is the required location.

I need to integrate search filtering to return a range of resources based on TVs. I built a custom form and queryHook for this following the guides in the AdvSearch download docs: advSearch101_v1.0.pdf and advsearchHook120_v1.0.pdf. But currently what I've built isn't returning anything from the custom form searches, either filtered or unfiltered.

I need my search to return a range of properties based on: Location, Sleeps (amount), Bedrooms (amount).

I've set up some TVs - [[*Location]] [[*Sleeps]] [[*Bedrooms]] - and 4 Resources are using them. The TVs are each Listboxes (Single select), with appropriate Input Option numeric or text values, and are not set to Allow Blank. They all work fine as they render elsewhere via hard-coded references in the page template.

So here's what I've built so far to get this Search running - apologies for non-indented/highlighted code:

Snippet calls:
[[!AdvSearchForm? &tpl=`filter2SearchForm` ]]
[[!AdvSearch? &queryHook=`Filter2QHook` &includeTVs=`Location, Sleeps, Bedrooms` &withFields=`introtext,description,content` ]]

Search form (filter2SearchForm):
<form class="advsea-search-form" action="[[~[[+landing]]]]" method="[[+method]]"> 

<input type="hidden" name="id" value="[[+landing]]" /> 
<input type="hidden" name="asId" value="[[+asId]]" /> 

<label>Select a Location:  
<select name="ctgLoc" > 
<option value="all" selected="selected">-All Locations -</option> 

<select name="ctgBed"> 
<option value="all" selected="selected">Any</option> 

<select name="ctgSle">
<option value="all" selected="selected">Any</option> 
<input type="submit" name="sub" value="[[ &namespace=`advsearch` &topic=`default`]]" /> 


queryHook (Filter2QHook):
$andConditions = array( 
'tv.Location:=' => 'ctgLoc:request:all', 
'tv.Bedrooms:=' => 'ctgBed:request:all',
'tv.Sleeps:=' => 'ctgSle:request:all',
$qhDeclaration = array( 
'qhVersion' => '2.0.0-beta2'
'andConditions' => $andConditions
return true;

In the queryHook you'll see that I used 'qhVersion' => '2.0.0-beta2' as that's the version of AdvSearch.

At this point I'm getting no results at all from this. Can anyone let me know if there's any glaring omission and/or error here?

Any help/advice would be much appreciated.
Thanks in advance.]]> Thu, 06 Jul 2017 08:55:30 +0000
<![CDATA[simpleSearch fieldPotency not sorting the results FIXED]]>
I had some issues with &fieldPotency. The simpleSearch call I used was:


No matter what values for pagetitle I set the sorted results seemed to be randomly ordered. Resourses which had the search term in their title were listed after those where the term was used only in the description tag even when pagetitle fieldPotency values were many times higher than those set for the description.

The problem

When the search term is used to count the number of matches for each &docField the comparison seems to be CASE SENSITIVE. Since the titles of my resources all start with a capital letter when compared to search term the result was no match. Thus the potency values for pagetitle were simply ingroned. To understand this behavior better check lines 126-132 of simplesearchdriver.php located in model/simplesearch/driver/

foreach ($this->search->searchArray as $term) {
$queryTerm = preg_quote($term,'/');
$regex = ($searchStyle == 'partial') ? "/{$queryTerm}/i" : "/\b{$queryTerm}\b/i";
$numberOfMatches = preg_match_all($regex, $resource->{$field}, $matches);
if (empty($this->searchScores[$resourceId])) $this->searchScores[$resourceId] = 0;
$this->searchScores[$resourceId] += $numberOfMatches * $potency;

In my particular case the problem was 'solved' by simply changing the first letter of $term to be capital before checking for matches by adding those 3 lines of code:

foreach ($this->search->searchArray as $term) {

$first_letter = mb_strtoupper(mb_substr($term, 0, 1, "UTF-8"), "UTF-8");
$term_end = mb_substr($term, 1, mb_strlen($term, "UTF-8"), "UTF-8");
$term = $first_letter . $str_end;

$queryTerm = preg_quote($term,'/');
$regex = ($searchStyle == 'partial') ? "/{$queryTerm}/i" : "/\b{$queryTerm}\b/i";
$numberOfMatches = preg_match_all($regex, $resource->{$field}, $matches);
if (empty($this->searchScores[$resourceId])) $this->searchScores[$resourceId] = 0;
$this->searchScores[$resourceId] += $numberOfMatches * $potency;

I am not a programmer so this 'solution' may turned out to be ineffective or even wrong. If you have better ideas how this issue could be avoided I would greatly appreciate if you share you knowledge. Thanks in advance.]]> Fri, 26 May 2017 04:35:44 +0000
<![CDATA[Simplesearch: problem if snippet inside content]]>
has anybody experienced issues with simplesearch when a snippet is inside the content of a searched page?

I have a site with contentBlock, where I call getResources inside a contentblock field.
I need to use the placeholder "content" instead of "extract" in order to clean it.

When that page (or other like that) is found by simplesearch I have a blank screen, no error anywhere.
If I remove the placeholder "content" everything is fine.
I tried adding a modifier to clean tags and modx code inside, no success..

thanks for your tips!
]]> Thu, 11 May 2017 03:22:26 +0000
<![CDATA[AdvSearch with ajax and livesearch]]> I need to search in TV therefore I cannot use SimpleSearch. AdvSearch in non-ajaxmode works ok, but I want to show live searched result in float window under search form.
[[!AdvSearchForm? &landing=`81` &tpl=`food.AdvSearchForm` &addJQuery=`0` &help=`0` &clearDefault=`1` &withAjax=`1`
    &ajaxResultsId=`364` &addJs=`0` &addCSS=`0` &liveSearch=`1`]]

Adding JS is disabled because even with 1 it doesnt paste any code. So I pasted it manually.
On page 364 I have empty template with call:
[[!AdvSearch? &hideContainers=`1` &fields=`pagetitle` &hideMenu=`0` &includeTVs=`vyrobce,popis,main-img` &withFields=`pagetitle` &withTVs=`vyrobce,popis` &perPage=`20` &sortby=`pagetitle[ASC]` &minChars=`1` &ids=`[[GetOnlyChildren? &parent=`2` &depth=`3`]]`  &withAjax=`1`  ]]

But it seems no js is loaded because it always return result to page 81...
I have no idea what I am doing wrong...]]> Wed, 18 Jan 2017 04:11:21 +0000