Skip to content

Commit

Permalink
Get point out of query and into value
Browse files Browse the repository at this point in the history
Signed-off-by: Harsha Vamsi Kalluri <[email protected]>
  • Loading branch information
harshavamsi committed Jan 24, 2024
1 parent 802c462 commit 3934e9c
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -243,21 +243,22 @@ public Query termQuery(Object value, @Nullable QueryShardContext context) {
}
if (isSearchable() && hasDocValues()) {
String term = value.toString();
if (value instanceof String) value = new BytesRef(((String) value));
if (term.contains("/")) {
final Tuple<InetAddress, Integer> cidr = InetAddresses.parseCidr(term);
return InetAddressPoint.newPrefixQuery(name(), cidr.v1(), cidr.v2());
}
return new IndexOrDocValuesQuery(query, SortedSetDocValuesField.newSlowExactQuery(name(), (BytesRef) (value)));
return new IndexOrDocValuesQuery(
query,
SortedSetDocValuesField.newSlowExactQuery(name(), new BytesRef(((PointRangeQuery) query).getLowerPoint()))
);
}
if (hasDocValues()) {
String term = value.toString();
if (value instanceof String) value = new BytesRef(((String) value));
if (term.contains("/")) {
final Tuple<InetAddress, Integer> cidr = InetAddresses.parseCidr(term);
return InetAddressPoint.newPrefixQuery(name(), cidr.v1(), cidr.v2());
}
return SortedSetDocValuesField.newSlowExactQuery(name(), ((BytesRef) value));
return SortedSetDocValuesField.newSlowExactQuery(name(), new BytesRef(((PointRangeQuery) query).getLowerPoint()));
}
return query;
}
Expand Down

0 comments on commit 3934e9c

Please sign in to comment.