Reply To: Search By First Letter Only

#15813
Ernest Marcinko
Ernest Marcinko
Keymaster

Hi!

Well, there are two possibilities at this moment, one is exactly what you need, but it requires editing one file, the other one is close to what you need, but does not require editing.

Solution #1: Exact matching with a small file edit
First, you will have to enable exact matches on the General Options -> Logics & Behavior panel: https://i.imgur.com/JlIhVR8.png
Then only allow searching the title: https://i.imgur.com/g5emOnf.png
Then:
– Make sure to have a back-up copy of everything, just in case.
– Open up the wp-content\plugins\ajax-search-pro\includes\classes\search\class-asp-search-cpt.php
– Scroll down to line 493, which should be this:

– Change that line to this:

– Save the file, and it’s done.

Solution #2: Using the index table engine
The index table engine only matches word starts or reverse match endings. So by typing in ‘a’ it will only yield results if any of the field keywords starts with or ends with ‘a’. It will give less results, but not as close to the previous solution.

Personally, I would suggest solution #1. I will try to implement an option to choose the exact match location in the future, so this change won’t be neccessary.

Best,
Ernest Marcinko

If you like my products, don't forget to rate them on codecanyon :)