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 client-side search index generation #1530

Merged
merged 12 commits into from
Sep 24, 2024
Merged

Conversation

agoose77
Copy link
Contributor

@agoose77 agoose77 commented Sep 12, 2024

This PR tackles #100 by adding support for generation of myst.search.json indices. These can currently be consumed by a webapp on https://agoose77.github.io/myst-search-experiments/?url=http://..., which tries to use myst.search.json, and falls back on using the xref data.

We need jupyter-book/myst-theme#467 to be merged for this to actually be deployed to static builds.

Warning

This PR should merge alongside the other search-related PRs; it is likely that changes in the frontend may warrant modifications to this PR.

Copy link

changeset-bot bot commented Sep 12, 2024

🦋 Changeset detected

Latest commit: e97f56b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 6 packages
Name Type
myst-spec-ext Minor
myst-cli Patch
myst-common Minor
myst-config Minor
myst-frontmatter Minor
mystmd Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@agoose77 agoose77 changed the title :wof Add search 🔍 Add client-side search index generation Sep 12, 2024
@agoose77
Copy link
Contributor Author

Making a change to expose a version.

packages/myst-cli/src/process/search.ts Outdated Show resolved Hide resolved
parts: string[];
};

export function toSectionedParts(content: GenericNode) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This naively sections a document upon encountering a heading. Seems to work well so far.

Copy link
Collaborator

@rowanc1 rowanc1 left a comment

Choose a reason for hiding this comment

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

A few comments! I think at least a few tests on the integration or the toText stuff would be good.

Might be a weird out-of-order bug in the async list generator. I think we might just want to avoid those, they are the worst to track down later...!

packages/myst-cli/src/process/search.ts Outdated Show resolved Hide resolved
packages/myst-cli/src/process/site.ts Show resolved Hide resolved
packages/myst-cli/src/process/site.ts Show resolved Hide resolved
@agoose77
Copy link
Contributor Author

Just working on improving the AST to text transform.

@rowanc1
Copy link
Collaborator

rowanc1 commented Sep 18, 2024

We should support 1 apparently. Ideally the CLI should not crash if search index cannot be made!

image

image

@rowanc1 rowanc1 merged commit 5f8f0b0 into main Sep 24, 2024
7 checks passed
@rowanc1 rowanc1 deleted the agoose77/feat-add-search branch September 24, 2024 15:39
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