Skip to main content
You can configure query rewrite rules to help users find more relevant results. Create rules to account for underperforming or misspelled search terms, identify phrases to boost items, map synonyms to alternative search terms, and remove words from queries that limit the results returned. To learn more about the different rewrite rules, see Types. To start creating and publishing query rewrites, refer to the Manage rewrites section.

Query rewrites vs. rules

Query rewrites improve the accuracy and relevance of search results by modifying the query. In contrast, rules manipulate the ranking and presentation of search results. Query rewrites focus on the user’s intent. They take effect before the query is submitted and results are returned.

Types

There are several different types of rewrite rules to choose from depending on your use case.

Underperforming Queries

An underperforming rewrite, also known as a tail query rewrite, replaces a poorly-defined search term with an improved one. This function adds fields that are used as facets and tags to clarify intent, which improves the relevance of results.
  • B2B organizations use this feature to change vague or incomplete user entries and add structured information that clarifies user intent and enhances relevant results. For example, if a user enters a query using general terms, a query rewrite can add business-specific terminology to improve the results returned.
  • B2C organizations use this feature to interpret user entries that may be general or ambiguous and add fields that align with items in the product catalog. For example, you can create a tail query rewrite that replaces the query iphone case yellow with iphone case yellow +color:"yellow", which uses the color field in your search facets.
  • Knowledge management organizations use this feature to tag incomplete or imprecise user queries with existing content to improve discoverability of site information. For example, if the user enters set password, the tags may include set password +doc_type:"login credentials".

Misspelling Detections

A misspelling query rewrite detects and corrects common spelling mistakes. When a customer enters a search term containing a known misspelling, the incorrect spelling is replaced with the spelling correction.
  • B2B organizations enter corrections for industry-specific terminology, jargon, or technical terminology. For example, if your organization provides auto parts, a user might enter brake petal, so the correction would be brake pedal.
  • B2C organizations enter corrections to common misspellings of items in the product catalog. For example, if your customers frequently misspell or mistype the word sweater as sweatre, you can define an entry to correct it.
  • Knowledge management organizations enter terms from their content that users frequently misspell. For example, if medication clinical trials are part of the data, the user enters metfrmin side effects, so the correction your site enters would be metformin.

Phrase Detections

A phrase rewrite identifies phrases used in search terms so that products with matching phrases are boosted in the search results. This is helpful when users do not use quotation marks to identify phrases in their search terms. For B2B, B2C, and knowledge management organizations, this function adds quotation marks around the phrase the user enters to match the entire phrase and not the individual words of the phrase. For example, without phrase detection, a search for the words remote control would show results for both remote and control. With phrase detection, this search would correctly boost results for "remote control".

Synonym Detections

You can specify synonyms for a query so that alternative words with the same meaning are automatically used in the search query. When a customer enters a search term with a synonym match, the alternative words are used instead of, or in addition to, the original search term. B2B, B2C and knowledge management organizations enter synonyms for products and content specific to their site. For example, a B2C organization might enter synonyms such as pullover and jumper for the search term sweater. Synonym query rewrites can be one-directional or two-directional.
  • One-directional synonyms replace the original query with the synonym. Use a one-directional synonym if you are confident the synonym is best for your product catalog.
    For example, a running specialty store may use a one-directional synonym to rewrite the term sneakers to running shoes.
  • Two-directional synonyms expand the query to include the original term and specified synonyms. Use a two-directional synonym when terms are used interchangeably (sweater and pullover) to increase the volume of results.

Word Removal

Use the remove words rewrite to simplify search queries and increase results. B2B, B2C, and knowledge management organizations determine words to remove that will improve query results for their site. For example, a B2C organization may rewrite the query best wireless headphones to remove the word best, which restricts the number of results returned. The improved query, wireless headphones, returns more results.
FAQ: When should I use a remove words query rewrite instead of an underperforming rewrite?Use a remove words query rewrite to broaden a query to include more results. Use an underperforming query rewrite to simplify a complex query (head) or expand a short query (tail).

Manage rewrites

To get started working with query rewrites, navigate to Commerce Studio and click Rewrite to display the Query Rewrites screen.

Create a query rewrite

The general steps to create a query rewrite are as follows:
  1. Locate the tab specific to the query rewrite type.
  2. Click Add new.
  3. Enter the required information for your rewrite type as explained below and then click Save.
To view the steps for a specific rewrite type, click the title tab.
  1. In the Tail Query field, enter the text for an underperforming query. For example, latest shoes.
  2. In the Improved Query field, enter new text for the query. For example, new shoes. To add another query, click + Add and enter the text in the new field.
  3. Optional: In the Description field, enter user-defined text to describe the query. For example, improve to display new shoes.

Edit a query rewrite

To edit a query rewrite, hold the pointer over the entry and click the pencil icon. Enter the changes for the specific query rewrite and click Save.

Publish a query rewrite

To publish a query rewrite, click the Publish toggle to the Yes position. To unpublish, click the toggle again. Published query rewrites start working immediately. To publish multiple query rewrites, select the checkbox for each of the rewrites to publish and then click the up arrow. The toggle switches for each of those entries changes to Yes. To unpublish multiple query rewrites, select the checkbox for each of the rewrites to unpublish and then click the down arrow. The toggle switches for each of those entries changes to No.

Delete a query rewrite

  1. Select the checkbox of the query rewrite to delete.
  2. Click the trash can icon.
  3. Confirm your choice in the dialog box that appears.
To delete multiple rewrites, select the checkbox for each of the rewrites to delete and then click the trash can icon.
Query rewrites are deleted permanently. There is no way to undo this action.

Effective workflows for teams

Your team’s Data Analyst monitors Analytics Studio to identify low performing queries, recommends recommend which queries should be rewritten, and helps verify query rewrites are effective. Apart from the insights Analytics Studio provides, your team may start with existing industry knowledge. For example, some clothing brands prefer the term “pant” over “pants.” Depending on your catalog, your team’s Product Manager may create a synonym query rewrite to treat the query pants the same as the query pant. Your Customer Experience Manager creates query rewrites based on knowledge of your customers’ intent. For example, the CX Manager rewrites the query term cheap to the query terms discount or sale. These rewritten queries trigger rules that are used in a sales event.