web icon indicating copy to clipboard operation
web copied to clipboard

Why does fitView not show up in the search results?

Open chrtze opened this issue 7 months ago • 4 comments

image

chrtze avatar Apr 18 '25 14:04 chrtze

another issue about the search via @hayleigh-dot-dev:

fyi if you search "styling" in the docs the first hit is this but it doesnt take you anywhere but /examples. i think probably the intention is to jump to the styling section here but: the url doesnt contain a hash fragment: https://reactflow.dev/examples even if it did, none of the section headers have ids

✅ this is done - ids were missing

moklick avatar May 13 '25 07:05 moklick

Same for ReactFlowInstance.getNodes -

Image

getNodesBounds shows up instead

0x0f0f0f avatar Oct 02 '25 10:10 0x0f0f0f

yep! Same thing :/

moklick avatar Oct 02 '25 14:10 moklick

Recap of the issue investigation:

Seems to be an issue with the configuration of the crawler AND search in algolia.

Before, records in the crawler results related to fitView were 2, one for type: lvl2 with content: null (header?), with level: 80, position: 69 and one with type: content, and level: 0, position: 70. The issue was that the content record had the wrong content.

I have fixed the crawler config to now properly parse also code blocks inside of tables for API methods (e.g. the React Flow Instance page).

The records now look like this https://gist.github.com/0x0f0f0f/a30f81fde0fd509adeaf9197ac706773

Here's also the current (relevant) crawler configuration: https://gist.github.com/0x0f0f0f/c5b8468f4fa12099941c65c75989f81e

This didn't fix the issue though. The fitView record is still at the end of the list when looking for it. Its ranking its pretty bad. The search is picking FitViewOptions only because it matches (partially) the lvl1 header (its an header in https://reactflow.dev/api-reference/types/fit-view-options ) - its not picking the exact match, and its not even showing it.

I tried changing the order of ranking in search config but didn't solve. This is the current (non-broken) config for ranking

Image

Also in searchable attributes, ranking an exact match for lvl2 headers didn't help.

Setting the top-level searchable attribute to be content then messes up the search results.

Image

Not sure how to proceed. We can either:

  1. Adjust the crawler config to produce better records (I need to probably ask on stackoverflow though).
  2. Ditch algolia and use nextra with https://pagefind.app/ (
  3. Leave it as-is and increase the number of results in the <DocSearch> component (https://github.com/algolia/algoliasearch-client-javascript )

0x0f0f0f avatar Oct 06 '25 15:10 0x0f0f0f