2020import java .io .IOException ;
2121import java .util .Collections ;
2222import java .util .List ;
23-
2423import org .apache .lucene .codecs .Codec ;
2524import org .apache .lucene .codecs .lucene90 .Lucene90DocValuesFormat ;
2625import org .apache .lucene .document .Document ;
@@ -157,9 +156,9 @@ private Query mrSsDvQ(String field, int... ends) {
157156 }
158157
159158 private static DocValuesMultiRangeQuery .SortedSetStabbingBuilder mrSsDvBuilder (
160- String field , int ... ends ) {
159+ String field , int ... ends ) {
161160 DocValuesMultiRangeQuery .SortedSetStabbingBuilder b =
162- new DocValuesMultiRangeQuery .SortedSetStabbingBuilder (field );
161+ new DocValuesMultiRangeQuery .SortedSetStabbingBuilder (field );
163162 for (int j = 0 ; j < ends .length ; j += 2 ) {
164163 b .add (IntPoint .pack (ends [j ]), IntPoint .pack (ends [j + 1 ]));
165164 }
@@ -175,30 +174,30 @@ public void testToString() {
175174
176175 public void testOverrideToString () {
177176 DocValuesMultiRangeQuery .SortedSetStabbingBuilder b =
178- new DocValuesMultiRangeQuery .SortedSetStabbingBuilder ("foo" ) {
177+ new DocValuesMultiRangeQuery .SortedSetStabbingBuilder ("foo" ) {
178+ @ Override
179+ protected Query createSortedSetDocValuesMultiRangeQuery () {
180+ return new SortedSetDocValuesMultiRangeQuery (fieldName , clauses ) {
179181 @ Override
180- protected Query createSortedSetDocValuesMultiRangeQuery () {
181- return new SortedSetDocValuesMultiRangeQuery (fieldName , clauses ) {
182- @ Override
183- public String toString (String fld ) {
184- return fieldName + " " + rangeClauses .size ();
185- }
186- };
182+ public String toString (String fld ) {
183+ return fieldName + " " + rangeClauses .size ();
187184 }
188185 };
186+ }
187+ };
189188 b .add (IntPoint .pack (1 ), IntPoint .pack (2 ));
190189 b .add (IntPoint .pack (3 ), IntPoint .pack (4 ));
191190 assertEquals ("foo 2" , b .build ().toString ());
192191
193192 DocValuesMultiRangeQuery .ByteRange myrange =
194- new DocValuesMultiRangeQuery .ByteRange (IntPoint .pack (1 ), IntPoint .pack (2 )) {
195- @ Override
196- public String toString () {
197- return IntPoint .decodeDimension (lower .bytes , 0 )
198- + " "
199- + IntPoint .decodeDimension (upper .bytes , 0 );
200- }
201- };
193+ new DocValuesMultiRangeQuery .ByteRange (IntPoint .pack (1 ), IntPoint .pack (2 )) {
194+ @ Override
195+ public String toString () {
196+ return IntPoint .decodeDimension (lower .bytes , 0 )
197+ + " "
198+ + IntPoint .decodeDimension (upper .bytes , 0 );
199+ }
200+ };
202201 assertEquals ("1 2" , myrange .toString ());
203202 }
204203
@@ -231,8 +230,8 @@ public void testEdgeCases() throws IOException {
231230 iw .close ();
232231 IndexSearcher searcher = newSearcher (reader );
233232 for (DocValuesMultiRangeQuery .SortedSetStabbingBuilder builder :
234- List .of (
235- mrSsDvBuilder ("foo" , 2 , 3 , 4 , 5 , -5 , -2 ), mrSsDvBuilder ("foo" , 2 , 3 , 4 , 5 , 12 , 15 ))) {
233+ List .of (
234+ mrSsDvBuilder ("foo" , 2 , 3 , 4 , 5 , -5 , -2 ), mrSsDvBuilder ("foo" , 2 , 3 , 4 , 5 , 12 , 15 ))) {
236235 assertEquals ("no match" , 0 , searcher .search (builder .build (), 1 ).totalHits .value ());
237236 BytesRef lower ;
238237 BytesRef upper ;
@@ -241,14 +240,14 @@ public void testEdgeCases() throws IOException {
241240 lower .bytes = IntPoint .pack (1 ).bytes ;
242241 upper .bytes = IntPoint .pack (10 ).bytes ;
243242 assertEquals (
244- "updating bytes changes nothing" ,
245- 0 ,
246- searcher .search (builder .build (), 1 ).totalHits .value ());
243+ "updating bytes changes nothing" ,
244+ 0 ,
245+ searcher .search (builder .build (), 1 ).totalHits .value ());
247246 builder .add (lower , upper );
248247 assertEquals (
249- "sanity check for potential match" ,
250- 2 ,
251- searcher .search (builder .build (), 1 ).totalHits .value ());
248+ "sanity check for potential match" ,
249+ 2 ,
250+ searcher .search (builder .build (), 1 ).totalHits .value ());
252251 }
253252 // hit by value as a range upper==lower
254253 TopDocs hit1 = searcher .search (mrSsDvQ ("foo" , 2 , 3 , 4 , 5 , -5 , -2 , 1 , 1 ), 1 );
0 commit comments