Concepts / Managing results / Troubleshooting relevance
Jan. 07, 2019

Troubleshooting relevance

Troubleshooting Overview

Our docs are written to reach the widest audience. We do not try to address every situation that our customers will face. At some point, more individualized guidance is required.

For this, we offer 2 tools to help you troubleshoot.

  • Look at the numbers used to rank records. See below.
  • Follow your user’s behavior with Analytics. Go here.

The Engine’s Ranking Decisions

You can find out why a record is ranked the way it is, and use this information to troubleshoot your data and relevance settings. You can do this in the Dashboard or via the API.

Troubleshooting in the dashboard

If you go to your dashboard and search, you have a “Ranking Info” section that details how Algolia ranked this record.

Ranking 6

If you look at the second hit, you’ll have the difference between this object and the one above it.

Troubleshoot via the API

Ranking information can be retrieved via the API. For that, you need to use the parameter getRankingInfo and set it to true.

Initialize the client

1
2
3
4
5
6
7
8
9
10
11
12
// composer autoload
require __DIR__ . '/vendor/autoload.php';

// if you are not using composer
// require_once 'path/to/algoliasearch.php';

$client = \Algolia\AlgoliaSearch\SearchClient::create(
  'YourApplicationID',
  'YourAdminAPIKey'
);

$index = $client->initIndex('your_index_name');

Search with getRankingInfo

troubleshoot_with_the_api

This gives you ranking info

Take a look at the following results in the _rankingInfo attribute:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
{
  [...],
  "_rankingInfo": {
      "nbTypos": 0,
      "firstMatchedWord": 0, 
      "proximityDistance": 0,
      "userScore": 7,
      "geoDistance": 1600,
      "geoPrecision": 1,
      "nbExactWords": 0,
      "words": 0,
      "filters": 0,
      "matchedGeoLocation": {
          "lat": 37.3688,
          "lng": -122.036,
          "distance": 1600
      }
  }
}

Did you find this page helpful?