Dev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideGitHubNuGetDev CommunitySubmit a ticketLog In
GitHubNuGetDev CommunitySubmit a ticket

Rank search results

Describes the components that affect search results rankings in Optimizely Configured Commerce.

Understanding these components is critical to improving how your content is surfaced in customer search queries in Optimizely Configured Commerce. For the purposes of this article, the components put into the following groups: Search Types, Query Types, Indexable Fields, Product Search, and Boosting & Search Result Rankings.

Search types

There are three types of searches:

  • Product – this is used for both autocomplete results and full product search results
  • Category – this is used to populate the autocomplete with categories
  • Content – this is used to populate autocomplete with content

There is an index of certain fields for each search type (defined below). These fields have their corresponding search type identified in the admin console.

Query types

There are six types of "boostable" queries found within the Search Boosting section of the Admin Console (Admin Console > Marketing > Search > Indexing Options):

Query Type

Description

Queried Fields

Customer Product Number

Looks for matches that are specific to the product numbers of the current bill to or ship to.

Customer Product Number

 

Fuzzy

Looks for matches that are dependent on the fuzzy search settings.

ShortDescription and Category Names

Phrase

Looks for an exact match on the entire text of the search query.

Name, StyledChildren, ErpNumber, ErpNumberWithoutSpecialCharacters, ShortDescription, CategoryNames, ManufacturerItem, ManufacturerItemWithoutSpecialCharacters, Filternames, SearchLookup, Content and Specifications

 

Prefix

Looks for an exact match on the initial words of a phrase and partial match on the last word in the query.

Name, StyledChildren, ErpNumber, ErpNumberWithoutSpecialCharacters, ShortDescription, CategoryNames, ManufacturerItem,ManufacturerItemWithoutSpecialCharacters, Filternames, SearchLookup, Content and Specifications

 

Search Within

This query looks for exact matches on individual words and is used to narrow search results by filtering out non-matches within the existing results.

Name, StyledChildren, ErpNumber, ErpNumberWithoutSpecialCharacters, ShortDescription, CategoryNames, ManufacturerItem, ManufacturerItemWithoutSpecialCharacters, Filternames, SearchLookup, Content and Specifications

 

Word

Looks for exact matches for individual words included in the search query

Name, StyledChildren, ErpNumber, ErpNumberWithoutSpecialCharacters, ShortDescription, CategoryNames, ManufacturerItem, ManufacturerItemWithoutSpecialCharacters, Filternames, SearchLookup, Content and Specifications

 

Indexable fields

There are 34 Elasticsearch fields that are either required to be indexed or can be toggled to be included or excluded from the index. Any custom properties added to products or categories are indexable; however, they are not indexed by default, but can be enabled for indexing via the Application Dictionary. See the Adding Custom Properties to the Search Index article for more information.

The following list of Elasticsearch fields is mapped to one or multiple fields in the Configured Commerce database. Fields can be included or excluded from the index to make them queryable on the storefront. Adjusting their boost value increases or decreases the rank of search results based on what fields the query matches. A positive boost value applies an integer multiplier to the search score for that field and a negative boost value applies a fractional multiplier to the score. The exact scoring formula is complex and controlled by Elasticsearch; any adjustments to boosting should be tested with a number of queries to verify that the results are as desired.

Product search

  1. CategoryNames – Indexed by Default with default boost of 1

    This field includes the name of all categories associated to a product. Hits on any category name will influence the search results for products within that category.

  2. Content – Indexed by Default with default boost of .9

    This field includes the currently published content on product.

  3. ErpNumber – Required to be indexed with default boost of 3

    This field maps to the product number on product.

  4. FilterNames – Required to be indexed with default boost of .8

    This field contains any attribute values assigned to the product. If the attributes are assigned to the category the product is in and there is a hit on the attribute value it will influence the search results.

  5. ManufacturerItem – Indexed by default with default boost of 3

    This field maps to the Product Manufacturer Item field on the product.

  6. ShortDescription – Required to be indexed with default boost of 5

    This field maps to the Product Title field on the product.

  7. Specifications – Indexed by default with default with default boost of .9

    This field includes currently published content for all specifications on the product.

  8. StyledChildren – Required to be indexed with default boost of .8

    This field includes the Name, ERP Number, Manufacturer Item, Product Code and Model Number on the child product as well as the Name, Description and Value of Variant Traits on the child product. Hits on these fields will influence results for the parent product.

  9. UnitOfMeasure – Not indexed by default.

    This field maps to the Unit of Measure field on product.

  10. ProductCode – Indexed by default with default boost of 1

    This field maps to the Product Code field on product.

  11. ErpDescription – Indexed by default with default boost of 1

    This field maps to the ERP Description field on product.

  12. MetaKeywords – Indexed by default with default boost of 1

    This field maps to the Meta Keywords field on product content.

  13. MetaDescription – Indexed by default with default boost of 1

    This field maps to the Meta Description field on product content.

  14. Pagetitle – Indexed by default with default boost of 1

    This field maps to the Page Title field on product content.

  15. ModelNumber – Indexed by default with default boost of 1

    This field maps to the Model Number field on product.

  16. SKU – Not indexed by default.

    This field maps to the SKU field on product.

  17. UPCCode – Not indexed by default.

    This field maps to the UPCCode field on product.

  18. UNSPSC – Not indexed by default.

    This field maps to the UNSPSC field on product.

  19. PackDescription – Not indexed by default.

    This field maps to the Pack Description field on product.

  20. UnitOfMeasureDescription – Not indexed by default.

    This field maps to the Unit of Measure Description field on product.

  21. Vendor – Not indexed by default.

    This field contains values from the Vendor Name and Vendor Number for vendors associated with products.

  22. DocumentName – Not indexed by default.

    This field maps to the Name field on documents which are assigned to products.

  23. ImageAltText – Not indexed by default.

    This field combines the Alt Text values for all images on a product.

Category search

  1. Name – Required to be indexed with default boost of 3

    This field maps to the Category Name field.

  2. ShortDescription – Required to be indexed with default boost of 5

    This field maps to the Category Title field.

  3. PageTitle – Indexed by default with default boost of 1

    This field maps to the content Page Title field for category.

  4. MetaDescription – Indexed by default with default boost of 1

    This field maps to the content Meta Description field for category.

  5. MetaKeywords – Indexed by default with default boost of 1

    This field maps to the content Meta Keywords field for category.

  6. Content – Indexed by default with default boost of 1

    This field includes currently published content on category.

  7. ParentCategoryShortDescription – Required to be indexed with default boost of 1

    This field maps to the Category Title field of parent categories. Hits on a parent category name will have an influence on the ranking of their respective child categories.

Content search

  1. Title – Indexed by default with default boost of 1

    This field maps to the CMS page Title.

  2. MetaKeywords – Indexed by default with default boost of 1

    This field maps to the CMS page Meta Keywords.

  3. MetaDescription – Indexed by default with default boost of 1

    This field maps to the CMS page Meta Description.

  4. Body – Indexed by default with default boost of 1

    This field includes the content entered in the summary for the CMS page.

Boost and search result rankings

Boosting allows us to enter values within the Configured Commerceconsole that change how Elasticsearch calculates scores for the order of search results. The boost values entered in the Admin Console are multiplied by the score returned by Elasticsearch for that match. Therefore, a value less than 1 will reduce the importance of the field, query, category, or product in search rankings, a value greater than 1 will increase the importance, and a value of 1 will have no impact. The exact formula for how Elasticsearch determines the base score for any match may vary by query type match or other factors. Because the ranking scores are determined within Elasticsearch and not Configured Commerce, the exact sequencing of logic used to determine rankings is not known; however, the following list is the general construct of behavior:

  1. For each type of search (product, content, category), Elasticsearch executes the appropriate queries against the Elasticsearch index. The appropriate queries for each search type look for matches in their defined sets of fields.
  2. If a match is found in the product search for any of the query types, Elasticsearch considers that product to be a "hit" and creates a score for the match.
  3. Based on which query returned a match, the score for each match is modified by query boosting defined within the Admin Console.
  4. Based on which field returned a match, the score for each match is further modified by field boosting defined in the Admin Console.
  5. The scores of all matches for the product are added up.
  6. Applicable product and category boosting for the product is then calculated to return the final search score.
  7. Sponsored products display at the top of the search results and the other results display based on their score.

Scenario

A hardware site has a roofing nailer and roofing nails. A customer searches for “Nailer.”

The roofing nailer has the following matches:

  • Category Name – “Nailers & Staplers” – matches fuzzy query
  • Short Description – “Roofing Nailer” – matches word query
  • Content – “Nailer” included in product description – matches word query
  • Specifications – “Nailer” included in specification content – matches word query

The roofing nails have the following matches:

  • Short Description – “Roofing Nails” - matches fuzzy query
  • Content – “Nailers” included in product description – matches fuzzy query
  • Specifications – “Nailers” included in specification content – matches fuzzy query

Assume Elasticsearch returns a score of 10 for any query match.

By default, we use the following boost values in Configured Commerce:

  • Word Query – 6
  • Fuzzy Query – .9
  • CategoryNames – 1
  • ShortDescription – 5
  • Content – .9
  • Specifications – .9

For the roofing nailer would conceivably receive a score of 417:

  • Fuzzy CategoryNames = 10*.9*1 = 9
  • Word ShortDescription = 10*6*5 = 300
  • Word Content = 10*6*.9 = 54
  • Word Specifications = 10*6*.9 = 54

For the roofing nails would conceivably receive a score of 61.2:

  • Fuzzy ShortDescription = 10*.9*5 = 45
  • Fuzzy Content = 10*.9*.9 = 8.1
  • Fuzzy Specifications = 10*.9*.9 = 8.1