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

Recent changes break whole word search #419

Closed
nebulade opened this issue Jul 28, 2017 · 12 comments
Closed

Recent changes break whole word search #419

nebulade opened this issue Jul 28, 2017 · 12 comments
Assignees

Comments

@nebulade
Copy link

nebulade commented Jul 28, 2017

Description

The latest release (1.7.5) breaks some search patterns for whole words. In this case typing restor in the search field correctly shows matches for the whole word restore while when the whole word is typed into the search field, the search results are empty.

This can be tested with a small md file with the following contents:

## Restore

Apps can be restored to a previous backup by clicking on the `Restore` button.

The previous version (1.7.4) does not have this issue.

@squidfunk
Copy link
Owner

squidfunk commented Jul 28, 2017

This has to do with the default stemming by lunr, fixed in master which disabled stemming, and about to be released.

@nebulade
Copy link
Author

nebulade commented Jul 28, 2017

Thats awesome. Thanks!

@squidfunk
Copy link
Owner

squidfunk commented Aug 2, 2017

Fixed in 1.8.0

@kevung
Copy link

kevung commented Jun 6, 2020

Hello everybody,
I encounter the same problem as @nebulade with mkdocs-material-5.2.2.
Are there other people noticing this regression?

@kevung
Copy link

kevung commented Jun 6, 2020

The problem I encounter seems to be a problem from Mkdocs-Material.
The search is fully working when the language is in english, but fails in french, for example.

The search is fine with a mkdocs.yml:

site_name: test

theme:
  language: en
  name: material

plugins:
  - search

use_directory_urls: false
nav:
  - Intro: index.md

but does not work with this mkdocs.yml

site_name: test

theme:
  language: fr
  name: material

plugins:
  - search

nav:
  - Intro: index.md

@squidfunk
Copy link
Owner

squidfunk commented Jun 6, 2020

Possibly related to #1603 and #1675

@connerxyz
Copy link

connerxyz commented Apr 2, 2021

Hello, I'm experiencing a very similar issue with 7.0.4. I've read through this issue and #1603 and #1605.

I get what appears to be no search results for certain whole words which appears to be because of stemming, (e.g. "refer" returns results for partial matches of "reference", but "reference" itself returns no results).

I noticed the comment that stemming was disabled... and I saw [the suggestion] to extend the theme and override en.html partial... But I don't see any stemming there. I experimented with removing the trimmer from the pipeline without any affect

I understand there's a difference of mkdocs vs. the material theme, and complexity of accommodating search use-cases across many languages.

What I don't understand is why whole words wouldn't be indexed in addition to stemmed words? From a user POV you want to be able to search for whole words (regardless of stemming) and aren't these whole words defined by the separator?

@squidfunk
Copy link
Owner

squidfunk commented Apr 3, 2021

Thanks for reporting. If you can narrow it down to a small reproducible case and two versions that work / don't, we can debug it. The official docs work with that very use case you mentioned, i.e. "reference" returns results.

@connerxyz
Copy link

connerxyz commented Apr 5, 2021

I've found the problem has something to do with prebuild_index: true.

Not working example.

Search configuration in mkdocs.yml looks like...

plugins:  # https://github.com/mkdocs/mkdocs/wiki/MkDocs-Plugins
  - search:  # https://squidfunk.github.io/mkdocs-material/plugins/search/
      lang: en
      separator: '[\s\-\.]+'
      prebuild_index: true
  - macros

image

Screen Shot 2021-04-05 at 2 23 02 PM

Working example

plugins:  # https://github.com/mkdocs/mkdocs/wiki/MkDocs-Plugins
  - search:  # https://squidfunk.github.io/mkdocs-material/plugins/search/
      lang: en
      separator: '[\s\-\.]+'
  - macros

Screen Shot 2021-04-05 at 2 27 39 PM

@connerxyz
Copy link

connerxyz commented Apr 5, 2021

PS – How do you enable the query string /?q=reference? Thanks.

@squidfunk
Copy link
Owner

squidfunk commented Apr 5, 2021

@connerxyz ah yeah, prebuilding the index does not honor the pipeline, which excludes stemming by default. I think I also mentioned this on some issue on the MkDocs issue tracker some time ago.

PS – How do you enable the query string /?q=reference? Thanks.

Deep linking of search results is one part of sharing search results, currently only available via Insiders 😉

@connerxyz
Copy link

connerxyz commented Apr 6, 2021

Good stuff. I love your funding model, with the goals etc. This is a great project/community. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants