• Hey,

    The plugin is great. And your documentation even better. I managed to adjust it just how I want it. I just have one problem. Search results give me very unrelated resuts.

    For example, my shop sells jewelry. And I have items like:

    Snow Necklace
    Long Snow Necklace
    Short Snow Necklace
    Cool Snow Necklace…
    Heart Necklace
    Long Heart Necklace
    Short…. and so on and so on.

    All separate items that are similarly named. But Heart Necklaces have one category and are part of a collection. And Snow Necklaces have their own category and are also all related to each other.

    When I search for Heart Necklace my first result is Heart Necklace, but all the rest just pick up the word Necklace. Ignoring the weight of the “Heart” typed into search. They show up eventually, but the results are not sorted as most relevant. I even get a lot of totally unrelated items in the results. We also sell mugs and they keep showing up when searching for the necklace. Even though they are a separate category, don’t have a word necklace or heart in their tags or anywhere in the description.

    The search is still better than the default WordPress/Woocommerce search. But the sorting is a big problem.

    This happened even before I started tinkering. Now it’s set up to show results based on menu order and based on stock status. It’s a bit better I think but still shows a lot of totally unrelated results.

    Is there any way to fix it?

    Thanks

    • This topic was modified 5 years, 6 months ago by Kuler89.
    • This topic was modified 5 years, 6 months ago by Kuler89.
    • This topic was modified 5 years, 6 months ago by Kuler89.
Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author ILLID

    (@mihail-barinov)

    Hello,

    Well, as I understand. this issue can be fixed by adding for relevance for some product source.
    So when searching for ‘Necklaces’ you first want to see products with this words inside title or inside category name?

    Regards

    Thread Starter Kuler89

    (@kuler89)

    Hey,

    Sorry for such a late reply. It’s been quite a busy week (and weekend). Well either really. I can work with both. Tags could work too. I really want to fully integrate this plugin and am willing to manually add tags to products (most of them already have them).

    How would I go about doing that?

    Thanks

    Thread Starter Kuler89

    (@kuler89)

    Another solution (if possible) would be to prioritize products that have both words in the title. So for example, if I search for “flower necklace” it should show all products that have BOTH in the title and then the rest that have either one.

    Plugin Author ILLID

    (@mihail-barinov)

    So you achive your needs please use following code snippet

    add_filter( 'aws_search_query_array', 'my_aws_search_query_array' );
    function my_aws_search_query_array( $query ) {
        $relevance = "( case when ( term_source = 'title' ) then 300 else 0 end ) +";
        $relevance .= "( case when ( term_source = 'tag' ) then 250 else 0 end ) +";
        $query['relevance'] = preg_replace( '/\(SUM\([\s\S]*?\([\s\S]*?case[\s\S]*?end[\s\S]*?\)[\s\S]*?\+/i', '$0' . $relevance, $query['relevance'] );
        return $query;
    }

    You need to add it somewhere outside the plugins folder. For example, inside functions.php file of your theme or use some plugin for adding code snippets.

    Also after adding this code you will need to go to the plugin settings page and click the ‘Clear cache’ button.

    This code will add more relevance to tags and title sources.

    Regards

    Thread Starter Kuler89

    (@kuler89)

    Thanks, I will try it and post results.

    Thread Starter Kuler89

    (@kuler89)

    It did help to some degree, but it’s still not at the level I want it to be. Is it possible to add relevance to an attribute named “collection”?

    Thread Starter Kuler89

    (@kuler89)

    I think I found what bugs my test searches all the time. I kept searching 3 letter words.

    When I search Golden Rose Necklace I get very random results. The first one is ok, but the rest just picks up on a random word and displays in their own order. But when I search for Golden Necklace everything is fine. “Golden Rose” is the name of the collection, category, tag, and in the Collection attribute.

    I tried adding a synonym for golden and golden rose but it didn’t help.

    Is there any way to force the search for golden AND rose AND necklace? Instead of golden OR rose OR necklace?

    Plugin Author ILLID

    (@mihail-barinov)

    It did help to some degree, but it’s still not at the level I want it to be. Is it possible to add relevance to an attribute named “collection”?

    Yes, it is possible. Please modify previous code. Just replace it with this new one and clear the cache.

    add_filter( 'aws_search_query_array', 'my_aws_search_query_array' );
    function my_aws_search_query_array( $query ) {
        $relevance = "( case when ( term_source = 'title' ) then 300 else 0 end ) +";
        $relevance .= "( case when ( term_source = 'tag' ) then 250 else 0 end ) +";
        $relevance .= "( case when ( term_source = 'tag' AND term LIKE '%collection%' ) then 800 else 0 end ) + ";
        $relevance .= "( case when ( term_source = 'category' AND term LIKE '%collection%' ) then 800 else 0 end ) + ";
        $relevance .= "( case when ( term_source = 'attr_pa_collection' ) then 800 else 0 end ) + ";
        $query['relevance'] = preg_replace( '/\(SUM\([\s\S]*?\([\s\S]*?case[\s\S]*?end[\s\S]*?\)[\s\S]*?\+/i', '$0' . $relevance, $query['relevance'] );
        return $query;
    }

    Is there any way to force the search for golden AND rose AND necklace? Instead of golden OR rose OR necklace?

    It is possible only with pro plugin version. It has feature to use AND search logic instead of OR. Read here more.

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘Optimizing Search Results’ is closed to new replies.