Edit search method and define search relevance
In this article, you can find instructions on how to change the search method in existing index. If you haven’t created any yet, refer to the “Create an index” article.
Apart from editing the search method, you can define search relevance settings such as:
- Matching words to control how items will be matched with the query phrase
- Ranking function to select query scoring method
- Tie breaker to resolve a situation where two or more items have the same score or ranking in a given context.
Configuration
To edit the search method and ranking settings:
- Go to AI Search.
- Create or select the index on the list.
- Go to the Settings tab.
- On the Search method section, click Define.
- Optionally, you can change the search method.
- By clicking Select attributes, you can add or remove attributes.
- To define search relevance settings, click Advanced options:
Matching words
In the Matching words section, you can specify how multiple-word queries are processed. When a user enters a search query, the system compares the words in the query with the searchable attributes (selected while creating an index) of items in the index. By default, the At least one word must match option is enabled.
For example, when a customer searches for white shoes
, the search returns white shoes, but also other white items and shoes that are not white. To narrow down the results to white shoes
only, you can use the All words must match option.
The table below explains the different matching options. Note that the Matching Words section is available only for Keywords and Hybrid search methods.
Option name | Description |
---|---|
Adaptive | This method automatically adjusts the matching behavior based on the length of the query. - For short queries (up to 2 words), an item is considered a match when every word from the query phrase is present in the item’s searchable attributes. - For longer queries (more than 2 words), an item is considered a match when all except one word from the query are present in the item’s searchable attributes. Use this option when you want a balanced search — tight for short queries and more flexible for longer ones, ensuring relevant results. |
At least one word must match | An item is considered a match for the query when at least one query word matches the searchable attributes. Use this option when you want to relax the search criteria and accept less relevant results. |
All words must match | An item is considered a match when every word from the query phrase is present in the item’s searchable attributes. Use this option when you want to tighten the search criteria at the cost of retrieving fewer results. |
Minimum number of words that must match | Define the minimum number of words from the search query that the item’s searchable attributes must contain. |
Maximum number of words that can be omitted | Define the maximum number of words from the query phrase that an item doesn’t need to contain in its searchable attributes. |
Low match enhancement | When this option is enabled and the number of items returned in search results is lower than 5, you can complement search results with other items. You can select one of the following methods for selecting additional items: - Adaptive - This option works as described in this table. - Any words - If any word from the query matches the item’s searchable attributes, the item is selected to be included in the results. - Minimum match - A configurable number of words from the query must match the item’s searchable attributes so it can be included in the results. |
Ranking function
In this section, you can choose between two methods of scoring items. The ranking function is used by the search engine to calculate the item’s relevance to a customer’s query. The relevance is one of the factors taken into account while scoring items. The items are returned in order according to their score.
You can select one of two options:
- The basic function - This option is not configurable.
- The adjustable function - This option contains two configurable parameters described in the table below:
Option name Description Length of attributes Adjust how the length of the searchable attribute values affects the distribution of score for an item when a word from the query matches the searchable attributes. An item gets a higher score when a word from the query matches attributes with fewer values (words) in contrast with the same word that matches longer attributes. The difference between the scores is controlled with this parameter; the higher the parameter, the bigger the difference will be. Word frequency Each occurrence of a word in the query phrase that matches the searchable attributes will add an amount to the item score. The higher the value of the word frequency parameter, the less is added to the overall score after every occurrence of the same word in the searchable attribute importance group.
Example
- A brand name is included in the
name
,brand
, andtitle
parameters of an item. - All the above attributes are searchable.
- The Word frequency parameter is set to a high value.
- A customer enters the brand name as the query.
Result:
This item is not scored higher than items that include the brand only in the brand
parameter.
Tie breaker
If a word from the query matches two or more searchable attributes and each of these attributes has a different importance level assigned, they contribute to the score of the item. The tie breaker parameter defines a weight by which the second (and subsequent) matched attribute is multiplied while adding to the score.
One way to use this mechanism is to assign two importance levels to an attribute while setting up searchable attributes. If a word from the query matches an attribute with two importance levels, that word adds more to the final score than a word that matches an attribute with one importance level.