mirror of https://github.com/apache/lucene.git
LUCENE-10442: When indexQuery or/and dvQuery be a MatchAllDocsQuery then IndexOrDocValuesQuery should be rewrite to MatchAllDocsQuery (#715)
This commit is contained in:
parent
466278e149
commit
6224d0b157
|
@ -234,6 +234,9 @@ Optimizations
|
|||
* LUCENE-10084, LUCENE-10435: Rewrite DocValuesFieldExistsQuery to MatchAllDocsQuery whenever
|
||||
terms or points have a docCount that is equal to maxDoc. (Vigya Sharma, Lu Xugang)
|
||||
|
||||
* LUCENE-10442: When indexQuery or/and dvQuery be a MatchAllDocsQuery
|
||||
then IndexOrDocValuesQuery should be rewrite to MatchAllDocsQuery. (Lu Xugang)
|
||||
|
||||
Changes in runtime behavior
|
||||
---------------------
|
||||
|
||||
|
|
|
@ -104,6 +104,10 @@ public final class IndexOrDocValuesQuery extends Query {
|
|||
public Query rewrite(IndexReader reader) throws IOException {
|
||||
Query indexRewrite = indexQuery.rewrite(reader);
|
||||
Query dvRewrite = dvQuery.rewrite(reader);
|
||||
if (indexRewrite.getClass() == MatchAllDocsQuery.class
|
||||
|| dvRewrite.getClass() == MatchAllDocsQuery.class) {
|
||||
return new MatchAllDocsQuery();
|
||||
}
|
||||
if (indexQuery != indexRewrite || dvQuery != dvRewrite) {
|
||||
return new IndexOrDocValuesQuery(indexRewrite, dvRewrite);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue