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

[HTML search] correction for scoring of search terms that only appear in document indexed with id zero. #12037

Conversation

jayaddison
Copy link
Contributor

@jayaddison jayaddison commented Mar 2, 2024

Feature or Bugfix

  • Bugfix

Purpose

  • Restores expected scoring for exact-match query terms that only appear in document zero in the client-side JavaScript search index.
  • Includes a performance optimization: skips partial-matching entirely when exact-matches exist.

Detail

  • Words (terms) from both document content and document titles are stored in the JavaScript search index on the client -- this results in a mapping from individual terms to a list of the document-ids of the documents where they appear.
  • For terms/title-terms that appear in multiple documents, the document-ids are stored as a (sorted) list/Array. In cases where the term only appears in a single document, only a single integer value is stored. (credit to @wlach for explaining)
  • The document-ids are zero-indexed (0, 1, 2, ...) so there is a zeroth document, and we need to be careful when evaluating that in boolean expressions because zero is falsy in JavaScript.
  • 🐛 A term that only appears in the document with ID zero will incorrectly be scored as a partial-match.

Relates

cc @wlach

@jayaddison jayaddison changed the title [HTML search] prevent partial term/title matches from clobbering exact-match results [HTML search] correction for scoring of search terms that only appear in document indexed with id zero. Mar 2, 2024
@jayaddison jayaddison added the javascript Pull requests that update Javascript code label Mar 3, 2024
…on entirely when we have already found exact-matches
@jayaddison
Copy link
Contributor Author

Replaced by / became-identical-to #11957.

@jayaddison jayaddison closed this Mar 3, 2024
@jayaddison jayaddison deleted the issue-11957/searchtools-overwrite-fixups branch March 3, 2024 14:21
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
html search javascript Pull requests that update Javascript code type:bug type:performance
Projects
None yet
1 participant