- December 27, 2017 at 6:41 pm #16052
I am having an issue trying to get the Ajax Search Pro to search woocommerce Short Descriptions. A long story short, I have alternate part numbers listed in the Short Description fields in Woocommerce and I leave the alternate numbers out of the main product description because it can be confusing.
The website I am working on is BAXTER CYCLE
When you search the part number 67-0395 (Alternate number for 67-0741) nothing comes up in the search. If you search 67-0741, the product does come up in the search. You can see the 67-0395 is listed in the product short description.
I have been messing around with the search settings and cant seem to get it figured out. I was doing some searching on google and the knowledge base and saw a setting “FULLTEXT SEARCH OPTION” But I cant find this setting anywhere in the Ajax Search Pro Admin settings. I am wondering if this is an older setting from a previous version of the plugin?
I am a bit confused on what else to check to make the search pull products that match a part number listed in the Short Description.
Thanks for your time. Please let me know if you have any questions or need any information from me.
Chris Baxter DameronDecember 28, 2017 at 1:03 pm #16064
I have looked at the description of the products, and I believe I know why the plugin is not able to return matches for those inputs.
The part number in the description is stored as a single word, but preceeded and followed by a star ‘*’ character. I believe you are using the index table engine, which tries to recognize individual words, then stor them in the database. Unfortunatly the * character does not act as a word boundary, so the index stores it as-is. In your case, the indexed part number is not ’67-0395′ but ‘*67-0395*’ as found within the description. If you do a search query for *67-0395 or 67-0395* or *67-0395* it will find the part – as it matches the word ending, beginning and as a whole in each case.
The quickest resolution in my opinion is to use this custom filter function I made to remove the star ‘*’ characters before indexing, then re-build the index.
1. Add this custom code to the functions.php in your theme/child theme directory (copy from line 3 only!). Before editing, please make sure to have a full site back-up just in case!
2. Then re-build the index: https://i.imgur.com/CXZbB9z.png
After that, it should start returning the parts by the alternative numbers.Best,
If you like my products, don't forget to rate them on codecanyon :)
December 28, 2017 at 8:20 pm #16073
Thanks for your time looking into this issue. You are awesome. That solved the problem. It is pulling up all the parts that are listed as alt numbers now. Perfect!
I really cant thank you enough for your time.
Have a great new year!
Chris Baxter DameronDecember 29, 2017 at 10:27 am #16082
You must be logged in to reply to this topic.