Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Enable and disable exact match on frontend?
This topic contains 5 replies, has 2 voices, and was last updated by Ernest Marcinko 7 years, 3 months ago.
- AuthorPosts
- November 30, 2016 at 10:47 am #11026
Hello,
I would like to know if it is possible to give frontend users the choice whether they prefer to search with full word exact match or without it (substring search). It would be a really important for my users to have this ability.
Best regards
PatrykNovember 30, 2016 at 11:12 am #11032Hi Patryk,
On the Frontend Search Settings -> General panel you can enable the “Show exact matches only” option: https://i.imgur.com/6zMBR46.png
Exact matching is still a substring matching, however the string must match as it is, including the ordering.Exact matching with word boundaries is not possible without using regular expressions (using the RLIKE operator) in mySQL, which is extremely inefficient and resource heavy, it’s not implemented for safety reasons.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
November 30, 2016 at 11:27 am #11035Thanks for this response, but we did not mean the exact vs. fuzzy matching, but full word vs. partial word match: the choice corresponding to your Behaviour setting AND versus AND WITH EXACT WORD MATCH.
November 30, 2016 at 11:47 am #11038That is unfortunately not possible yet, planned feature for the upcoming release.
However you could try the following custom code to re-purpose the exact matches option:
This will basically detect if the “Show exact matches” option in selected, and if yes then changes the keyword logic to “and with exact keyword matches” instead of the default behavior.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
December 1, 2016 at 1:12 pm #11076Nice.
This code changes the search behaviour just as I wanted.Thank you 🙂
December 1, 2016 at 1:13 pm #11077You are very welcome!
If you don’t mind, I will close this topic and mark it as resolved for now, feel free to open another one if you have other questions/issues.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
- AuthorPosts
The topic ‘Enable and disable exact match on frontend?’ is closed to new replies.