Skip to content

SOLR-18099: CollapseQParser extensibility#4112

Open
dsmiley wants to merge 21 commits intoapache:mainfrom
dsmiley:SOLR-18099-CollapseExtensibility
Open

SOLR-18099: CollapseQParser extensibility#4112
dsmiley wants to merge 21 commits intoapache:mainfrom
dsmiley:SOLR-18099-CollapseExtensibility

Conversation

@dsmiley
Copy link
Copy Markdown
Contributor

@dsmiley dsmiley commented Feb 6, 2026

https://issues.apache.org/jira/browse/SOLR-18099

I did in a series of clean steps, separate commits.

BTW my approach was to take a custom subclass I have at work and put it in the source tree somewhere, and then iteratively made the refactorings (manually + IntelliJ refactorings) until the subclass compiled. I also made some tweaks to it. IntelliJ did the "record" conversion as well.

It's a shame this source file is so massive. Ideally we'd break it up at some point.
Also, the extensibility here is limited to String fields.

@dsmiley dsmiley requested a review from mlbiscoc February 6, 2026 21:20
@github-actions github-actions Bot added documentation Improvements or additions to documentation tests cat:search labels Feb 6, 2026
and remove many needsScores4Collapsing fields/passing
SORT,
SCORE;
SCORE,
CUSTOM;
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.

Maybe a point here that CUSTOM is specifically for subclasses? It's currently not used anywhere including tests and someone may remove it by mistake thinking no use.

OrdFieldValueCollector, IntFieldValueCollector: Replaced a strategy pattern with inheritance.  Simpler.  Easier to customize.  Use Builder instead of passing tons of params around.

Organize fields on the collectors.
… pattern:

  1. complete() is now final on the base class, with abstract callbacks: getCollapsedDisi() (returns collapsed doc IDs) and getCollapsedScores() (returns a Scorable per segment)
  2. CachedScoreScorable — new abstract Scorable subclass that caches score() by doc ID, delegating to computeScore(int globalDoc)
  3. scoreNullGroup() — base class helper extracting null-group score logic from complete()
  4. contexts changed from LeafReaderContext[] to List<LeafReaderContext>
  5. Scoring setup moved from getCollapsedDisi() to getCollapsedScores() (lazy init) in both Ord collectors
  6. Removed advanceCompleteSegment() and getGroupHeadScore() abstract methods (replaced by getCollapsedScores)
…, thus avoiding questionable eager detection algorithm. An optimization.
valueCount moved from builder to collector constructor
Removed redundant needsScores4Collapsing fields
Removed deprecated things
Refactor BoostedDocsCollector a little.

DynamicMap: track size
initializeCollection clarity
@github-actions
Copy link
Copy Markdown

This PR has had no activity for 60 days and is now labeled as stale. Any new activity will remove the stale label. To attract more reviewers, please tag people who might be familiar with the code area and/or notify the dev@solr.apache.org mailing list. To exempt this PR from being marked as stale, make it a draft PR or add the label "exempt-stale". If left unattended, this PR will be closed after another 60 days of inactivity. Thank you for your contribution!

@github-actions github-actions Bot added the stale PR not updated in 60 days label Apr 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cat:search documentation Improvements or additions to documentation no-changelog stale PR not updated in 60 days tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants