{"section":"tutorials","requestedLocale":"en","requestedSlug":"how-does-vtex-search-work","locale":"en","slug":"how-does-vtex-search-work","path":"docs/en/tutorials/catalog/search/how-does-vtex-search-work.md","branch":"main","content":"This article sets out to describe how VTEX's search system works.\n\n> ⚠️ **Warning**: VTEX has two search options - VTEX search and VTEX Intelligent Search. This article refers to the VTEX search. To learn more about the VTEX Intelligent Search application, see [this track](/en/tracks/vtex-intelligent-search--19wrbB7nEQcmwzDPl1l4Cb).\n\n## VTEX search engine product display prioritization \n\nVTEX search engine is an intelligent algorithm that identifies which result to best show the user based on the search term.\n\nIn addition, the result displayed will always be the one that will generate more sales conversion. The success of this result depends solely on the catalog master file (brand, department, category, product, specification, etc).\n\nIn accordance with the search term, the system may render the following result pages, by order of priority:\n\n1. Landing Page\n2. Brand\n3. Department\n4. Search by term (keyword)\n\n### 1. Landing Page\n\nIf the term searched for corresponds to the name of a folder which is set up in Portal Manager (the landing page), this folder will be rendered.\n\n> ⚠️ **Notice**: a folder needs to have a layout in order to be searchable.<br />**Even if the search in done in the subfolder, the parent folder also requires layout.**\n\n### 2. Brand\n\nIf the searched for term corresponds exactly to the name of or substitute word for a brand which is registered in the master file, the system will only render products of this brand. If the system identifies two or more brands with the same **substitute word** (which is considered an inconsistency in the master file), the system will render only the first one found (and its products);\n\nThe result of this page will be a brand page, having the source code as follows: ``\n\n### 3. Department \n\nIf the term searched for corresponds exactly to the name of or substitute word for a registered department, the system will render only the products belonging to this department. If the system identifies two or more departments with the same **substitute word** (which is considered an inconsistency in the master file), the system will render only the first one found (and its products);\n\nThe result of this page will be the Department page. Checking the source code will allow you to identify which result was displayed. The following comment should be found in the page code: ``\n\n### 4. Search by keyword\n\nIf the system does not identify the Landing Page, Brand or Department according to the term searched for, it applies a search by term (keyword).\n\nThe result of this page will be a search page. Checking the source code will allow you to identify which result was displayed. The following comment should be found in the page code: ``\n\nWhen the search is by keyword, the search engine undergoes a search of the __indexer__, which is responsible for the search algorithm by keyword.\n\n__Ranking System:__\nThis algorithm uses the concept of ranking (Score) to prioritize and order products. For each search, the indexer allocates a score to products based on the search term. Some basic fields (having different weight) are considered when calculating this ranking. The shop window display is created according to this ranking, from highest to lowest, meaning that the product with the highest score displayed first, while the one with the lowest score, last.\n\n> ℹ️ For more information, see the article [How does the Score field work?](/en/docs/tutorials/how-does-the-score-field-work).\n\n## How the search is done\n\nTo understand VTEX search, we must first become familiar with the indexer and its update process.\n\n### Catalog Indexer\n\nThe catalog indexer is a quick access scalable database, with configurable algorithms for result prioritization. It is positioned between conventional database and user. See the outline below:\n\n![database](https://cdn.statically.io/gh/vtexdocs/help-center-content/refs/heads/main/docs/en/tutorials/catalog/search/how-does-vtex-search-work_1.JPG)\n\nThe indexer contains all the information referring to the product catalog (products, SKUs, brands, departments, categories). The search engine uses this information to locate products and to display these in shop windows and search results. However, __only already indexed products can be found by the search__.\n\n### Updating process (Indexing)\n\nAny changes made to the product (main data, price, inventory, collection, etc.) will generate an update in the indexer, meaning that __whenever changes are applied to a product, it is sent to the end of the indexing queue__. \n\nWhen this indexing queue is consumed, the changes applied will be available for display on the website. The indexing process is extremely safe and has “repêchage” rules. Whenever an item is not indexed in the first attempt, the system makes other attempts.\n\n### Fields and their weights\n\nThe following fields and their respective weights are used by the search algorithm when ranking a product:  \n- __Product name__: 2.8\n- __First product name__: 2.5\n- __First and second product name__: 1.2\n- - __Full product na__me__: - __1.0\n- __Substitute words (product an__d bran- __d): 0.7\n- __Product specifications (only for indexed text and indexed long text fields)__: 0.5\n\n__Example__\n\nConsidering the following indexer:\n\n| Product name     | Complementary product name\t    | Substitute words     | Product specifications     |\n| ---------- | ---------- | ---------- | ---------- |\n| Soccer ball       | Football 7      | soccer ball, football ball       | White       |\n| Ball       | Football 7       | society       | Soccer ball       |\n| Soccer boot       | Field       | Soccer boot, Soccer boot       | White       |\n\n> ℹ️ Search term 1: **Soccer ball**\n\nResult:\n1. **Soccer ball** (Highest ranked, since the term corresponds exactly to the product name)\n2. **Ball** (Second best ranked, since the term corresponds to a specification value)\n3. **Soccer boot** (Third best ranked, since part of the term corresponds to part of the product name)\n\n> ℹ️ Search term 2: **White Ball**\n\nResult:\n1. **Ball** (Best ranked, since part of the term corresponds exactly to the product name)\n2. **Soccer ball** (Second best ranked, since part of the term searched for corresponds to part of the product name)\n3. **Soccer boot** (Third best ranked, since part of the term corresponds to a specification)\n\n**Hint:** The use of __substitute words__, in spite of their low indexer score weight, is an extremely important feature. With this feature, it is possible to reach users that search for grammatically incorrect terms, but with the same semantics. \n\n## Read more\n - [How does the Score field work](/en/docs/tutorials/how-does-the-score-field-work)"}