Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Search results tweak
This topic contains 3 replies, has 2 voices, and was last updated by Ernest Marcinko 8 years, 11 months ago.
- AuthorPosts
- October 22, 2014 at 4:02 pm #2768
Hello! Great plugin!
I have a small issue in setting up the search. I have a shop that sell cartridges.
So every cartridge has a list of compatabile printers.
Let’s say – Canon PIXMA MX300So when users input ‘Canon PIXMA MX300’ it shows good results.
When type ‘PIXMA MX300’ it is ok again.
But if he type ‘Canon MX300’ there is no good results 🙁 The problem is that many visitors will probably type just the part of printer’s name. And they are getting no results 🙁
I tried different settings but nothing helps. Do you have some advice? Tip?
I would appreciate your help !October 23, 2014 at 7:17 am #2773Hi!
In the latest version I implemented selectable search logic, which is exactly for solving these kind of issues.
Here is an explanation on them: https://wp-dreams.com/knowledge-base/search-logic-explained/
In your case I would suggest to select the “AND” search logic on the General Options->Behavior tab. This way the search will look for partial matches, but every word must match the result.
So if the post title is “Canon PIXMA MX300” then the “Canon MX300” will definitely be a relevant match. For even more relevant matches you can choose the “AND with exact word matches” option.
Also, make sure to turn OFF the “Show exact matches only?” option on the General Options->Sources panel (at the bottom) if you change the search logic, as it will only match the exactly typed partial or full matches, which is not the desired way in most cases.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
October 23, 2014 at 8:03 am #2776Thanks for quick response!
I only forgot to mention in first post that printers are in fact regular woocommerce tags.
So every product has list of tags that are presenting printers.
I have followed your instructions from knowledgebase without results. It keep showing me the same 4 products that does not have that printer (tags) in there’s list. I tried all possible options without good results. I made another search form just to check if with first one is something wrong. And on the other is the same issue. 🙁
I cannot figure out the solution :/
Sorry to bother you. I really tried everything before contact you and take your precios time…October 23, 2014 at 8:42 am #2777No problem at all.
This makes it a bit more difficult, as the tags search is a bit simplified, because it can make the search really really slow if someone has got a bigger database. So in this case changing the keyword logic won’t help you, simply because it’s not implemented to the tags search.
I made however a quick modification to the search code, but I cannot guarantee a proper speed, but in your case it might just work fine.
Do the following:
0. Make a backup copy of the wp-content/plugins/ajax-search-pro/ directory, just in case.
1. Open up the wp-content/plugins/ajax-search-pro/includes/search_content.class.php file and replace it’s contents with this: http://pastebin.com/raw.php?i=SRD34HnM
2. turn OFF the “Show exact matches only?” option on the General Options->Sources panel (at the bottom), this is very important
3. Change the keyword logic to “AND” or “AND with exact word matches” (if you want more strict results) on the General Options->Behavior tabNow the keyword logic will respect the terms search (in your case woocommerce tags) as well.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
- AuthorPosts
You must be logged in to reply to this topic.