November 17, 2022

Tyler Huff


5 min. read

When it comes to site search, some keywords that users type into the search bar can be tricky. Maybe your customers search for specific content you simply don’t have, so you need to redirect them to similar content. Maybe you want to prioritize a certain type of content when a user includes a specific keyword in their search. Whatever the end result, you want your search to have certain rules based on conditions or keywords.

SearchStax Studio has a Rules-based feature that lets marketers shape the search experience for their website visitors. Let’s see how Rules work and how some of our customers are using the feature.

What is a Rule in SearchStax Studio?

A rule is an if-then command that has a condition (trigger) and an action or actions that follow. Within SearchStax Studio, the trigger is the query or keyword that a user types into the search bar on a website.

Rules are one of the features that make up what we refer to as a Relevance Model in Studio and consist of a Trigger and Action.


The trigger can be set using one of two options: Contains or Exact Match.

With Contains, the triggering keyword has to be contained in the query such as “site” in the phrase “site search.”

For Exact Match, the triggering keyword or keywords must match the query exactly. For example, the query “site search” must exactly match the trigger “site search.”


Actions are where it starts to get interesting. You can choose from four unique actions and add as many as you like to a rule. Let’s look at each one.

  1. Replace a Search Term – Replace lets you search on a different term entirely. If “site search” was the original query and the replaced one was “SearchStax Studio,” Studio would run a search on “new example.”
  2. Filter on a Field Value – Filter lets you preselect a facet value to filter on. For example, filtering on blog posts on a “content type” facet.
  3. Boost Using a Field Value – Boost prioritizes content that has a value in a field you select. For example, prioritize all documents with the value “blog” in the field “content type.” The result would be more blog posts are shown with that triggering keyword than other content.
  4. Boost Using a Function – Functions lets you leverage the functions that are built into Apache Solr. Functions let you use Solr functions to influence the search results. An example would be to prioritize newer or recently published documents over older content.

Why are Rules Helpful?

Rules are helpful for one simple reason. They are query specific.

What does that mean exactly? All the actions listed above can be set up in Studio to run for every search or regardless of the search keyword. In some cases, that’s useful, but not for all search queries. Rules let you take advantage of the actions, but only for certain conditions or triggers.

You may not always want to favor your blogs over case studies. You may want to prioritize documentation content over blogs when a user searches for documentation. What if a user searches for “most recent blogs”? In that case you want to favor recently published content over old content. The examples are endless, but the idea is that sometimes you want actions to fire only on certain conditions.

Let’s take a look at customer examples to nail down the idea.

Customer Examples for Using Rules

Replace a Search Term

What do students often search for at universities? Their GPA or grade point average. Now because of how Solr works, when a student searches for “grade point average, the search engine will find matches for “grade,” “point” and “average.”

In this case however, we know students are searching for their GPA. So this rule replaces the keywords “grade,” “point” and “average” with the more accurate key phrase, “grade point average.” Now, Studio will only look for exact “grade point average” matches to find more relevant results.

Example of a rule within SearchStax Studio that replaces a search term with another

Boost Using a Field Value

Now, let’s take a look at what another customer has done. They are a local government entity. Their users can search through all the legislation and bills that have passed.

In this case, all legislation related content has “BL” in it, short for Bill. So the trigger is any search that has “bl” contained in it. Users searching for a keyword with “bl” in it are likely looking for bill or legislation related content.

Now the bulk of the legislation related content is located in two subdomain sites that are indexed into Studio – legistar and legisarchive. So, the actions in this case are boosting the content from the legistar and legisarchive sites by 55 out of 100.

The end result is, when a user searches for something with “bl” contained in it, content from the legistar and legisarchive sites are prioritized and appear higher in the search results.

Sharing Insights About Sitecore

A rule boosting two field values within SearchStax Studio

Boost Using a Function and Field Value – APQC Podcast Rule

Last, we have my favorite rule. The trigger is simple – any query that has “podcast” contained in it. So, users are likely searching for different podcasts when this rule is triggered.

Let’s take a look at the first action – Boost using a function. The Solr function in this case is recip(ms(NOW,ds_publish_date),3.16e-11,10,1). Sparing the technical details, the point of this function is to favor recently published documents. You can see the field ds_publish_date that the function (it’s technically two Solr functions) acts on.

Now on to the second action – boost using a field value. In this case the field is “content type” and the value is “podcast.” So podcasts will be prioritized in the search results.

If you combine both actions, you get recently published podcasts bubbling up to the top results when a user searches for something with “podcast” in it, which is exactly what a user would expect.

A rule boosting both a function and a field value within SearchStax Studio

Wrap Up

All in all, the Rules feature is just one tool of many that marketers have in SearchStax Studio to improve the search experience for website visitors. If you want to learn more about Rules or other SearchStax Studio capabilities, schedule a personalized demo and walkthrough.

By Tyler Huff

Solutions Engineer in Pre/Post Sales

“…search should not only be for those organizations with massive search budgets.”

Get the Latest Content First