Text Relevance
You can improve search results for your customers by boosting attributes which are more significant when they contain a search term.
Usually these are shorter attributes that are related to fields that customers are likely to search on, such as product name or brand. You can also boost the importance of category attributes, such as category name. For example, if a customer searches notebook, the results from the notebook category are returned first, and paper products with the word notebook in the title or description are included at the end of the search results.
How Text Relevance Is Determined
When a customer enters a search term, Salesforce B2C Commerce computes a score for each document. The score is based on how many times the search term is found in each searchable attribute, the boosting factor, and other weighting factors. When search results are sorted by text relevance, the score of the document determines the order in which documents are returned in the result set, with the highest score going to the document that is the most relevant to the search.
What affects text relevance:
- How many times the word appears in each attribute in the document.
- What the boosting factor is for each searchable attribute.
- How many times the word appears across all documents – rarer terms get a higher score.
- How many times a term appears in a particular document – more frequent terms mean a higher score.
- How many terms are in the field. If there are many terms in a field, it gets less of a score than if there are fewer. This is because if there are only a few terms in an attribute, such as in a product name, finding the term is more significant than if it's found in an attribute with many terms, such as long description.
However, it doesn't matter where in the attribute the search term is found or the length of the term.
Text Relevance Boosting Factors
If you specify a boosting factor of 1.0, the score does not change at all because this is the default value for a boosting factor. The boost factor you specify to calculate text relevance is in relation to the entire index, not the search results returned by a particular query. You can specify a boosting factor under 1.0 if you want to indicate that a specific field is less relevant. You can use any decimal number under 1 (.5, 0.3) to make a field less relevant, however you can't use negative numbers.
Specifying a boosting factor over 1.0 increases the text relevance of the field, so that including a boosting factor of 2.0 makes the field twice as relevant as it was originally, in relation to all of the other fields of the document.
Generally, you want to boost attributes that contain only information relevant to the product, such as the product name or short description. If you boost fields with more general information, you don't improve the sorting of your search results. For example, if you boost the long description of a product, which includes statements such as "Create an outfit for this shirt by adding our cargo pants", the item might be boosted ahead of pants, so that you see a mix of shirts included with a search for pants.
Remember that the search score affects the scoring of all items, not just the items in your current result set. It's important to test the impact any field boosts have with various queries to make sure that the boost doesn't have unintended consequences.
notebook
and notebook and laptop are
synonyms, then products that are laptops will also appear at the top of the search
list.Testing Boosting Factors
Salesforce recommends that you disable other search sorting rules when testing attribute boosting so that you can see the effect of the boosts alone. You can use the Storefront Toolkit to see the effect of the boosts you create.