From ca7569dc29899c29c2563f605e3e55a1f47715a1 Mon Sep 17 00:00:00 2001 From: Mikhail Khludnev Date: Fri, 15 Nov 2024 22:33:46 +0300 Subject: [PATCH] inline, copy-paste Signed-off-by: mikhail-khludnev --- .../index/mapper/IpFieldMapper.java | 25 ++++++++----------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/server/src/main/java/org/opensearch/index/mapper/IpFieldMapper.java b/server/src/main/java/org/opensearch/index/mapper/IpFieldMapper.java index d30a282c57f45..c51cada9f3143 100644 --- a/server/src/main/java/org/opensearch/index/mapper/IpFieldMapper.java +++ b/server/src/main/java/org/opensearch/index/mapper/IpFieldMapper.java @@ -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; } } @@ -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); + } else { + return isSearchable() ? pointQuery : dvQuery; + } } @Override @@ -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; + } }); }