• Resolved digitalcrateds

    (@digitalcrateds)


    So I have a product of which contains the Tag “RS1600”. The AWS plug in settings has the %s%(contains) selected, which from my understanding means it will match any search entered regardless of its positioning.
    So, the issue is that the code “RS1600” is a parent code for a sub-selection of products, for example a full product code would be “RS1600-40v45F2021”. So my thinking here is that when anyone searches for this full code “RS1600-40v45F2021”, then the product with the tag “RS1600” should be displayed, correct? If so, the issue is that its not being displayed. If I just search for “RS1600”, then the product is displayed in the results.
    Am I missing something here?
    Other notes are that I have indexed the table, cleared the cache and ensured that “Tag” is selected to be indexed.
    Any help would be great.

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author ILLID

    (@mihail-barinov)

    Hello,

    So you have two products: “RS1600-40v45F2021” and “RS1600”.

    If you search for “RS1600” you will see both of them. If you search for “RS1600-40v45F2021” you will see only the first one, because the plugin searches exactly this long string and does not divide it into parts.

    Regards

    Thread Starter digitalcrateds

    (@digitalcrateds)

    No, I have one product, which has the tag “RS1600” in it, as per this image;

    https://cdautomation.co.uk/wp-content/uploads/2022/02/product.jpg

    The settings for the AWS search rule is set to %s%(contains), as per this image;

    https://cdautomation.co.uk/wp-content/uploads/2022/02/search-rule.jpg

    which states that the “Search query can be inside any part of the product words ( beginning, end, middle )”.

    So surely by searching “RS1600-40v45F2021” it should still display the product containing the Tag “RS1600” because it is contained in the search term in the same way that if I were to type “BL” I would expect to see results containing BLack and BLue?

    Plugin Author ILLID

    (@mihail-barinov)

    Search query “RS1600-40v45F2021” is not a part of “RS1600” word. It can be a part of a word like “RS1600-40v45F2021-123” or “123-RS1600-40v45F2021” or “123-RS1600-40v45F2021-123”.

    What you can make is use some custom code snippet to divide “RS1600-40v45F2021” into separated words like “RS1600” and “40v45F2021” and search for each of them.

    add_filter( 'aws_special_chars', 'my_aws_special_chars' );
    function my_aws_special_chars( $chars ) {
        unset( $chars[array_search( '-',$chars )] );
        unset( $chars[array_search( '-',$chars )] );
        return $chars;
    }
    
    add_filter( 'aws_normalize_string', 'my_aws_normalize_string' );
    function my_aws_normalize_string( $string ) {
        $string = str_replace('-', ' ', $string);
        return $string;
    }

    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.

    Thread Starter digitalcrateds

    (@digitalcrateds)

    Hi

    I’m not 100% clear on your explanation on why to be honest because you’ve simply added 3 more characters to the same search query, so not sure how RS1600-40v45F2021 is not part of the word “RS1600” but RS1600-40v45F2021-123 is, however, your code snippet has been a great help, so huge thanks for that :))) Very much appreciated.

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

The topic ‘%s% (contains) doesn’t work correctly within Tags’ is closed to new replies.