Search results tweak

This topic contains 3 replies, has 2 voices, and was last updated by Ernest Marcinko Ernest Marcinko 7 years, 8 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #2768
    Alex
    Alex
    Participant

    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 MX300

    So 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 !

    #2773
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi!

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


    #2776
    Alex
    Alex
    Participant

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

    #2777
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    No 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 tab

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


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

You must be logged in to reply to this topic.