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
This option lets you control how items will be matched with the query phrase. By default, an item can be considered a match for the query phrase when one word from the searchable attributes is used in the phrase. Then, the item can be displayed in the search results.
Option name | Description |
---|---|
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. |
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. |
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. |
Example
By default, 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.
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.