Guides / Managing results / Rules

Keywords in queries are crucial terms that show user intent. They vary depending on the data in your index. For example, if a user types “red”:

  • On a clothing site, they’re probably looking for red clothes.
  • On a movie site, “red” might not refer to color.

Once you understand what specific keywords mean in queries, you can use rules to adjust the search results users get when they use those keywords. For example, you can:

  • Dynamically filter
  • Change the entire query
  • Category searches
  • Dynamically change search parameters.

Dynamically filter based on the query

Dynamic filtering applies filters based on keywords. For example, if someone searches for “cheap toaster 800w,” you could create a rule to filter on toasters priced under $25 with an 800w power rating.

Change the entire query

Sometimes, users may search using informal terms not in your records. For example, “iwatch” instead of “apple watch”.

To handle this, you can create rules to replace an entire query with an alternative set of words.

For example, to replace queries containing “iwatch” with an “apple watch” query:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
{
  "conditions": [
    {
      "anchoring": "is",
      "pattern": "iwatch",
      "alternatives": false
    }
  ],
  "consequence": {
    "params": {
      "query": "apple watch"
    }
  }
}

To help determine these informal terms, review your Search analytics.

Category searches

You can use rules to recognize categories in queries and refine the results based on that. For example, on a document library site, in the query “article ref21,” “article” is a category. 

  • Without a rule, the search probably fails since it searches for the terms “article” and ”ref21” but it’s unlikely that your records contain the category name “article”.
  • With a rule that recognizes and removes the “article” category, the search succeeds (“ref21” replaces “article ref21”).

Dynamically change search parameters

After parsing a query, you can use a rule to determine which parameters best apply to the search.

For example, you can turn typo tolerance on or off, change geolocation settings, search for only certain types of attributes, or add filters.