@@ -125,7 +125,7 @@ public final Query getQuery(int position) {
125125 * Returns the query at the given position.
126126 */
127127 @ Nullable
128- abstract Query doGetQuery (int position , int firstValueIndex , int valueCount );
128+ public abstract Query doGetQuery (int position , int firstValueIndex , int valueCount );
129129
130130 private Query wrapSingleValueQuery (Query query ) {
131131 assert onlySingleValueParams != null : "Requested to wrap single value query without single value params" ;
@@ -159,13 +159,8 @@ private Query wrapSingleValueQuery(Query query) {
159159 * using only the {@link ElementType} of the {@link Block} to determine the
160160 * query.
161161 */
162- public static QueryList rawTermQueryList (
163- MappedFieldType field ,
164- SearchExecutionContext searchExecutionContext ,
165- AliasFilter aliasFilter ,
166- Block block
167- ) {
168- IntFunction <Object > blockToJavaObject = switch (block .elementType ()) {
162+ public static IntFunction <Object > createBlockValueReader (Block block ) {
163+ return switch (block .elementType ()) {
169164 case BOOLEAN -> {
170165 BooleanBlock booleanBlock = (BooleanBlock ) block ;
171166 yield booleanBlock ::getBoolean ;
@@ -196,7 +191,20 @@ public static QueryList rawTermQueryList(
196191 case AGGREGATE_METRIC_DOUBLE -> throw new IllegalArgumentException ("can't read values from [aggregate metric double] block" );
197192 case UNKNOWN -> throw new IllegalArgumentException ("can't read values from [" + block + "]" );
198193 };
199- return new TermQueryList (field , searchExecutionContext , aliasFilter , block , null , blockToJavaObject );
194+ }
195+
196+ /**
197+ * Returns a list of term queries for the given field and the input block
198+ * using only the {@link ElementType} of the {@link Block} to determine the
199+ * query.
200+ */
201+ public static QueryList rawTermQueryList (
202+ MappedFieldType field ,
203+ SearchExecutionContext searchExecutionContext ,
204+ AliasFilter aliasFilter ,
205+ Block block
206+ ) {
207+ return new TermQueryList (field , searchExecutionContext , aliasFilter , block , null , createBlockValueReader (block ));
200208 }
201209
202210 /**
@@ -297,7 +305,7 @@ public TermQueryList onlySingleValues(Warnings warnings, String multiValueWarnin
297305 }
298306
299307 @ Override
300- Query doGetQuery (int position , int firstValueIndex , int valueCount ) {
308+ public Query doGetQuery (int position , int firstValueIndex , int valueCount ) {
301309 return switch (valueCount ) {
302310 case 0 -> null ;
303311 case 1 -> field .termQuery (blockValueReader .apply (firstValueIndex ), searchExecutionContext );
@@ -360,7 +368,7 @@ public DateNanosQueryList onlySingleValues(Warnings warnings, String multiValueW
360368 }
361369
362370 @ Override
363- Query doGetQuery (int position , int firstValueIndex , int valueCount ) {
371+ public Query doGetQuery (int position , int firstValueIndex , int valueCount ) {
364372 return switch (valueCount ) {
365373 case 0 -> null ;
366374 case 1 -> dateFieldType .equalityQuery (blockValueReader .apply (firstValueIndex ), searchExecutionContext );
@@ -412,7 +420,7 @@ public GeoShapeQueryList onlySingleValues(Warnings warnings, String multiValueWa
412420 }
413421
414422 @ Override
415- Query doGetQuery (int position , int firstValueIndex , int valueCount ) {
423+ public Query doGetQuery (int position , int firstValueIndex , int valueCount ) {
416424 return switch (valueCount ) {
417425 case 0 -> null ;
418426 case 1 -> shapeQuery .apply (firstValueIndex );
0 commit comments