algolia / docsearch

:blue_book: The easiest way to add search to your documentation.
https://docsearch.algolia.com
MIT License
3.97k stars 384 forks source link

Hit result is shown empty even though it has data in lvl1 property of hit #1167

Open hakankaraduman opened 2 years ago

hakankaraduman commented 2 years ago

Description

With the version 2, it was showing all results correctly with the default UI. After upgrading to v3, it shows some results empty. Even though it has lvl1 info in the found hit.

See the images for the difference

Screen Shot 2021-11-08 at 17 05 21 Screen Shot 2021-11-08 at 17 08 03
shortcuts commented 2 years ago

Hey, what is the concerned index? Are you using the Algolia Crawler or the legacy platform?

bodinsamuel commented 2 years ago

AppId: 58t665dnnu site: https://docs.controlplane.com/whatis

Are you using Docsearch scraper on your own @hakankaraduman?

hakankaraduman commented 2 years ago

Yes, sometimes we initiate docsearch scraper on our own to speed up the process. @bodinsamuel @shortcuts

shortcuts commented 2 years ago

I'm not sure if it's because of that, but some h2s are missing ids on your website (e.g. https://docs.controlplane.com/reference/gvc Overview), so it might create a record with an empty anchor

hakankaraduman commented 2 years ago

I understand, thanks, we'll update the missing ids's and will try again.

shortcuts commented 2 years ago

No problem, feel free to close if it was the issue

hakankaraduman commented 2 years ago

Hi @shortcuts , that wasn't the issue. Where can I find how you construct the "children" prop that's given to hitComponent prop. So I can use the same component but update the text as I like from the "hit" object I receive?

shortcuts commented 2 years ago

Hey @hakankaraduman, I can still see empty ids on production, was it tested on a dev env? I'd also like to try solving this.

Where can I find how you construct the "children" prop that's given to hitComponent prop. So I can use the same component but update the text as I like from the "hit" object I receive?

You can find it here: https://github.com/algolia/docsearch/blob/next/packages/docsearch-react/src/Results.tsx#L112, but I believe this issue should be solved at the indexing level

hakankaraduman commented 2 years ago

Hi @shortcuts , You are right, I deployed the fix to prod and triggered the manual crawler.

I also published a public test for you check out the v3 implementation. https://cpln-docs-test.web.app/

hakankaraduman commented 2 years ago

Empty results' hit object that's given to hitComponent property shows it crawled lvl1 data btw.

shortcuts commented 2 years ago

The issue could come to the fact that two pages with different URLs have the same lvl0 (h1), so our frontend grouping does not find the right parent: https://github.com/algolia/docsearch/blob/next/packages/docsearch-react/src/DocSearchModal.tsx#L219

Trying with an other lvl0 (h2 for example) seems to solve the issue 🤔

Update: it does not work for every pages, need investigation

hakankaraduman commented 2 years ago

Thank you for the update. Do you need anything else from us to help with your investigation?

hakankaraduman commented 2 years ago

Hi, happy new year @shortcuts and @bodinsamuel ,

I was wondering if there is an investigation currently about this issue. Thanks

enk21 commented 2 years ago

Hi @shortcuts and @bodinsamuel , were you able to investigate the issue? Anything else you need from our side? Thanks!