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

Fuzzy search should always be attempted #99

Open
gucci-on-fleek opened this issue Feb 27, 2023 · 1 comment
Open

Fuzzy search should always be attempted #99

gucci-on-fleek opened this issue Feb 27, 2023 · 1 comment
Labels
enhancement New feature or request search Searching

Comments

@gucci-on-fleek
Copy link
Contributor

If you search for the string texbytopi, you would expect that texdoc would open the documentation for the package texbytopic, but instead it tells you that there are no good matches:

$ texdoc -Ml texbytopi
texdoc warning: No good result found, showing all results.
texbytopi	-8.5	/usr/local/texlive/2022/texmf-dist/doc/plain/texbytopic/TeXbyTopic.pdf		The book itself
texbytopi	-9.8	/usr/local/texlive/2022/texmf-dist/doc/plain/texbytopic/README		Readme

But if you mistype any letter, then texdoc counter-intuitively gives a better score and automatically opens the document:

$ texdoc -Ml texbytopz
texbytopz	7.0	/usr/local/texlive/2022/texmf-dist/doc/plain/texbytopic/TeXbyTopic.pdf		The book itself
texbytopz	1.8	/usr/local/texlive/2022/texmf-dist/doc/plain/texbytopic/README		Readme

This is unexpected. @wtsnjp suggests the cause of this in #98 (comment):

The fuzzy search I introduced in Texdoc v3.0 is incomplete. The fuzzy search is only executed when Texdoc fails to find anything in the standard search; in the second case, the fuzzy search is not working because something was found even though only negative matches were found. This is why the results are worse than in the third case (texdoc -lM zezbytopiz).

The fuzzy search should be triggered even when only bad results are found. More to the point, you could always use fuzzy search in any case and, as you say, give an appropriate penalty based on edit distance. However, the latter would require more drastic changes than the former.

@wtsnjp wtsnjp added enhancement New feature or request search Searching labels Feb 27, 2023
@wtsnjp
Copy link
Member

wtsnjp commented Mar 18, 2023

I am willing to implement this proposal. This should also resolve #88.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request search Searching
Projects
None yet
Development

No branches or pull requests

2 participants