In magento's quick search, good results are often not obtained. If no product is found, all products are listed, which is not as ideal as advanced search results. Is there any way to increase the efficiency of quick search to the level of advanced search? You can do it as follows:
- Do a full DB Backup (just in case) (the first step is to back up the database and the app folder under the directory if a problem occurs .)
Replace "or" with "and" app/code/CORE/MAGE/catalogsearch/model/resource/Fulltext. PHP at line 331 and 355. (modify the two lines of the file here, or change to and, note the case sensitivity)
- Model rewrite through our custom module (more preferable)
- Placing the APP/code/CORE/MAGE/catalogsearch/model/resource/Fulltext. PHP into APP/code/local/MAGE/catalogsearch/model/resource/Fulltext. PHP (faster approach, less preferable) (copy the file to this folder)
- Go into database then run: (enter the MySQL database and run the following SQL statement)
UPDATE catalog_eav_attribute SET is_searchable = 0;
This will set all product attributes to "use in quick search" => NO.
- Go into database then run :( enter the MySQL database and run the following SQL statement)
UPDATE catalog_eav_attribute SET is_searchable = 1 WHERE attribute_id = (SELECT attribute_id FROM eav_attribute WHERE attribute_code = "name" AND entity_type_id = (SELECT entity_type_id FROM eav_entity_type WHERE entity_type_code = "catalog_product"));
This will set only the "name" attribute to "use in quick search" => yes, which is sort of the whole point of this article, having one or minimal set of searchable attributes to get more precise result set.
- Go into database then run :( enter the MySQL database and run the following SQL statement. This command will delete the previously created Search Condition/search terms, or delete it)
DELETE FROM catalogsearch_query; DELETE FROM catalogsearch_fulltext;
This will clear all previusly built search query.
- Go into magento admin, then do a full reindex (actually onlyCatalog search indexIs relevant for this). (rebuilding the cable line)
You can easily make an extension for switching magento between its or and your and statement, have it exposed as configuration value underSystem> Configuration> catalog search> or/and. (You can change the search condition to or and, that is, like/fulltxt. Different results will be returned)
Hope this helps.
Quick Search changes to advanced search, improving the accuracy of quick search results