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

Duplicate search results #10227

Closed
calebchiam opened this issue Mar 1, 2022 · 0 comments
Closed

Duplicate search results #10227

calebchiam opened this issue Mar 1, 2022 · 0 comments

Comments

@calebchiam
Copy link
Contributor

calebchiam commented Mar 1, 2022

Describe the bug

Certain multi-term search queries will generate duplicate sets of search results.

This is due to how performObjectSearch is written, where the criteria for result inclusion is if the object term appears in the fullname and each of the otherTerms appears in the haystack. Since both fullname and haystack contain the name as a substring, a two-term search query that has terms that are both substrings of name will result in performObjectSearch outputting the same set of results for each term.

As there is no code to guard against duplication of results, the duplicate results show up in the final output.

How to Reproduce

Search 'builders changes' on the Sphinx docs. Duplicate results appear at the bottom of the page, see attached screenshot.

In general, inspecting the objects index to get an object name and decomposing a name into two terms will result in the same error.

Expected behavior

Each search result should appear only once.

Your project

https://github.com/sphinx-doc/sphinx

Screenshots

Searching 'builders changes':
image

Inspecting the objects index:
image

The outputs from each of the object and terms search method calls:
image

OS

Mac

Python version

3.9

Sphinx version

4.4.0

Sphinx extensions

No response

Extra tools

No response

Additional context

Relevant previously closed issue: #3911

@tk0miya tk0miya added this to the 5.0.0 milestone Mar 6, 2022
@tk0miya tk0miya closed this as completed Mar 6, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 6, 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