Creation of index from local data

Hello !

Is it possible to create an index from local data ?

For example, I would like to create an array of strings to search in.
But this array is returned by our back-end and the array is dynamically generated.

Hello there, thank you for reaching us out!

Yes you can create an index and populate it with records that comes from you array of strings.

If you array of string is ["my text", "another text"], each record would be a simple object with only one attribute, like [{"text": "my text"}, {"text": "another text"}].

Your backend could convert the array of strings to this array of object, then push each object to your index: https://www.algolia.com/doc/api-reference/api-methods/add-objects/

Let us know if that works for you!

Thanks ! That’s one way to do it.

However, I am trying to create a custom list of data to search for. Along with address autocomplete search (places.js)

But I would prefer not to use algolia API and only utilize places.js so I can lower the cost of using your services.

I think the solution for me will be: providing a function for (autocomplete.js) source param and do the filtering my self.