@@ -173,6 +173,20 @@ public enum QueryClause {
173
173
NUMERIC_BETWEEN ( //
174
174
QueryClauseTemplate .of (FieldType .NUMERIC , Part .Type .BETWEEN , QueryClause .FIELD_NUMERIC_BETWEEN , 2 ) //
175
175
),
176
+ /**
177
+ * Numeric field query clause for range matching.
178
+ * Matches numeric fields that are equal to any of the specified values.
179
+ */
180
+ NUMERIC_IN ( //
181
+ QueryClauseTemplate .of (FieldType .NUMERIC , Part .Type .IN , QueryClause .FIELD_EQUAL , 1 ) //
182
+ ),
183
+ /**
184
+ * Numeric field query clause for negated membership testing.
185
+ * Matches numeric fields that are not equal to any of the specified values.
186
+ */
187
+ NUMERIC_NOT_IN ( //
188
+ QueryClauseTemplate .of (FieldType .NUMERIC , Part .Type .NOT_IN , QueryClause .FIELD_EQUAL , 1 ) //
189
+ ),
176
190
/**
177
191
* Numeric field query clause for "less than" comparisons.
178
192
* Matches numeric fields whose values are less than the specified value.
@@ -569,31 +583,40 @@ public String prepareQuery(String field, Object... params) {
569
583
if (this == QueryClause .TAG_CONTAINING_ALL ) {
570
584
value = c .stream ().map (n -> "@" + field + ":{" + QueryUtils .escape (ObjectUtils .asString (n ,
571
585
converter )) + "}" ).collect (Collectors .joining (" " ));
586
+ prepared = prepared .replace (PARAM_PREFIX + i ++, value );
572
587
} else if (this == QueryClause .NUMERIC_CONTAINING ) {
573
588
value = c .stream ().map (n -> "@" + field + ":[" + QueryUtils .escape (ObjectUtils .asString (n ,
574
589
converter )) + " " + QueryUtils .escape (ObjectUtils .asString (n , converter )) + "]" ).collect (Collectors
575
590
.joining ("|" ));
591
+ prepared = prepared .replace (PARAM_PREFIX + i ++, value );
592
+ } else if (this == QueryClause .NUMERIC_IN ) {
593
+ value = c .stream ().map (n -> "@" + field + ":[" + QueryUtils .escape (ObjectUtils .asString (n ,
594
+ converter )) + " " + QueryUtils .escape (ObjectUtils .asString (n , converter )) + "]" ).collect (Collectors
595
+ .joining ("|" ));
596
+ prepared = value ;
576
597
} else if (this == QueryClause .NUMERIC_CONTAINING_ALL ) {
577
598
value = c .stream ().map (n -> "@" + field + ":[" + QueryUtils .escape (ObjectUtils .asString (n ,
578
599
converter )) + " " + QueryUtils .escape (ObjectUtils .asString (n , converter )) + "]" ).collect (Collectors
579
600
.joining (" " ));
601
+ prepared = prepared .replace (PARAM_PREFIX + i ++, value );
580
602
} else if (this == QueryClause .GEO_CONTAINING ) {
581
603
value = c .stream ().map (n -> {
582
604
Point p = (Point ) n ;
583
605
return "@" + field + ":[" + p .getX () + " " + p .getY () + " .000001 ft]" ;
584
606
}).collect (Collectors .joining ("|" ));
607
+ prepared = prepared .replace (PARAM_PREFIX + i ++, value );
585
608
} else if (this == QueryClause .GEO_CONTAINING_ALL ) {
586
609
value = c .stream ().map (n -> {
587
610
Point p = (Point ) n ;
588
611
return "@" + field + ":[" + p .getX () + " " + p .getY () + " .000001 ft]" ;
589
612
}).collect (Collectors .joining (" " ));
613
+ prepared = prepared .replace (PARAM_PREFIX + i ++, value );
590
614
} else {
591
615
value = c .stream ()//
592
616
.map (n -> QueryUtils .escape (ObjectUtils .asString (n , converter ), false )).collect (Collectors .joining (
593
617
"|" ));
618
+ prepared = prepared .replace (PARAM_PREFIX + i ++, value );
594
619
}
595
-
596
- prepared = prepared .replace (PARAM_PREFIX + i ++, value );
597
620
} else {
598
621
if (clauseTemplate .getIndexType () == FieldType .TEXT ) {
599
622
prepared = prepared .replace (PARAM_PREFIX + i ++, param .toString ());
0 commit comments