nuxt-modules / algolia

🔎 Algolia module for Nuxt
https://algolia.nuxtjs.org/
MIT License
185 stars 32 forks source link

DocSearch not returning hits #158

Closed cossssmin closed 12 months ago

cossssmin commented 1 year ago

Version

@nuxtjs/algolia: v1.8.0 nuxt: v3.6.2

Reproduction Link

Nuxt config: https://github.com/cossssmin/docs-nuxt3/blob/main/nuxt.config.ts

Component: https://github.com/cossssmin/docs-nuxt3/blob/main/components/DocSearch.vue

Steps to reproduce

See demo: https://amazing-trifle-bf003d.netlify.app/

Click the search box and try searching for template, for example. hits is returned empty although the index exists and all env variables are set.

What is Expected?

The search to work like on maizzle.com (it uses the same api key/app id/index name).

What is actually happening?

hits returning empty.

From what I can see only the library versions are different in the query strings, could that be causing it?

Working version request URL (on maizzle.com):

https://o3q5hjsv88-dsn.algolia.net/1/indexes/*/queries?x-algolia-agent=Algolia%20for%20JavaScript%20(4.8.5)%3B%20Browser%20(lite)%3B%20docsearch%20(3.3.3)%3B%20docsearch-react%20(3.3.3)%3B%20docsearch.js%20(3.3.3)&x-algolia-api-key=c219dd150c753f261239c1e3087ce60f&x-algolia-application-id=O3Q5HJSV88

@nuxtjs/algolia, not working:

https://o3q5hjsv88-dsn.algolia.net/1/indexes/*/queries?x-algolia-agent=Algolia%20for%20JavaScript%20(4.8.5)%3B%20Browser%20(lite)%3B%20docsearch%20(3.5.1)%3B%20docsearch-react%20(3.5.1)%3B%20docsearch.js%20(3.5.1)&x-algolia-api-key=c219dd150c753f261239c1e3087ce60f&x-algolia-application-id=O3Q5HJSV88
Baroshem commented 1 year ago

Hey, sorry but I completely missed your issue.

Version can actually make a difference here (especially that you mentioned that there is ni other significant difference).

Would you be able to use the version used in the nuxt algolia module?

cossssmin commented 1 year ago

Hi, no worries :)

I already am using the same version, I just followed the DocSearch setup guide from https://algolia.nuxtjs.org/advanced/docsearch

Tried pinning @docsearch/js@3.3.3 but that didn't work either. Not sure what the issue is...

cossssmin commented 1 year ago

Couldn't figure it out so ended up using @docsearch/js directly. Feel free to close the issue if you prefer.

Baroshem commented 1 year ago

Have you maybe tried copying the flow in the playground? Maybe we miss something from the docs.

https://github.com/nuxt-modules/algolia/blob/3ecdb90596d4f0ad1388ec9f9809c558bae4e934/playground/pages/index.vue#L16