nuxt-modules/algolia

`findObjects` function not available on `index` object.

Agusnez opened this issue · 5 comments

Hello,

I was performing a basic demo with:

<script setup>
const algoliaIndex = useAlgoliaInitIndex('test')
console.log(algoliaIndex.appId)
</script>

But the algoliaIndex object only has the search function available, not the findObjects operations that we are supposed to do on the Algolia documentation: https://www.algolia.com/doc/api-client/methods/search/

Is this an expected behaviour? Thanks!

Hey @Agusnez

I am not sure about this method. Do you mean that the TS is not suggesting it in the autocomplete or that this method is not available at all?

Maybe you need to load full algoliasearch (not the default lite version) to make it work.

https://algolia.nuxtjs.org/getting-started/configuration#lite

Hi @Baroshem,

Thank you very much for your help. The thing that is not working is that the method is not available at all:

Unhandled Promise Rejection: TypeError: index.findObject is not a function.

Let me look into the full algoliasearch, because it might be my case, since I'm using the useInitIndex moethod, not the useAlgoliaInitIndex like the example. (This is because I don't have it available in my installation)

I will post my updates.

Hey @Agusnez

I think you have a typo in your method name (gindObject instead of findObjects).

Also, make sure to use useAlgoliaInitIndex at all times. The other method wont work.

Hi @Baroshem, I have good news about this.

I was using the previous version of the module @nuxt-modules/algolia. Removing it from the package.json and running npm i @nuxtjs/algolia fixed the issue. Now I see the useAlgoliaInitIndex function.

Thank you very much for your help!

@Agusnez I am glad that you have figured it out!

If you will have any questions, please let me know :)