Search - MODX Community Forums https://forums.modx.com/board/?board=93 <![CDATA[SimpleSearch (2.1) and extractSource »Snippet«]]> https://forums.modx.com/thread/104816/simplesearch-2-1-and-extractsource-snippet#dis-post-563642

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]]>
https://forums.modx.com/thread/104816/simplesearch-2-1-and-extractsource-snippet#dis-post-563642 Fri, 18 Jan 2019 11:38:45 +0000 https://forums.modx.com/thread/104816/simplesearch-2-1-and-extractsource-snippet#dis-post-563642
<![CDATA[Advsearch multi context (BAbel) no results or err 500]]> https://forums.modx.com/thread/96635/advsearch-multi-context-babel-no-results-or-err-500#dis-post-563573
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.
domain.tld/en/search-results.html?id=65&asId=as0&search=Search+here...&sub=Search

BUT
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.

AND

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
domain.tld/en/search-results.html?id=65&asId=as0&search=Searh+here&sub=Search

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
.../resultats-recherche.html?id=40&asId=as0&search=Saisissez+votre+recherche+ici...&sub=Recherche

But ... I do see where investigaute now..
thank you
]]>
https://forums.modx.com/thread/96635/advsearch-multi-context-babel-no-results-or-err-500#dis-post-563573 Tue, 15 Jan 2019 07:20:53 +0000 https://forums.modx.com/thread/96635/advsearch-multi-context-babel-no-results-or-err-500#dis-post-563573
<![CDATA[mSearch2 /mFilter2 - Grouping TV filters]]> https://forums.modx.com/thread/104751/msearch2-mfilter2---grouping-tv-filters#dis-post-563348
I've managed to buy, install, and get it successfully working...
https://www.astrabridal.co.nz/testing-listing-with-filtering.html

The snippet call to get this is:
 [[!mFilter2?
     &parents=`670`
     &hideContainers=`true`
     &ajaxMode=`scroll`
     &filters=`
     parent:categories,
        tv|strapless,
        tv|straps,
        tv|sweetheart,
        tv|cap-sleeves,
        tv|bateau,
        tv|thin-straps,
        tv|low-back,
        tv|illusion-back,
        tv|keyhole-back,
        tv|ballgown,
        tv|princess,
        tv|mermaid,
        tv|modified-mermaid,
        tv|sheath,
        
    `
    &aliases=`
        parent:categories==designer
    `
    &tplOuter=`astra.tpl.mFilter2.outer`
    &tplFilter.outer.tv|strapless=`astra.tpl.mFilter2.filter.outer`
    &tplFilter.row.tv|strapless=`astra.tpl.mFilter2.filter.checkbox`
    &tplFilter.outer.tv|straps=`astra.tpl.mFilter2.filter.outer`
    &tplFilter.row.tv|straps=`astra.tpl.mFilter2.filter.checkbox`
    &tplFilter.outer.tv|sweetheart=`astra.tpl.mFilter2.filter.outer`
    &tplFilter.row.tv|sweetheart=`astra.tpl.mFilter2.filter.checkbox`
    &tplFilter.outer.tv|cap-sleeves=`astra.tpl.mFilter2.filter.outer`
    &tplFilter.row.tv|cap-sleeves=`astra.tpl.mFilter2.filter.checkbox`
    &tplFilter.outer.tv|bateau=`astra.tpl.mFilter2.filter.outer`
    &tplFilter.row.tv|bateau=`astra.tpl.mFilter2.filter.checkbox`
    &tplFilter.outer.tv|low-back=`astra.tpl.mFilter2.filter.outer`
    &tplFilter.row.tv|low-back=`astra.tpl.mFilter2.filter.checkbox`
    &tplFilter.outer.tv|thin-straps=`astra.tpl.mFilter2.filter.outer`
    &tplFilter.row.tv|thin-straps=`astra.tpl.mFilter2.filter.checkbox`
    &tplFilter.outer.tv|illusion-back=`astra.tpl.mFilter2.filter.outer`
    &tplFilter.row.tv|illusion-back=`astra.tpl.mFilter2.filter.checkbox`
    &tplFilter.outer.tv|keyhole-back=`astra.tpl.mFilter2.filter.outer`
    &tplFilter.row.tv|keyhole-back=`astra.tpl.mFilter2.filter.checkbox`
    &tplFilter.outer.tv|ballgown=`astra.tpl.mFilter2.filter.outer`
    &tplFilter.row.tv|ballgown=`astra.tpl.mFilter2.filter.checkbox`
        &tplFilter.outer.tv|princess=`astra.tpl.mFilter2.filter.outer`
    &tplFilter.row.tv|princess=`astra.tpl.mFilter2.filter.checkbox`
        &tplFilter.outer.tv|mermaid=`astra.tpl.mFilter2.filter.outer`
    &tplFilter.row.tv|mermaid=`astra.tpl.mFilter2.filter.checkbox`
        &tplFilter.outer.tv|modified-mermaid=`astra.tpl.mFilter2.filter.outer`
    &tplFilter.row.tv|modified-mermaid=`astra.tpl.mFilter2.filter.checkbox`
        &tplFilter.outer.tv|sheath=`astra.tpl.mFilter2.filter.outer`
&tplFilter.row.tv|sheath=`astra.tpl.mFilter2.filter.outer`
&tplFilter.outer.resource|parent=`astra2.tpl.mFilter2.filter.outer`
    &tplFilter.row.default=`astra2.tpl.mFilter2.filter.checkbox`
    &tpl=`astra.tpl.mSearch2.row`
     &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

Neckline:
Scoop/Wide Straps/Sweetheart/Sleeves/High Neck/Narrow Straps
Back:
Low Back /Illusion Back / Key Hole
Silhouette:
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

]]>
https://forums.modx.com/thread/104751/msearch2-mfilter2---grouping-tv-filters#dis-post-563348 Fri, 21 Dec 2018 10:29:46 +0000 https://forums.modx.com/thread/104751/msearch2-mfilter2---grouping-tv-filters#dis-post-563348
<![CDATA[AdvSearch + Tagger and using fieldPotency]]> https://forums.modx.com/thread/97772/advsearch-tagger-and-using-fieldpotency#dis-post-563339
This is the snippet:

<?php

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

$hook->setQueryHook(array(
    'qhVersion' => '1.2',
    'joined' => array(
        array(
            'package' => 'tagger',
            'class' => 'TaggerTagResource',
            'packagePath' => $taggerModelPath,
            'withFields' => 'resource',
            'tablePrefix' => $modxTablePrefix,
            'joinCriteria' => 'TaggerTagResource.resource = modResource.id'
        ),
        array(
            'package' => 'tagger',
            'class' => 'TaggerTag',
            'packagePath' => $taggerModelPath,
            'withFields' => 'tag',
            'tablePrefix' => $modxTablePrefix,
            'joinCriteria' => 'TaggerTag.id = 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:

[[!AdvSearch?
&hideContainers=`0`
&minChars=`2`
&fields=`pagetitle,content,introtext`
&withFields=`pagetitle,content,introtext,description`
&highlightTag=`strong`
&searchIndex=`zoekterm`
&perPage=`10`
&engine=`mysql`
&pagingType=`1`
&pagingSeparator=``
&showExtract=`1:introtext,content`
&addCss=`0`
&addJs=`0`
&toPlaceholder=`searchresults`
&init=`all`
&offsetIndex=`start`
&queryHook=`searchTagger`
&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!]]>
https://forums.modx.com/thread/97772/advsearch-tagger-and-using-fieldpotency#dis-post-563339 Thu, 20 Dec 2018 08:54:36 +0000 https://forums.modx.com/thread/97772/advsearch-tagger-and-using-fieldpotency#dis-post-563339
<![CDATA[Filter Results using AdvSearch and Tagger with Queryhooks]]> https://forums.modx.com/thread/104691/filter-results-using-advsearch-and-tagger-with-queryhooks#dis-post-563191 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:
[Page]
[[!AdvSearchForm? &tpl=`AdvanceSearchForm_tpl`]]
<hr>
<h2>Results</h2>
<p>[[!AdvSearch? &parents=`19`&queryHook=`qhFilter`]]


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

	<div class="group1">
	  <label>Type</label>
	  <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>`]]
	  </select>
	</div>
	
	<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>`]]
	  </select>
	</div>
	
	<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>`]]
	  </select>
	</div>
	
    <input type="submit" name="sub" value="[[%advsearch.search? &namespace=`advsearch` &topic=`default`]]" />
  </fieldset>
</form>
[[+resultsWindow]]


[qhFilter]
<?php
# 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(
    array(
        'package' => 'tagger',        
        'packagePath' => '{core_path}components/tagger/model/', 
        'class' => 'TaggerTagResource',
        'withFields' => 'resource, tag',
        'fields' => 'resource, tag',
        # On the resource ID
        'joinCriteria' => 'modResource.id = 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
); 
$hook->setQueryHook($qhDeclaration);
 
return true;
]]>
https://forums.modx.com/thread/104691/filter-results-using-advsearch-and-tagger-with-queryhooks#dis-post-563191 Tue, 11 Dec 2018 12:02:42 +0000 https://forums.modx.com/thread/104691/filter-results-using-advsearch-and-tagger-with-queryhooks#dis-post-563191
<![CDATA[SimpleSearch: Empty results when properties are introduced]]> https://forums.modx.com/thread/87538/simplesearch-empty-results-when-properties-are-introduced#dis-post-559312 http://forums.modx.com/thread/47821/revo-simplesearch-ids-parameter-not-working

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.
http://modx.com/extras/package/getids)

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.
]]>
https://forums.modx.com/thread/87538/simplesearch-empty-results-when-properties-are-introduced#dis-post-559312 Sun, 01 Jul 2018 11:50:43 +0000 https://forums.modx.com/thread/87538/simplesearch-empty-results-when-properties-are-introduced#dis-post-559312
<![CDATA[mSearch2 extra / phpMorphy - Any feedback ?]]> https://forums.modx.com/thread/103791/msearch2-extra-phpmorphy---any-feedback#dis-post-558246
According information provided on Modstore.pro msearch2 use Morphological search with morphological analyzer library :

http://phpmorphy.sourceforge.net/dokuwiki (Russian)
https://sourceforge.net/projects/phpmorphy/
https://books.google.fr/books?id=plU0DwAAQBAJ&pg=PA684&dq=phpMorphy&hl=fr&sa=X&ved=0ahUKEwiV19-DstjaAhXG7BQKHRyaCfIQ6AEIJzAA#v=onepage&q=phpMorphy&f=false

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 ?

]]>
https://forums.modx.com/thread/103791/msearch2-extra-phpmorphy---any-feedback#dis-post-558246 Thu, 26 Apr 2018 04:35:52 +0000 https://forums.modx.com/thread/103791/msearch2-extra-phpmorphy---any-feedback#dis-post-558246
<![CDATA[Override SimpleSearch Paging]]> https://forums.modx.com/thread/103681/override-simplesearch-paging#dis-post-557701
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?]]>
https://forums.modx.com/thread/103681/override-simplesearch-paging#dis-post-557701 Wed, 28 Mar 2018 04:42:12 +0000 https://forums.modx.com/thread/103681/override-simplesearch-paging#dis-post-557701
<![CDATA[ [Bug] SimpleSearch with includeTVs not show all resource.]]> https://forums.modx.com/thread/103541/bug-simplesearch-with-includetvs-not-show-all-resource#dis-post-557000 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!!!

   [[!SimpleSearch? 
     &containerTpl=`chSearch`
     &tpl=`chSearchEl`
     &highlightClass=`search-highlight`
     &andTerms=`0`
     &includeTVs=`1`
     &includeTVList=`tvTag`
    ]] 


]]>
https://forums.modx.com/thread/103541/bug-simplesearch-with-includetvs-not-show-all-resource#dis-post-557000 Fri, 23 Feb 2018 11:38:21 +0000 https://forums.modx.com/thread/103541/bug-simplesearch-with-includetvs-not-show-all-resource#dis-post-557000
<![CDATA[Simple Search: character displaying in results but not in content]]> https://forums.modx.com/thread/103210/simple-search-character-displaying-in-results-but-not-in-content#dis-post-555415 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]]>
https://forums.modx.com/thread/103210/simple-search-character-displaying-in-results-but-not-in-content#dis-post-555415 Wed, 22 Nov 2017 07:12:47 +0000 https://forums.modx.com/thread/103210/simple-search-character-displaying-in-results-but-not-in-content#dis-post-555415
<![CDATA[First/Last and Previous/Next Missing]]> https://forums.modx.com/thread/103058/first-last-and-previous-next-missing#dis-post-554896 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.]]>
https://forums.modx.com/thread/103058/first-last-and-previous-next-missing#dis-post-554896 Tue, 31 Oct 2017 04:47:24 +0000 https://forums.modx.com/thread/103058/first-last-and-previous-next-missing#dis-post-554896
<![CDATA[Simple search doesnt show update?]]> https://forums.modx.com/thread/102971/simple-search-doesnt-show-update#dis-post-554447
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 (https://github.com/splittingred/SimpleSearch) 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]]>
https://forums.modx.com/thread/102971/simple-search-doesnt-show-update#dis-post-554447 Wed, 11 Oct 2017 01:04:14 +0000 https://forums.modx.com/thread/102971/simple-search-doesnt-show-update#dis-post-554447
<![CDATA[AdvSearch with ajax]]> https://forums.modx.com/thread/102859/advsearch-with-ajax#dis-post-554081 Is there a way to enable ajax for advsearch. Any Example is very useful. My Advsearch snippet is as follows.


[[!AdvSearchForm? 
&tpl=`AdvanceSearchForm_tpl`
]]

[[!AdvSearch?
&init=`all`
 &parents=`12`
&includeTVs=`ArticleImage,EventDateTv`
&queryHook=`FilterCalenderSnippet`
&tpl=`AdvSearchResults_tpl`
&pagingType=`0`
&debug=`1`

]]
]]>
https://forums.modx.com/thread/102859/advsearch-with-ajax#dis-post-554081 Sat, 23 Sep 2017 11:58:37 +0000 https://forums.modx.com/thread/102859/advsearch-with-ajax#dis-post-554081
<![CDATA[SimpleSearch Ignores Custom Property-set]]> https://forums.modx.com/thread/102848/simplesearch-ignores-custom-property-set#dis-post-553965 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]]>
https://forums.modx.com/thread/102848/simplesearch-ignores-custom-property-set#dis-post-553965 Mon, 18 Sep 2017 04:46:52 +0000 https://forums.modx.com/thread/102848/simplesearch-ignores-custom-property-set#dis-post-553965
<![CDATA[AdvSearch to show search value based on dropdown box]]> https://forums.modx.com/thread/95128/advsearch-to-show-search-value-based-on-dropdown-box#dis-post-553465
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"]]>
https://forums.modx.com/thread/95128/advsearch-to-show-search-value-based-on-dropdown-box#dis-post-553465 Thu, 31 Aug 2017 07:05:12 +0000 https://forums.modx.com/thread/95128/advsearch-to-show-search-value-based-on-dropdown-box#dis-post-553465
<![CDATA[Modx search with select dropdown]]> https://forums.modx.com/thread/102719/modx-search-with-select-dropdown#dis-post-553464 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
Regards,
Apsar

]]>
https://forums.modx.com/thread/102719/modx-search-with-select-dropdown#dis-post-553464 Thu, 31 Aug 2017 06:57:40 +0000 https://forums.modx.com/thread/102719/modx-search-with-select-dropdown#dis-post-553464
<![CDATA[AdvSearch won't return anything from a custom Search filter form and queryHook (but works fine via 'off the shelf' search input)]]> https://forums.modx.com/thread/102105/advsearch-won-t-return-anything-from-a-custom-search-filter-form-and-queryhook-but-works-fine-via-off-the-shelf-search-input#dis-post-552319
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` ]]
Results:
[[!AdvSearch? &queryHook=`Filter2QHook` &includeTVs=`Location, Sleeps, Bedrooms` &withFields=`introtext,description,content` ]]


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

<fieldset> 
<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> 
<option>North</option> 
<option>East</option>
<option>South</option> 
<option>West</option>
</select> 
</label>

<label>Bedrooms:  
<select name="ctgBed"> 
<option value="all" selected="selected">Any</option> 
<option>2</option> 
<option>3</option> 
<option>4</option> 
<option>5+</option> 
</select>
</label>

<label>Sleeps:  
<select name="ctgSle">
<option value="all" selected="selected">Any</option> 
<option>4</option> 
<option>5</option> 
<option>6</option> 
<option>7</option> 
<option>8+</option> 
</select> 
</label>
 
<input type="submit" name="sub" value="[[%advsearch.search? &namespace=`advsearch` &topic=`default`]]" /> 

</fieldset> 
</form> 
[[+resultsWindow]] 



queryHook (Filter2QHook):
<?php
$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
); 
$hook->setQueryHook($qhDeclaration); 
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.]]>
https://forums.modx.com/thread/102105/advsearch-won-t-return-anything-from-a-custom-search-filter-form-and-queryhook-but-works-fine-via-off-the-shelf-search-input#dis-post-552319 Thu, 06 Jul 2017 08:55:30 +0000 https://forums.modx.com/thread/102105/advsearch-won-t-return-anything-from-a-custom-search-filter-form-and-queryhook-but-works-fine-via-off-the-shelf-search-input#dis-post-552319
<![CDATA[simpleSearch fieldPotency not sorting the results FIXED]]> https://forums.modx.com/thread/102291/simplesearch-fieldpotency-not-sorting-the-results-fixed#dis-post-551247
I had some issues with &fieldPotency. The simpleSearch call I used was:

[[!SimpleSearch?
&searchStyle=`partial`
&docFields=`pagetitle,longtitle,description,introtext`
&perPage=`50`
&fieldPotency=`pagetitle:10,longtitle:1,description:1,introtext:1`
]]

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.]]>
https://forums.modx.com/thread/102291/simplesearch-fieldpotency-not-sorting-the-results-fixed#dis-post-551247 Fri, 26 May 2017 04:35:44 +0000 https://forums.modx.com/thread/102291/simplesearch-fieldpotency-not-sorting-the-results-fixed#dis-post-551247
<![CDATA[Simplesearch: problem if snippet inside content]]> https://forums.modx.com/thread/102201/simplesearch-problem-if-snippet-inside-content#dis-post-550654
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!
]]>
https://forums.modx.com/thread/102201/simplesearch-problem-if-snippet-inside-content#dis-post-550654 Thu, 11 May 2017 03:22:26 +0000 https://forums.modx.com/thread/102201/simplesearch-problem-if-snippet-inside-content#dis-post-550654
<![CDATA[AdvSearch with ajax and livesearch]]> https://forums.modx.com/thread/83992/advsearch-with-ajax-and-livesearch#dis-post-548155 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...]]>
https://forums.modx.com/thread/83992/advsearch-with-ajax-and-livesearch#dis-post-548155 Wed, 18 Jan 2017 04:11:21 +0000 https://forums.modx.com/thread/83992/advsearch-with-ajax-and-livesearch#dis-post-548155