-
-
Notifications
You must be signed in to change notification settings - Fork 436
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Minimal Query Length] issue for search strings of 1 - 2 characters #4080
Comments
Thinks this is a known MySQL problem that cant be fixed via code change ... see https://magento.stackexchange.com/questions/7619/magento-search-less-than-4-characters |
@SuSiSonnenschein111 - Very good observation, I did not expect it to depend on the configuration of the database server. I will check and if it is confirmed then an information message must be added under that option in the Backend to avoid confusion. According to MariaDB docs, ft_min_word_len value must be between 1 and 84. The default value is 4. In MySQL 8.4 docs the maximum value is 82. |
I set the value 1 for fn_min_word_len in my.cnf. In OpenMage I set the value 3 for Minimal Query Length. I reindex data for "Catalog Search Index". I had to repair the table catalogsearch_fulltext too. It would be natural to get in the Frontend the error message "Minimum Search query length is 3" if I search for 1 or 2 characters, but it is not displayed and I am getting a long list of products, the same behavior like in my initial report. My opinion is that it is a problem in the OpenMage source code: magento-lts/app/code/core/Mage/CatalogSearch/Helper/Data.php Lines 96 to 106 in 0b27c5f
this method returns a wrong result. Let's take as example a few values: $minQueryLength = 4 (the one set in the Backend) the result is 1 which is not correct, this is why I am getting the products list instead of the error message. Let's go further: For $thisQueryLength = 1, 2 and 3 the result is 1. Starting with 4 there is no result. Try the test here The MySQL config variable is not processed in the whole CatalogSearch module. |
Pls check emails I've sent - and close it. |
There is an issue related to the "Minimal Query Length" value set in the Backend. In order to reproduce this issue follow these steps
Go to the Backend > System > Configuration > Catalog > Catalog Search
Set "Minimal Query Length" to 3
In the Frontend search for
a => There are 1173 results in my case [incorrect]
ab => There are 524 results in my case [incorrect]
abc => There are no results [correct]
Go to the Backend > System > Configuration > Catalog > Catalog Search
Set "Minimal Query Length" to 4
In the Frontend search for
a => There are 1173 results in my case [incorrect]
ab => There are 524 results in my case [incorrect]
abc => Warning message "Minimum Search query length is 4" [correct]
abcd => There are no results [correct]
As you can see, OpenMage always returns results for a string consisting of one or two characters, no matter if you set the minimal query length to >=3 . This issue is a legacy from Magento.
The text was updated successfully, but these errors were encountered: