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

Don't create a LeafCollector when the Scorer for the leaf is null #562

Closed
wants to merge 0 commits into from

Conversation

msokolov
Copy link
Contributor

@msokolov msokolov commented Feb 4, 2019

No description provided.

// there is no doc of interest in this reader context
// continue with the following leaf
continue;
}
BulkScorer scorer = weight.bulkScorer(ctx);
Copy link
Member

Choose a reason for hiding this comment

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

Should we also update javadocs for Collector.getLeafCollector that it will (may?) not be called when query can determine there will be no hits in this segment?

@jpountz
Copy link
Contributor

jpountz commented Feb 5, 2019

I had considered something like that in the past but didn't like the fact that it made things slower with queries whose bulk scorer is costly to create (eg. range or multi-term) and collectors that can skip entire segments by raising a CollectionTerminatedException in getLeafCollector. Maybe we could have a way to construct bulk scorers in two steps similarly to Weight#scorerSupplier for regular scorers so that we could check whether a bulk scorer might have any hits without paying the full construction price. I expect this would only help if a leaf collector is expensive to construct, with which collector are you seeing slowdowns because Lucene is constructing leaf collectors on segments that don't have matches?

@msokolov
Copy link
Contributor Author

msokolov commented Feb 7, 2019 via email

import static junit.framework.Assert.assertTrue;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this change need to be part of this CR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's not required. I did it because junit.framework.Assert is deprecated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants