Rank a specific record higher

Hello, greetings to all. I am trying to integrate Algolia in my app. I have a list of many records stored as json. However, I want some specific records from it to rank higher(say I want to always show a specific record at the top). Is there a way to this?
Also I want to know how the proximity advanced feature works. I tried implementing it but had no luck with it.


Hey @sumedh :wave:

There are multiple ways to display results on top, namely using Optional Filters to rank certain results higher than others.

Let’s say that your records have the following shape:

    objectID: 1,
     promoted: true,
     name: 'Item 1'
    objectID: 2,
    promoted: false,
    name: 'Item 2'

You can then send the following query to Algolia in order to always rank higher the promoted items first:

var index = algolia.initIndex('my-index');

index.search('', {optionalFilters: ['promoted:true']});

Here’s some content about personalization that covers this topic further:


If instead of making certain results rank higher you want to display always the same result in the same position you should use Query Rules:


Regarding proximity, what are you trying to achieve?

Hey @gianluca.bargelli, got it. Thanks for the help.

1 Like

Also regarding the proximity, is it related to geolocation? Like the result which is close to my location would rank higher?

Proximity is not related to geolocation but rather it represent the distance between words in a query; for example, iphone case (proximity = 1) will have a better proximity than iphone red case (proximity = 2) and it will be scored higher:


That said, what you’re probably looking for is the Geo Ranking Criteria which will sort results by distance, from closest to farthest:


Let me know if this helps you out!