apache / apache/lucene

MultiCollector to control skipping docs on field sort [LUCENE-10224]

Open
#11,260 1 comment 0 reactions 0 assignees View on GitHub
legacy-jira-priority:Minor type:enhancement
Dominant language
Java
Stars
3.6k
Forks
1.4k
Avg merge
2d 11h
Merged PRs (30d)
88

Description

Currently MultiCollector::MultiLeafCollector doesn't implement competitiveIterator; so it doesn't have an ability to skip non-competitive documents on field sort. Check when it is useful to have this ability : 1) e.g. when MultiCollector contains only a single sub-collector 2) when multiple sub-collectors have the same sort fields

Another thing we need to do is to disable skipping functionality of all sub-collectors if the combined scoreMode of MultiCollectors is scoreMode.isExhaustive() == true. Because currently is one of sub-collectors is TopFieldCollector and its scoreMode is not exhaustive, it will update its competitiveIterator when its hits threshold is reached, even though we will never end up using this competitiveIterator, so useless work is done here.

Relates to #10320

---
Migrated from [LUCENE-10224](https://issues.apache.org/jira/browse/LUCENE-10224) by Mayya Sharipova (@mayya-sharipova)

Contributor guide

Open the contributing guide

Research direction

Start at MultiCollector::MultiLeafCollector and trace how sub-collectors expose competitiveIterator and combined scoreMode. Check the single-sub-collector and same-sort-field cases, including when the combined score mode is exhaustive. Done means the requested skipping behavior is covered by tests for these cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
search
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.