Skip to content

Minor code fixes - #2252

Merged
CascadingRadium merged 8 commits into
masterfrom
scoreBreakdownOpt
Dec 2, 2025
Merged

CascadingRadium merged 8 commits into
masterfrom
scoreBreakdownOpt

Conversation

@CascadingRadium

@CascadingRadium CascadingRadium commented Nov 26, 2025 •

Copy link
Copy Markdown
Member
  • ScoreBreakdown map was always getting created, and not being reused. When recycling the DocumentMatch, clear out the score breakdown map and reuse it when needed.
  • Fix dropped error when creating pre-filter searcher.
  • Close KNN and Pre-filter Searchers when done.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request optimizes memory allocation by reusing the ScoreBreakdown map across document matches instead of creating a new one each time. When a DocumentMatch is reset for reuse, the existing map is now preserved, cleared, and reassigned.

Key changes:

  • Modified DocumentMatch.Reset() to save, clear, and reuse the ScoreBreakdown map
  • Updated DisjunctionQueryScorer.ScoreAndExplBreakdown() to check if the map exists before initializing a new one

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
search/search.go Added logic to preserve and clear the ScoreBreakdown map during DocumentMatch reset for reuse
search/scorer/scorer_disjunction.go Refactored to reuse the existing ScoreBreakdown map if present instead of always creating a new one

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread search/search.go Resolved
@CascadingRadium CascadingRadium changed the title Reuse ScoreBreakdown Minor code fixes Nov 27, 2025

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread search/search.go Resolved

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

capemox
capemox previously approved these changes Dec 1, 2025
@abhinavdangeti abhinavdangeti added this to the v2.5.6 milestone Dec 1, 2025
Comment thread search_knn.go Resolved
abhinavdangeti
abhinavdangeti previously approved these changes Dec 1, 2025
Comment thread search_knn.go Resolved
@CascadingRadium
CascadingRadium merged commit 9f1a70a into master Dec 2, 2025
@CascadingRadium
CascadingRadium deleted the scoreBreakdownOpt branch December 2, 2025 09:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants