How can I boost results in relation to the source domain?

I’ve created an engine from 3 domains, and I offer a search box on each domain/site. I’d like users to be able to find content from each of the domains, but I want to give preference to the site they’re currently visiting.

More specifically: if I’m searching on my docs site, I’d like the top 5 results to come from the docs site, and then after that I’m ok with a mix of results from all three sites (docs, blog, www).

Controlling domain based relevancy is a two-step process. The first step is to include domain information in your indexed documents using Swiftype meta tags. For each domain, you’ll want to include a numeric value representing the current domain. Say for example you have three domains,, and For pages on include the following meta tags:

<meta class="swiftype" name="onecom" data-type="integer" content="1" />
<meta class="swiftype" name="twocom" data-type="integer" content="2" />
<meta class="swiftype" name="threecom" data-type="integer" content="1" />

For each of the other domains, change the content attribute from 1 to 2 to match the domains.

After adding the meta tags, request a recrawl from the Swiftype dashboard.

Once you have the domain fields indexed, you can control relevancy at query time using the functional boosts feature. When on the domain, the query syntax will be something like:

curl -XGET '' \
  -H 'Content-Type: application/json' \
  -d '{
        "auth_token": "YOUR_API_KEY",
        "q":"my search",

This structure of this query says that the user is on the domain, therefore apply a logarithmic boost to the twocom field. The twocom field will be indexed as 1 for the domain and 0 for all others.

When on the domain, the query syntax will change to apply a functional boost to the threecom field ("threecom":"logarithmic").