Grouping objects in algolia using indices or pagination?

Hi everyone,

I have an application with a collection view. Whenever I click on a specific cell, it should fetch 50 objects from the server to display them. But of course, depending on which cell I clicked, the 50 objects being fetched, differ.

Example:
If I click on the first cell, the first 50 objects should be fetched. If I click on the second cell, the next 50 objects should be fetched.

How can I implement such use case?

Thanks in advance!

Hi @kaan548,

It may depend on which Algolia extension or API you are using, as well as the way you have your data indexed. in general, your click on the cell could trigger a specific search query and/or filter. You could then show the top 50 results returned from the search.

To answer more specifically, could you give more details about your implementation environment and how your data is indexed?

Hello @cindy.cullen,

thanks for the reply. As the api for the search, I am using InstantSearch actually. Regarding your question with indexing the data… Actually, my data is not indexed at all on the algolia server. There is no attribute indicating the index. Is there a way, I can still do that without adding a specific attribute?

Best regards,
Kaan

Hi @kaan548,

I’m not completely sure I understand your question.

You should be accessing your index with your Instantsearch like this:

const searchClient = algoliasearch('APP_ID', 'Search_API_KEY');

const search = instantsearch({
  indexName: 'index_name',
  searchClient,
}); 

Can you create a codesandbox demonstrating what you are trying to do with your Algolia index?

We have starter templates for codesandbox here.

Let us know when you have the codesandbox working and let us know exactly what you are trying to do to get your desired results.

1 Like