question about search

Help for integrating the Laravel package
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
User avatar
GülsümAkça
Posts: 57
Joined: 20 Nov 2020, 13:30

question about search

Post by GülsümAkça » 02 Nov 2021, 20:50

Hello, I have a question about the catalog search.
1. Products are found for both "women"' and "t-shirt" when searching for "women t-shirt",. As a result, "men t-shirt" are shown on the listing page when "women t-shirt" are searched. I want it to search for the words "women t-shirt" together so that men t-shirt do not appear in the search results.
2. I have products with sku number A-12 , A-13 , A-14 .... normally, when the sku number is entered in the search results, the product is found. However, products with sku numbers as A-12, A-13 cannot be found in the search section.
Can you help me about these two question?

User avatar
aimeos
Administrator
Posts: 7919
Joined: 01 Jan 1970, 00:00

Re: question about search

Post by aimeos » 03 Nov 2021, 08:14

The full text search uses OR for several terms but orders the results by relevance so if you search for "women t-shirt", T-Shirts for men will be found too but should be listed after the T-Shirts for women. You can adapt that to your needs by overwriting this method if you use MySQL:
https://github.com/aimeos/aimeos-core/b ... p#L89-L111

It's also possible to use the generic implementation of the text index manager which searches for fixed strings but keep in mind that it's extremely slow because it doesn't use any index and only returns exact matches:
https://github.com/aimeos/aimeos-core/b ... andard.php

By default, MySQL skips words that are less than four characters and here you can see how to change that:
https://aimeos.org/docs/latest/infrastr ... hort-words

But in your case it won't work because the dash in "A-12" is an operator for the full text search an will be removed so only "A 12" is left and this won't be found.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply