If you’re using our web crawler, you can use the popularity meta tag to set a popularity score. If you’re using our API or WordPress plugin, you’ll need to add a custom attribute to track the popularity.
Once you’re recording popularity, use a functional boost to adjust the ranking.
Using our search API, you can apply a linear boost to each matching result’s score:
curl -XGET 'https://api.swiftype.com/api/v1/public/engines/search.json' \
-H 'Content-Type: application/json' \
-d '{
      "engine_key": "YOUR_ENGINE_KEY",
      "q": "your query terms",
      "functional_boosts":{
        "YOUR_DOCUMENT_TYPE":{
          "popularity": "linear"
        }
      }
    }'
This will multiply the score of every document by its popularity.
If you’re using our web crawler and our jQuery search library, you can add a linear functional boost like this:
$("#st-search-input").swiftypeSearch({
  engineKey: "YOUR_ENGINE_KEY",
  resultContainingElement: "#your-result-div",
  functionalBoosts: {"page": {"popularity": "linear"}}
});
If you’re using our standard JavaScript embed, boosting can be configured by adding the popularity field to the Weights tab.