Redirect rules

Redirect rules allow customers to alter the destination of users' queries. Imagine a user searching for the term "shopping cart." Redirects allow this user to be sent to the shopping cart URL rather than a search result page for shopping cart products.

The redirect rule endpoint allows customers to define a set of patterns that are checked against search queries. If there is a match, the search endpoint returns a redirect response to the client pointing to the desired target URL (or alternative content identifier in mobile contexts).

Rules are matched in order of specificity, from most specific to least. This allows customers to set one redirect for a broad term, but override this with more specific keywords or phrases.

API endpoints

Redirect rule match object

The redirect rule match object is the definition of a match within a redirect rule:

  • match_type: string, required. Match type (any of "EXACT," "UNORDERED," or "PHRASE")
  • pattern: string, required. The pattern that needs to be matched against the search query.

Match types

  • EXACT: pattern needs to match the search query exactly.
  • UNORDERED: all tokens in the pattern need to match the search query, but not necessarily in the same order.
  • PHRASE: all tokens in the pattern need to match the search query, but the search query may include additional tokens.