-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Improve relevance scoring for titles and object-name matches in search results #12441
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
Merged
AA-Turner
merged 30 commits into
sphinx-doc:master
from
jayaddison:issue-12391/subtitle-search-scoring-adjustment
Jul 11, 2024
Merged
Changes from 27 commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
fbb62cf
Boost title-matching scores if main title
wlach 96e2894
[search] Add fixture data for use with title relevance test cases.
jayaddison a2a4b60
[search] tests: add test coverage for title-related relevance scoring.
jayaddison cb0f6e7
[search] regenerate JS fixture root titles searchindex from fresh/cle…
jayaddison 75eaf81
Merge branch 'master' into issue-12391/subtitle-search-scoring-adjust…
jayaddison 0f0624e
Merge branch 'boost-scores-if-main-title' into issue-12391/subtitle-s…
jayaddison 5eaea64
[search] Refactor scoring logic adjustment:
jayaddison afb1685
Add CHANGES.rst entry.
jayaddison 5a5e271
Fixup: add missing credit to CHANGES.rst
jayaddison 5c106c8
Merge branch 'master' into issue-12391/subtitle-search-scoring-adjust…
jayaddison 7418a71
Fixup: use intended operator precedence.
jayaddison 17367eb
Revert "Fixup: use intended operator precedence."
jayaddison 96526a9
Revert "[search] Refactor scoring logic adjustment:"
jayaddison 6c3ffa2
[search] Refactor scoring logic adjustments (second attempt/suggestion)
jayaddison fd36010
Fixup: adjust test search result score expectation.
jayaddison c259b1c
Merge branch 'master' into issue-12391/subtitle-search-scoring-adjust…
jayaddison 7f8a5f6
Merge branch 'master' into issue-12391/subtitle-search-scoring-adjust…
jayaddison 2f0cbe1
Tests: refactor checkRanking function to use JavaScript array-unpacking.
jayaddison bf576cd
Tests: refactor checkRanking function to use JavaScript ``for...of`` …
jayaddison d1a7197
Tests: add early-exit path to checkRanking function.
jayaddison 5d5b079
Tests: extract two distinct relevance-related test cases from existin…
jayaddison e9bdf2f
Tests: nitpick: reverse the ``results`` array instead of reversing th…
jayaddison e75891e
Regenerate JS test search fixtures using ``utils/generate_js_fixtures…
jayaddison d5d8717
Tests: update expectations since main titles now have empty anchor ta…
jayaddison 388aef3
Code review: apply phrasing/typo-fixup suggestions.
jayaddison 4d819cc
Value-safety: use ``const`` for scoring variables.
jayaddison 9d59eaf
Tests: self-documentation: add comment to describe the purpose of the…
jayaddison 7b772a2
Code review feedback: add class-level attribute with same name as a (…
jayaddison 4e07078
Tests: split object-vs-title matching into two distinct rules.
jayaddison 1b42e80
Merge branch 'master' into issue-12391/subtitle-search-scoring-adjust…
jayaddison 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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,6 @@ | ||
| import os | ||
| import sys | ||
|
|
||
| sys.path.insert(0, os.path.abspath('.')) | ||
|
|
||
| extensions = ['sphinx.ext.autodoc'] |
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,20 @@ | ||
| Main Page | ||
| ========= | ||
|
|
||
| This is the main page of the ``titles`` test project. | ||
|
|
||
| In particular, this test project is intended to demonstrate how Sphinx | ||
| can handle scoring of query matches against document titles and subsection | ||
| heading titles relative to other document matches such as terms found within | ||
| document text and object names extracted from code. | ||
|
|
||
| Relevance | ||
| --------- | ||
|
|
||
| In the context of search engines, we can say that a document is **relevant** | ||
| to a user's query when it contains information that seems likely to help them | ||
| find an answer to a question they're asking, or to improve their knowledge of | ||
| the subject area they're researching. | ||
|
|
||
| .. automodule:: relevance | ||
| :members: |
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 @@ | ||
| class Example: | ||
| """Example class""" | ||
| num_attribute = 5 | ||
| text_attribute = "string" | ||
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 @@ | ||
| Relevance | ||
| ========= | ||
|
|
||
| In some domains, it can be straightforward to determine whether a search result | ||
| is relevant to the user's query. | ||
|
|
||
| For example, if we are in a software programming language domain, and a user | ||
| has issued a query for the term ``printf``, then we could consider a document | ||
| in the corpus that describes a built-in language function with the same name | ||
| as (highly) relevant. A document that only happens to mention the ``printf`` | ||
| function name as part of some example code that appears on the page would | ||
| also be relevant, but likely less relevant than the one that describes the | ||
| function itself in detail. |
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
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.
Uh oh!
There was an error while loading. Please reload this page.