Search: find `PascalCase`, `pascalcase` and `case` at the same time
Context
No response
Bug description
When searching a whole word that got separated using the "separator" feature of the search plugin, it doesnt get displayed in the search results.
Example Text on website: "TestExample" Searching "example" works. Searching "test" works. Searching "testexample" doesnt work.
Related links
Reproduction
9.5.3-seperator-search-full-words.zip
Steps to reproduce
we have a markdown page, that contains words with CamelCase.
When using the following search terms, we expect it to always find a result:
| Search term | Search results | Comment |
|---|---|---|
| test | 2 Results | works |
| header | 1 Result ( FirstExampleHeader ) | works |
| firstexample | 0 Results | Doesnt find anything despite it being the start of a H2 object text |
| FirstExampleHeader | 0 Results | Doesnt find anything despite it being a H2 object text |
| AnotherTest | 0 Results | Doesnt find anything despite it being a H2 object text |
Browser
No response
Before submitting
- [X] I have read and followed the bug reporting guidelines.
- [X] I have attached links to the documentation, and possibly related issues and discussions.
- [X] I assure that I have removed all customizations before submitting this bug report.
- [X] I have attached a .zip file with a minimal reproduction.
Thanks for reporting and the reproduction. This is a current limitation of the search. You can either index the entire word or parts of it, but not both. We'll be lifting these restrictions in the near future. If you want to stay updated, please subscribe to #6307, where we track progress on the new search and collect feedback.
I'm reopening this issue, as I'm confident that this will make it into the next iteration of search. More specifically, we'll be moving splitting of words at uppercase characters out of the separator and into a search plugin, which will also provide for greater flexibility than using a regular expression. Here's a working prototype:
https://github.com/squidfunk/mkdocs-material/assets/932156/26099a56-3adc-4a18-a1b8-aadee3d9a496
This will also address all cases enumerated in the OP. Note that the interface in the video is only my research prototype. It has nothing to do with what we're planning the search interface to look in the next iteration.
@squidfunk - is search going to be updated to function with - as a non-separator. This doesn't work currently and is required for our documentation set. We have lots of items like, universal-discover, that can't be found even when we remove / change the search separator.
Also, will the case splitting be removable?
@galthaus I'm not sure what you're referring to. Could you please post a minimal reproduction with your search plugin configuration and describe what you're searching and expect to find? It is crucial for us to understand this precisely, and now is the best time since we're working on it anyway.
Also, will the case splitting be removable?
Yes, basically every behavior will be pluggable, and thus removable.
@squidfunk - https://github.com/squidfunk/mkdocs-material/issues/6958 - it is really simple and not sure what you didn't understand. Hopefully, that will be clearer.
@galthaus thanks for the creating the issue and the reproduction.
it is really simple and not sure what you didn't understand
Sometimes, the tiniest nuances make a big difference, so we need to be sure what the problem is before we can be confident to give an appropriate answer. I hope you understand that sometimes, asking questions about things that might seem obvious to you help us to first establish a common understanding before proceeding.