Skip to content

LUCENE-10424: Optimize the "everything matches" case for count query in PointRangeQuery#691

Merged
iverase merged 1 commit intoapache:mainfrom
LuXugang:LUCENE-10424
Feb 21, 2022
Merged

LUCENE-10424: Optimize the "everything matches" case for count query in PointRangeQuery#691
iverase merged 1 commit intoapache:mainfrom
LuXugang:LUCENE-10424

Conversation

@LuXugang
Copy link
Copy Markdown
Member

In Implement of Weight#count in PointRangeQuery, Whether additional consideration is needed that when PointValues#getDocCount() == IndexReader#maxDoc() and the range's lower bound is less that the field's min value and the range's upper bound is greater than the field's max value, then return reader.maxDoc() directly?

&& values.getDocCount() == values.size()) {
// if all documents have at-most one point
if (values.getDocCount() == reader.maxDoc()) {
final byte[] fieldPackedLower = values.getMinPackedValue();
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.

Is this check really needed? I guess this will work:

if (relate(values.getMinPackedValue, values.getMaxPackedValue()) == Relation.CELL_WITHIN) {
  return values.getDocCount()
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Simply and much more thoughtful!

@iverase
Copy link
Copy Markdown
Contributor

iverase commented Feb 18, 2022

Could you add an entry in CHANGES.txt?

@LuXugang
Copy link
Copy Markdown
Member Author

Could you add an entry in CHANGES.txt?

Could you add an entry in CHANGES.txt?

DONE

@iverase iverase merged commit 36a2149 into apache:main Feb 21, 2022
iverase pushed a commit that referenced this pull request Feb 21, 2022
@iverase
Copy link
Copy Markdown
Contributor

iverase commented Feb 21, 2022

Thank you @LuXugang!

wjp719 added a commit to wjp719/lucene that referenced this pull request Feb 23, 2022
* main:
  migrate to temurin (apache#697)
  LUCENE-10424: Optimize the "everything matches" case for count query in PointRangeQuery (apache#691)
  LUCENE-10416: Update Korean Dictionary to mecab-ko-dic-2.1.1-20180720 for Nori
  Remove deprecated constructors in Nori (apache#695)
  LUCENE-10400: revise binary dictionaries' constructor in nori (apache#693)
  LUCENE-10408: Fix vector values iteration bug (apache#690)
  Temporarily mute TestKnnVectorQuery#testRandomWithFilter
  LUCENE-10382: Support filtering in KnnVectorQuery (apache#656)
  LUCENE-10084: Rewrite DocValuesFieldExistsQuery to MatchAllDocsQuery when all docs have the field (apache#677)
  Add CHANGES entry for LUCENE-10398
  LUCENE-10398: Add static method for getting Terms from LeafReader (apache#678)
  LUCENE-10408 Better encoding of doc Ids in vectors (apache#649)
  LUCENE-10415: FunctionScoreQuery and IndexOrDocValuesQuery delegate Weight#count. (apache#685)
wjp719 added a commit to wjp719/lucene that referenced this pull request Feb 23, 2022
* main:
  LUCENE-10416: move changes entry to v10.0.0
  migrate to temurin (apache#697)
  LUCENE-10424: Optimize the "everything matches" case for count query in PointRangeQuery (apache#691)
  LUCENE-10416: Update Korean Dictionary to mecab-ko-dic-2.1.1-20180720 for Nori
  Remove deprecated constructors in Nori (apache#695)
  LUCENE-10400: revise binary dictionaries' constructor in nori (apache#693)
  LUCENE-10408: Fix vector values iteration bug (apache#690)
  Temporarily mute TestKnnVectorQuery#testRandomWithFilter
  LUCENE-10382: Support filtering in KnnVectorQuery (apache#656)
  LUCENE-10084: Rewrite DocValuesFieldExistsQuery to MatchAllDocsQuery when all docs have the field (apache#677)
  Add CHANGES entry for LUCENE-10398
  LUCENE-10398: Add static method for getting Terms from LeafReader (apache#678)
  LUCENE-10408 Better encoding of doc Ids in vectors (apache#649)
  LUCENE-10415: FunctionScoreQuery and IndexOrDocValuesQuery delegate Weight#count. (apache#685)
dantuzi pushed a commit to SeaseLtd/lucene that referenced this pull request Mar 10, 2022
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.

2 participants