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

Cannot search for certain words (e.g. "using") #10277

Closed
CendioOssman opened this issue Mar 21, 2022 · 2 comments
Closed

Cannot search for certain words (e.g. "using") #10277

CendioOssman opened this issue Mar 21, 2022 · 2 comments

Comments

@CendioOssman
Copy link

Describe the bug

Certain words fail to produce any search results. One such word is "using", but there are likely more.

How to Reproduce

Include this simple document:

util
====

Synopsis
--------

**util** [*options*]

Description
-----------

**util** is great! See :ref:`index`.

Run this command using sudo
---------------------------

Will this be found by the search?

Generate some html, then search for "using".

Expected behavior

The page should be included in the search results.

Your project

N/A

Screenshots

No response

OS

Linux

Python version

3.6.12

Sphinx version

4.2.0

Sphinx extensions

No response

Extra tools

No response

Additional context

This is fallout from #2621. Which surprises me a bit since it is ages since that was committed. Perhaps something else hid the bug for so long?

The problem is that the JavaScript code assumes (in Search.query()) a word was left unstemmed if it is shorter than 3 characters. But that is not what SearchLanguage.word_filter() does as it has a much more complex logic. I also assume it can be overloaded for other languages than English.

Things work fine on Sphinx' own home page though for some reason. But it looks like it delegates the search to readthedocs rather than using the default search code.

@tk0miya
Copy link
Member

tk0miya commented Mar 21, 2022

Short words becomes not-filtered since v4.0 (refs: #8070). So it should not be filtered by JS code.

@CendioOssman
Copy link
Author

Thanks! Fix seems to solve the issue here.

tk0miya added a commit that referenced this issue Mar 26, 2022
Fix #10277: html search: Could not search short words (ex. "use")
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 26, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants