Skip to content

Conversation

@bloovis
Copy link

@bloovis bloovis commented Sep 29, 2025

This is my fix for the problem described in issue 714. I am a Javascript newbie (though I've been working in assembly language and C since 1976), so there are likely better ways to do things.

I also see that my commit comment doesn't follow the expected norms, which I was not aware of until 10 seconds ago.

@netlify
Copy link

netlify bot commented Sep 29, 2025

Deploy Preview for hugo-hextra ready!

Name Link
🔨 Latest commit f5aa5d7
🔍 Latest deploy log https://app.netlify.com/projects/hugo-hextra/deploys/68dabead7700ab000854eb3c
😎 Deploy Preview https://deploy-preview-847--hugo-hextra.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.


// Show the top 5 results for each page
const sectionResults = window.sectionIndex.search(query, 5, { enrich: true, suggest: true, tag: { 'pageId': `page_${result.id}` } })[0]?.result || [];
const sectionResults = window.sectionIndex.search(query,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need to pass the limit here as the second argument?

@bloovis
Copy link
Author

bloovis commented Oct 6, 2025

As I mentioned in issue 714, if you pass a limit to the search of the sectionIndex, it limits the total number of section results for all pages, not just for that one page. This appears to be a bug in FlexSearch itself. That's why I don't use a limit, and because of the bug, I don't know how to set a sensible limit. Should it be 5 * maxPageResults? That's an arbitrary limit that might be wrong for pages that have more than 5 sections that match the search.

I realize this is a very strange bug, and it still makes my head hurt a little, but I don't know what else to do about it.

joeyundis-altra added a commit to joeyundis-altra/hextra that referenced this pull request Nov 13, 2025
Updated search limits for page and section results to be configurable with sensible defaults.

Per PR imfing#847 on main repo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants