[Deduplication] Detect if hit was grouped by Algolia

I have configured the distinct feature of Algolia. It now returns only the most single relevant result (hit), which is good. For my UI I’m using the Instantsearch API (JavaScript) implementation and I’d like to know if the results (hits) I’m looping through have been deduplicated or not.

I’m looking for a property like isDistinct or similar in my hit object, but wasn’t able to find something like that. Is there a possibility to detect if my hit was grouped by Algolia?

Thanks for your suggestions!

Is anybody out there? :sweat_smile:

Hi @aarongerig,

Welcome to the Algolia community and I apologize for the delay!

There is no way to tell if the hit has been deduplicated because the hits response only contains data from the records found in the index, regardless of how they were found.

If you have distinct > 1, you will see a _distinctSeqID field in the response that tells you the order of the distinct objects found in the response.

You can also get other information about how things were ranked by setting the rankingInfo parameter to true, but this won’t include any information about objects that weren’t found, only about how the current object was ranked.

const search = instantsearch({
  indexName: 'test-distinct',
  searchParameters: {
    getRankingInfo: true,
    distinct: 2,

I have created a codesandbox that demonstrates the getRankingInfo and the _distinctSeqID field. Check out the console to see the results returned for the hit.

Hi @cindy.cullen,

Thanks so much for your response!

Unfortunately this is not exactly what I’m looking for. My use case is the following: Deduplication happens based on an attribute in the index. If the value of this attribute matches on other hits as well, they get grouped. So far so good. Now I’d like to display those hits a bit differently than the ones where no deduplication took place. Too bad Algolia doesn’t provide that info.

I appreciate your effort though. :slight_smile:

BTW: I’m using distinct: true

HI @aarongerig,

Thanks for the details of your use case!

I understand and will pass your feedback and this use case to our team. I can understand where that information might be helpful.

Thanks for using Algolia!