-
Notifications
You must be signed in to change notification settings - Fork 984
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 Fuse.js search format #2507
Conversation
match self.config.search.index_format { | ||
IndexFormat::ElasticlunrJson | IndexFormat::FuseJson => content, | ||
IndexFormat::ElasticlunrJavascript | IndexFormat::FuseJavascript => { | ||
format!("window.searchIndex = {}", content) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can probably go on the enum as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
of course it could, but I feel like it would be a weird thing to do? completely subjective.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
like at that point i might as well put the entire thing inside IndexFormat
Sorry I've seen the message but didn't get to respond yet. |
remmeber to commit Cargo.lock
bump @Keats because i replied to some of your reviews with followups |
### Fuse | ||
|
||
Compatible with [fuse.js](https://www.fusejs.io/), [tinysearch](https://github.com/tinysearch/tinysearch), and almost | ||
compatible with [stork](https://stork-search.net/) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does it mean "almost compatible"? Does it work with stork or not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
stork's format is very similar but the keys are slightly different, it's toml, and it wants a bit of a extra metadata. One could conceivably convert fuse_json to stork with a shell script and a copy of jq
I should probably either write all that in the docs or remove the reference entirely
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually maybe i should have fuse_json have a url
key instead of path
, since fuse doesn't care and that will be more compatible with stork and tiny.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oooh wait i see why include_path
exists
Thanks! |
Note: I haven't tried it myself but I assume you did right? |
@Keats yeah i have a branch of bevy-website working using this. When will it ship? |
I need to have a look at all PRs and issues but i hope this week or the next one |
* inital "just barely works" Fuse.js support * implement FuseJavascript; refactor index_for_lang * support search config * move fuse index building to it's own file * update doc of Search.index_format * update config docs * update search documentation * use &str where possible * use libs::serde_json remmeber to commit Cargo.lock * move extension logic to IndexFormat * move the entire filename logic inside IndexFormat * move elasticlunr to it's own module * only create elasticlunr.min.js if we're actually using elasticlunr * move ELASTICLUNR_JS to elasticlunr.js * hide the details of search's submodules * optionally include path * explain include_path better * remove references to stork * replace if with match * support include_description * specify "permalink" * move body cleaning and truncation to a function * update truncate_content_length docs to specify *code points*
Just wanted to add that the fuse_json index format helped with implementing pagefind in abridge, here is the demo: https://abridge-pagefind.pages.dev/ I planned to update tinysearch in abridge to use fuse_json, but a while ago I ran into an issue that I have not been able to figure out: tinysearch/tinysearch#175 |
* inital "just barely works" Fuse.js support * implement FuseJavascript; refactor index_for_lang * support search config * move fuse index building to it's own file * update doc of Search.index_format * update config docs * update search documentation * use &str where possible * use libs::serde_json remmeber to commit Cargo.lock * move extension logic to IndexFormat * move the entire filename logic inside IndexFormat * move elasticlunr to it's own module * only create elasticlunr.min.js if we're actually using elasticlunr * move ELASTICLUNR_JS to elasticlunr.js * hide the details of search's submodules * optionally include path * explain include_path better * remove references to stork * replace if with match * support include_description * specify "permalink" * move body cleaning and truncation to a function * update truncate_content_length docs to specify *code points*
Sanity check:
next
branch?the Fuse.js format looks like this (I'm working on Bevy's website:
it happens to also be compatible with tinysearch, and almost compatible with stork.