-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Feature request: Make the search index pipeline configurable #2380
Comments
The syntax could be simplified to: - search:
prebuild_index: python
pipeline:
- stemmer
- trimmer
- stopWordFilter If a transform should be omitted, it could just be dropped from |
Agreed. |
I'm not opposed to the idea. A PR is welcome. That said, please keep in mind the discussion in yeraydiazdiaz/lunr.py#94. |
Please see #2402 where we are beginning to back out support for lunr.py altogether. That said, I understand that some users will still want this. However, it should be relatively easy to implement as a third party plugin which subclasses the existing plugin. Presumably such a plugin would subclass In the end, most of the search implementation would still be done by the builtin plugin. Only the prebuilt index would be handled by the wrapper plugin. And that gives both lunr and the plugin the freedom to not be tied to MkDocs slower development cycle as well as the freedom to add any arbitrary options that may not be needed by MkDocs userbase at large.. |
Doesn't the node-based method of pre-building the index have the same problem? We can't configure the pipeline there either. |
Yes, that's correct. However, when search was removed from MkDocs' core and refactored into a plugin, the intention was to simply replicate the basic behavior of the preexisting feature as a demonstration that the new Plugin API worked. However, the hope has always been that a third party search plugin would be created which added additional features and flexibility. We have never intended for the builtin search plugin to be the end-all be-all search solution. Therefore, if anyone wants to configure the pipeline using the node-based method, then that would need to be developed as a third-party plugin as well. In the end, what I'm saying is that we don't intend to add this feature into MKDocs directly. We would prefer that this be implemented as a third-party plugin. While a plugin could be minimal and subclass the builtin plugin to add on a few features, I think an ideal solution would be for a third party plugin to provide a complete search solution that could become the standard way for users to get search in MkDocs. |
This feature is now implemented in Material for MkDocs' own built-in search plugin and is already part of the v9 beta: - search:
pipeline:
- stemmer
- trimmer
- stopWordFilter |
Nowadays (2024) lunr.js is unmaintained (last commit 2020). While we welcome enhancements to existing themes, we're also discussing creating a new, better default theme, which would probably use something else than lunr.js. @squidfunk also stated that he and his team are working on a standalone search plugin that is theme-agnostic and will bring such functionality, see the discussion starting here #3560 (comment) (and this is already supported in the search plugin of Material for MkDocs). For these reasons, and the ones listed by @waylan, we'll close this as not planned! If someone wants to work on this anyway, we can re-open the issue. |
With the release of lunr.py 0.6.0, the lunr pipeline is now configurable. See my feature request there.
This means you can now generate a pre-built search index with, e.g., disabled stemming.
It would be nice to integrate this functionality in the
search
plugin, so we can modify the pipeline when usingprebuilt_index
, as outlined here:Currently, themes that modify the pipeline can only do this when the index is not pre-built, leading to inconsistent search behavior depending on whether
prebuilt_index
is enabled or not.The text was updated successfully, but these errors were encountered: