5252import java .util .Locale ;
5353
5454import static java .lang .String .format ;
55+ import static org .apache .lucene .codecs .lucene99 .Lucene99HnswVectorsFormat .DEFAULT_BEAM_WIDTH ;
56+ import static org .apache .lucene .codecs .lucene99 .Lucene99HnswVectorsFormat .DEFAULT_MAX_CONN ;
5557import static org .apache .lucene .index .VectorSimilarityFunction .DOT_PRODUCT ;
5658import static org .apache .lucene .search .DocIdSetIterator .NO_MORE_DOCS ;
5759import static org .hamcrest .Matchers .either ;
@@ -64,11 +66,17 @@ public class ES93HnswBinaryQuantizedVectorsFormatTests extends BaseKnnVectorsFor
6466 LogConfigurator .configureESLogging (); // native access requires logging to be initialized
6567 }
6668
67- static final Codec codec = TestUtil .alwaysKnnVectorsFormat (new ES93HnswBinaryQuantizedVectorsFormat ());
69+ private KnnVectorsFormat format ;
70+
71+ @ Override
72+ public void setUp () throws Exception {
73+ format = new ES93HnswBinaryQuantizedVectorsFormat (DEFAULT_MAX_CONN , DEFAULT_BEAM_WIDTH , random ().nextBoolean ());
74+ super .setUp ();
75+ }
6876
6977 @ Override
7078 protected Codec getCodec () {
71- return codec ;
79+ return TestUtil . alwaysKnnVectorsFormat ( format ) ;
7280 }
7381
7482 public void testToString () {
@@ -129,12 +137,12 @@ public void testSingleVectorCase() throws Exception {
129137 }
130138
131139 public void testLimits () {
132- expectThrows (IllegalArgumentException .class , () -> new ES93HnswBinaryQuantizedVectorsFormat (-1 , 20 ));
133- expectThrows (IllegalArgumentException .class , () -> new ES93HnswBinaryQuantizedVectorsFormat (0 , 20 ));
134- expectThrows (IllegalArgumentException .class , () -> new ES93HnswBinaryQuantizedVectorsFormat (20 , 0 ));
135- expectThrows (IllegalArgumentException .class , () -> new ES93HnswBinaryQuantizedVectorsFormat (20 , -1 ));
136- expectThrows (IllegalArgumentException .class , () -> new ES93HnswBinaryQuantizedVectorsFormat (512 + 1 , 20 ));
137- expectThrows (IllegalArgumentException .class , () -> new ES93HnswBinaryQuantizedVectorsFormat (20 , 3201 ));
140+ expectThrows (IllegalArgumentException .class , () -> new ES93HnswBinaryQuantizedVectorsFormat (-1 , 20 , false ));
141+ expectThrows (IllegalArgumentException .class , () -> new ES93HnswBinaryQuantizedVectorsFormat (0 , 20 , false ));
142+ expectThrows (IllegalArgumentException .class , () -> new ES93HnswBinaryQuantizedVectorsFormat (20 , 0 , false ));
143+ expectThrows (IllegalArgumentException .class , () -> new ES93HnswBinaryQuantizedVectorsFormat (20 , -1 , false ));
144+ expectThrows (IllegalArgumentException .class , () -> new ES93HnswBinaryQuantizedVectorsFormat (512 + 1 , 20 , false ));
145+ expectThrows (IllegalArgumentException .class , () -> new ES93HnswBinaryQuantizedVectorsFormat (20 , 3201 , false ));
138146 expectThrows (
139147 IllegalArgumentException .class ,
140148 () -> new ES93HnswBinaryQuantizedVectorsFormat (20 , 100 , false , 1 , new SameThreadExecutorService ())
0 commit comments