I have discovered an issue with simple search. If the search value has a comma in the search term text (“Treaty with the Chickasaw, 1805”) the search returns no results. But a search without the commas (“Treaty with the Chickasaw1805”)I get the correct results .
Is there a list of characters I need to strip from any search strings?
Thanks,
Roy
Fixed issue. It was a simple fix as pagetitle, was misspelled in the doc fields.
Developer error not user error!
Still some strangeness with simple search:
One Result with comma: Search - Tribal Treaties Database
Four Results without the comma: https://treaties.okstate.edu/search/?search=Treaty+with+the+Chickasaw+1805
[[!SimpleSearch?
&includeTVs=`1`
&includeTVList=`treaty-locations, treaty-tribes, treaty-tags`
&processTVs=`1`
&tpl=`search-results-row-tpl`
&containerTpl=`search-container-tpl`
&fieldPotency=`pagetitle:100,alias:100,content:50`
&docFields=`pagetitle,alias,content`
&exclude=`395,2`
&highlightClass=`mark`
&noResultsTpl=`search-no-results-found`
]]
I have not spent much time tweaking SimpleSearch in the past. Our other sites use google search plugins.
This site needs greater control for searches.
Thanks
Roy
As far as I can tell SimpleSearch splits the search string into words (at the positions where there is a space
character) and then creates the SQL query with LIKE
.
For example a search for “Chickasaw 1805” results in a SQL query like this:
WHERE `modResource`.`pagetitle` LIKE '%Chickasaw%' AND `modResource`.`pagetitle` LIKE '%1805%' ...
But when you search for “Chickasaw, 1805”, then it searches for this comma in your resources and only returns a result if it finds the comma after “Chickasaw”.
WHERE `modResource`.`pagetitle` LIKE '%Chickasaw,%' AND `modResource`.`pagetitle` LIKE '%1805%' ...
I guess I will have to strip non-alpha-numeric characters from the search terms before passing to the page with the SimpleSearch snippet
Thanks for the helpful info,
Roy