Regarding distinct feature

Hello everyone,

My goal - I want to only return one item per unique parentID property in my object.

So according to docs “distinct” should work.

            <Configure
              hitsPerPage={8}
              distinct
              attributeForDistinct={'parentId'}
            />

Sorry, but it’s super confusing to me as it says on the docs that the distinct is available through react instant search, but you can’t set it, because it’s only available at indexing time (what is indexing time?)

Can please someone help me or confirm that it does or does not work, I really want to use this feature, thanks !

Hi @itemas,

You are correct that the distinct feature enables you to be able ‘group’ your records together based upon a specific record attribute.

You can set the distinct property value within your dashboard (from Configuration > Deduplication and Grouping) and enable it if required. Alternatively you can set this attribute via the API using the attributeFromDistinct value.

If you would prefer to enable this from your React InstantSearch then you can do using the configure widget property as you have mentioned.

However, if you haven’t set this distinct property value first then the distinct won’t be able to work on the search results as it doesn’t know what attribute to group your data by.

I hope that this helps you get this working.
Mike