gsmiller commented on code in PR #11950:
URL: https://github.com/apache/lucene/pull/11950#discussion_r1029481972
##########
lucene/core/src/java/org/apache/lucene/document/BinaryRangeFieldRangeQuery.java:
##########
@@ -91,7 +92,11 @@ public Query rewrite(IndexSearcher indexSearcher) throws
IOException {
}
private BinaryRangeDocValues getValues(LeafReader reader, String field)
throws IOException {
- BinaryDocValues binaryDocValues = reader.getBinaryDocValues(field);
+ FieldInfo info = reader.getFieldInfos().fieldInfo(field);
+ if (info == null) {
+ return null;
+ }
+ BinaryDocValues binaryDocValues = DocValues.getBinary(reader, field);
Review Comment:
Actually, I suppose it depends if we want to throw an
`IllegalArgumentException` if the field has been indexed but as a different
type. `DocValues#getBinary` will do the type checking and throw. If we go with
your suggestion, we'll just silently ignore the field (treating it the same as
if it doesn't exist in the segment).
I'd prefer we do the type checking. I think it makes more sense for users,
and it's also consistent with other similar code paths. For example,
`SortedNumericDocValuesField#newSlowRangeQuery` is a similar use-case, and
relies on the factory methods for type checking.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]