Quick Search changes to advanced search, improving the accuracy of quick search results

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.