Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for searching #446

Merged
merged 7 commits into from
Dec 23, 2023
Merged

Add support for searching #446

merged 7 commits into from
Dec 23, 2023

Conversation

danakj
Copy link
Collaborator

@danakj danakj commented Dec 22, 2023

We use lunrjs to perform the searching on a (json) search index that we create during html generation.

pagefind generates a search index from the site and inserts a
search box into the page that searches it.

Subdoc does not run pagefind automatically, because the results are
a bit subpar. Searching "option" doesn't list the Option class in the
first page of results even though the page has a 20 weight on the name
"Option". The namespace comes up first, and it has a 10 weight on the
same. Also the search box is quite big and both the box and results are
hard to configure visually as they don't provide helpful css classes to
work with.

So we should try another tool out.
Now that we get the resource dir from clang, we shouldn't
need system include paths in the compile commands.
lunr builds an index from a set of fields, which we generate with
subdoc into 'search.json'

The webpage loads the json file and puts it into a lunr index. In
the future this could be done offline and serialized, but it would
need JS execution during Subdoc execution or during page deployment.
Searches are done without doing a full navigation/page load. Any
typing causes a new search to be done (with a delay for throttling).
Hitting Escape unfocuses the search box and hides search results. Re-
focusing the search box shows the results again.
@danakj danakj changed the title Add support for pagefind.app searching Add support for searching Dec 23, 2023
@danakj danakj marked this pull request as ready for review December 23, 2023 20:24
@danakj danakj merged commit 33e7c28 into chromium:main Dec 23, 2023
9 checks passed
@danakj danakj deleted the search branch December 23, 2023 20:25
@danakj danakj added this to the Subdoc milestone Dec 23, 2023
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.

1 participant