Enable and disable exact match on frontend?

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 Ernest Marcinko 7 years, 3 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #11026
    expromo
    expromo
    Participant

    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
    Patryk

    #11032
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi 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 :)


    #11035
    expromo
    expromo
    Participant

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

    #11038
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    That 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 :)


    #11076
    expromo
    expromo
    Participant

    Nice.
    This code changes the search behaviour just as I wanted.

    Thank you 🙂

    #11077
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    You 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 :)


Viewing 6 posts - 1 through 6 (of 6 total)

The topic ‘Enable and disable exact match on frontend?’ is closed to new replies.