@@ -136,7 +136,7 @@ public void testHNSWSQFP16_onUpgradeWhenClipToFp16isTrueAndIndexedWithOutOfFP16R
136
136
List <Integer > efConstructionValues = ImmutableList .of (16 , 32 , 64 , 128 );
137
137
List <Integer > efSearchValues = ImmutableList .of (16 , 32 , 64 , 128 );
138
138
139
- int dimension = 2 ;
139
+ int dimension = 128 ;
140
140
141
141
// Create an index
142
142
/**
@@ -199,16 +199,35 @@ public void testHNSWSQFP16_onUpgradeWhenClipToFp16isTrueAndIndexedWithOutOfFP16R
199
199
200
200
createKnnIndex (testIndex , mapping );
201
201
assertEquals (new TreeMap <>(mappingMap ), new TreeMap <>(getIndexMappingAsMap (testIndex )));
202
- Float [] vector1 = { -65523.76f , 65504.2f };
203
- Float [] vector2 = { -270.85f , 65514.2f };
204
- Float [] vector3 = { -150.9f , 65504.0f };
205
- Float [] vector4 = { -20.89f , 100000000.0f };
202
+
203
+ Float [] vector1 = new Float [dimension ];
204
+ Float [] vector2 = new Float [dimension ];
205
+ Float [] vector3 = new Float [dimension ];
206
+ Float [] vector4 = new Float [dimension ];
207
+ float [] queryVector = new float [dimension ];
208
+ int halfDimension = dimension / 2 ;
209
+
210
+ for (int i = 0 ; i < dimension ; i ++) {
211
+ if (i < halfDimension ) {
212
+ vector1 [i ] = -65523.76f ;
213
+ vector2 [i ] = -270.85f ;
214
+ vector3 [i ] = -150.9f ;
215
+ vector4 [i ] = -20.89f ;
216
+ queryVector [i ] = -10.5f ;
217
+ } else {
218
+ vector1 [i ] = 65504.2f ;
219
+ vector2 [i ] = 65514.2f ;
220
+ vector3 [i ] = 65504.0f ;
221
+ vector4 [i ] = 100000000.0f ;
222
+ queryVector [i ] = 25.48f ;
223
+ }
224
+ }
225
+
206
226
addKnnDoc (testIndex , "1" , TEST_FIELD , vector1 );
207
227
addKnnDoc (testIndex , "2" , TEST_FIELD , vector2 );
208
228
addKnnDoc (testIndex , "3" , TEST_FIELD , vector3 );
209
229
addKnnDoc (testIndex , "4" , TEST_FIELD , vector4 );
210
230
211
- float [] queryVector = { -10.5f , 25.48f };
212
231
int k = 4 ;
213
232
Response searchResponse = searchKNNIndex (testIndex , new KNNQueryBuilder (TEST_FIELD , queryVector , k ), k );
214
233
List <KNNResult > results = parseSearchResponse (EntityUtils .toString (searchResponse .getEntity ()), TEST_FIELD );
0 commit comments