Skip to content

Commit

Permalink
inline, copy-paste
Browse files Browse the repository at this point in the history
Signed-off-by: mikhail-khludnev <[email protected]>
  • Loading branch information
mkhludnev authored and mikhail-khludnev committed Nov 15, 2024
1 parent f522622 commit ca7569d
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions server/src/main/java/org/opensearch/index/mapper/IpFieldMapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -252,21 +252,10 @@ public Query termQuery(Object value, @Nullable QueryShardContext context) {
true
);
}
return indexOrDvQuery(pointQuery, dvQuery);
}

private Query indexOrDvQuery(Query pointQuery, Query dvQuery) {
if (isSearchable() && hasDocValues()) {
assert pointQuery != null && dvQuery != null;
return new IndexOrDocValuesQuery(pointQuery, dvQuery);
} else {
if (isSearchable()) {
assert pointQuery != null;
return pointQuery;
} else {
assert dvQuery != null;
return dvQuery;
}
return isSearchable() ? pointQuery : dvQuery;
}
}

Expand Down Expand Up @@ -305,7 +294,11 @@ public Query termsQuery(List<?> values, QueryShardContext context) {
if (isSearchable()) {
pointQuery = InetAddressPoint.newSetQuery(name(), addresses);
}
return indexOrDvQuery(pointQuery, dvQuery);
if (isSearchable() && hasDocValues()) {
return new IndexOrDocValuesQuery(pointQuery, dvQuery);

Check warning on line 298 in server/src/main/java/org/opensearch/index/mapper/IpFieldMapper.java

View check run for this annotation

Codecov / codecov/patch

server/src/main/java/org/opensearch/index/mapper/IpFieldMapper.java#L298

Added line #L298 was not covered by tests
} else {
return isSearchable() ? pointQuery : dvQuery;
}
}

@Override
Expand All @@ -323,7 +316,11 @@ public Query rangeQuery(Object lowerTerm, Object upperTerm, boolean includeLower
true
);
}
return indexOrDvQuery(pointQuery, dvQuery);
if (isSearchable() && hasDocValues()) {
return new IndexOrDocValuesQuery(pointQuery, dvQuery);
} else {
return isSearchable() ? pointQuery : dvQuery;
}
});
}

Expand Down

0 comments on commit ca7569d

Please sign in to comment.