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
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.
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.