-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Search: Fix word exclusion in client side search #13893
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
Open
cglukas
wants to merge
22
commits into
sphinx-doc:master
Choose a base branch
from
cglukas:work/fix-excluded-search-terms
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
0449e48
Fix that negated search words are filtered out in the splitQuery.
cglukas dbfbd46
Fix that negated search words create a SyntaxError: Invalid or unexpe…
cglukas 7a8d46e
Fix that excluded words would abort the entire search if matched in o…
cglukas cfdfda4
Fix format and add contribution information.
cglukas 80d6ad1
Fix long line.
cglukas 9b06fd5
Add a dedicated fixture for testing excluded words in searches.
cglukas 11d2e2e
Is the pipeline flaky?
cglukas 6cc4055
Add missing file.
cglukas ffc193b
Remove debug change.
cglukas 7b79f42
Merge branch 'master' into work/fix-excluded-search-terms
AA-Turner a4764b1
Reduce line length to fix doclinter.
cglukas 234fedc
Merge remote-tracking branch 'origin/master' into work/fix-excluded-s…
cglukas 8e41004
Add regression test for TypeError in excluded words comparison.
cglukas da297e5
Fix wording of test.
cglukas 1fd12ab
Update searchindex by running `python .\utils\generate_js_fixtures.py`
cglukas 577098d
Simplify regex code
cglukas cb1b3cf
Merge branch 'master' into work/fix-excluded-search-terms
cglukas a2139df
Merge branch 'refs/heads/master' into work/fix-excluded-search-terms
cglukas 8a21a56
Fxi searchindex.js of fixtures by rerunning generation with the newes…
cglukas f1e5e8b
Test commit to re-trigger the actions on github.
cglukas 76b375e
Revert "Test commit to re-trigger the actions on github."
cglukas 35232a3
Test commit to re-trigger the actions on github.
cglukas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| Excluded Page | ||
| ============= | ||
|
|
||
| This is a page with the special word penguin. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| Main Page | ||
| ========= | ||
|
|
||
| This is the main page of the ``search_exclusion`` test project. | ||
|
|
||
| This document is used as a test fixture to check that search results can be | ||
| filtered in the query by specifying excluded terms. | ||
|
|
||
| A term which starts with a hypen will be used as excluded term. | ||
|
|
||
| Include a second page which can be excluded in the search: | ||
| :index:`excluded` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| First Page | ||
| ============= | ||
|
|
||
| This is a page with the special word penguin. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| Main Page | ||
| ========= | ||
|
|
||
| This is the main page of the ``search_exclusion`` test project. | ||
|
|
||
| This document is used as a test fixture to check that search results can be | ||
| filtered in the query by specifying excluded terms. | ||
|
|
||
| A term which starts with a hypen will be used as excluded term. | ||
|
|
||
| Include pages which can be excluded in the search: | ||
| :index:`first` | ||
| :index:`second` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| Second Page | ||
| ============= | ||
|
|
||
| This is a page with the special word jumanji. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this set of
excludedTermsfiltering changes? I would suggest not modifying these lines unless strictly necessary. Tests continue to pass when I revert this.I acknowledge that the
breaktocontinuefixup is important though.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I'll need to add another test then. The last conditions raise an error in some cases. I'll add it soon.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @jayaddison,
I added the "should exclude results where the file index is above 0." test case which raises an TypeError with the old code. It's very specific for the old implementation.
The error occurs every time the
terms[term]statement is a positive integer and not equal to thefilevariable. I think this bug was introduced when the datastructures were changed from actual file paths/names to file ids.The strings usually evaluate to
falsein this condition, but integers above 0 evaluate totrue.