Skip to content

Commit

Permalink
Use slowExactQuery from Unsigned Set Query
Browse files Browse the repository at this point in the history
Signed-off-by: Harsha Vamsi Kalluri <[email protected]>
  • Loading branch information
harshavamsi committed Dec 8, 2023
1 parent 2f3d203 commit e087885
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -158,4 +158,19 @@ SortedNumericDocValues getValues(LeafReader reader, String field) throws IOExcep
}
};
}

public static Query newSlowExactQuery(String field, BigInteger value) {
return new SortedUnsignedLongDocValuesRangeQuery(field, value, value) {
@Override
SortedNumericDocValues getValues(LeafReader reader, String field) throws IOException {
FieldInfo info = reader.getFieldInfos().fieldInfo(field);
if (info == null) {
// Queries have some optimizations when one sub scorer returns null rather
// than a scorer that does not match any documents
return null;
}
return DocValues.getSortedNumeric(reader, field);
}
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1002,11 +1002,11 @@ public Query termQuery(String field, Object value, boolean hasDocValues, boolean
BigInteger v = parse(value, true);
if (isSearchable && hasDocValues) {
Query query = BigIntegerPoint.newExactQuery(field, v);
Query dvQuery = SortedUnsignedLongDocValuesRangeQuery.newSlowRangeQuery(field, v, v);
Query dvQuery = SortedUnsignedLongDocValuesSetQuery.newSlowExactQuery(field, v);
return new IndexOrDocValuesQuery(query, dvQuery);
}
if (hasDocValues) {
return SortedUnsignedLongDocValuesRangeQuery.newSlowRangeQuery(field, v, v);
return SortedUnsignedLongDocValuesSetQuery.newSlowExactQuery(field, v);
}
return BigIntegerPoint.newExactQuery(field, v);
}
Expand Down

0 comments on commit e087885

Please sign in to comment.