Commit 9b957e8
Bypass HNSW graph building for tiny segments (#14963)
This change avoids creating a HNSW graph if the segment is small (here we have taken the thresholdfor number of vectors as `10000` based on the conversation [here](#13447 (comment)) for now).
Some of the points I'm not sure how we would want to go about :
- All the tests passes currently since the option to enable the optimization is `false` by default but setting it to `true` reveals some failing unit tests which inherently assumes that the HNSW graph is created and KNN search is triggered (do we have some idea of how to bypass those in some good clean way?)
- I understand we might want to always keep this optimization on (also less invasive change), but for now in this PR, I made it configurable and enabled it on the KNN format - just to be cautious (wasn't sure if it would not affect back-compact in some unknown way), but happy to make it as default behaviour1 parent 3eea6aa commit 9b957e8
File tree
17 files changed
+298
-42
lines changed- lucene
- backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene99
- core/src
- java/org/apache/lucene/codecs
- lucene102
- lucene104
- lucene99
- test/org/apache/lucene
- codecs
- lucene104
- lucene99
- index
- search
- util/hnsw
- test-framework/src/java/org/apache/lucene/tests
- index
- util
17 files changed
+298
-42
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
| 78 | + | |
| 79 | + | |
78 | 80 | | |
79 | 81 | | |
80 | 82 | | |
| |||
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
| 50 | + | |
| 51 | + | |
51 | 52 | | |
52 | 53 | | |
53 | 54 | | |
| |||
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | | - | |
| 60 | + | |
| 61 | + | |
61 | 62 | | |
62 | 63 | | |
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
131 | | - | |
| 131 | + | |
| 132 | + | |
132 | 133 | | |
133 | 134 | | |
134 | 135 | | |
| |||
Lines changed: 49 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| |||
60 | 61 | | |
61 | 62 | | |
62 | 63 | | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
63 | 78 | | |
64 | 79 | | |
65 | 80 | | |
| |||
70 | 85 | | |
71 | 86 | | |
72 | 87 | | |
73 | | - | |
| 88 | + | |
| 89 | + | |
74 | 90 | | |
75 | 91 | | |
76 | 92 | | |
| |||
80 | 96 | | |
81 | 97 | | |
82 | 98 | | |
83 | | - | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
84 | 106 | | |
85 | 107 | | |
86 | 108 | | |
| |||
99 | 121 | | |
100 | 122 | | |
101 | 123 | | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
102 | 144 | | |
103 | 145 | | |
104 | 146 | | |
| |||
117 | 159 | | |
118 | 160 | | |
119 | 161 | | |
| 162 | + | |
120 | 163 | | |
121 | 164 | | |
122 | 165 | | |
| |||
137 | 180 | | |
138 | 181 | | |
139 | 182 | | |
140 | | - | |
| 183 | + | |
| 184 | + | |
141 | 185 | | |
142 | 186 | | |
143 | 187 | | |
| |||
156 | 200 | | |
157 | 201 | | |
158 | 202 | | |
| 203 | + | |
| 204 | + | |
159 | 205 | | |
160 | 206 | | |
161 | 207 | | |
| |||
Lines changed: 81 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
119 | 136 | | |
120 | 137 | | |
121 | 138 | | |
| |||
138 | 155 | | |
139 | 156 | | |
140 | 157 | | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
141 | 171 | | |
142 | 172 | | |
143 | 173 | | |
144 | 174 | | |
145 | | - | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
146 | 182 | | |
147 | 183 | | |
148 | 184 | | |
| |||
152 | 188 | | |
153 | 189 | | |
154 | 190 | | |
155 | | - | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
156 | 205 | | |
157 | 206 | | |
158 | 207 | | |
| |||
168 | 217 | | |
169 | 218 | | |
170 | 219 | | |
171 | | - | |
| 220 | + | |
172 | 221 | | |
173 | 222 | | |
174 | 223 | | |
| |||
182 | 231 | | |
183 | 232 | | |
184 | 233 | | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
185 | 258 | | |
186 | 259 | | |
187 | 260 | | |
188 | 261 | | |
189 | 262 | | |
190 | 263 | | |
191 | 264 | | |
| 265 | + | |
192 | 266 | | |
193 | 267 | | |
194 | 268 | | |
| |||
207 | 281 | | |
208 | 282 | | |
209 | 283 | | |
| 284 | + | |
210 | 285 | | |
211 | 286 | | |
212 | 287 | | |
| |||
229 | 304 | | |
230 | 305 | | |
231 | 306 | | |
| 307 | + | |
232 | 308 | | |
233 | 309 | | |
234 | 310 | | |
| |||
248 | 324 | | |
249 | 325 | | |
250 | 326 | | |
| 327 | + | |
| 328 | + | |
251 | 329 | | |
252 | 330 | | |
253 | 331 | | |
| |||
Lines changed: 5 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
338 | 338 | | |
339 | 339 | | |
340 | 340 | | |
341 | | - | |
342 | 341 | | |
343 | 342 | | |
344 | 343 | | |
| 344 | + | |
345 | 345 | | |
346 | 346 | | |
347 | 347 | | |
348 | 348 | | |
349 | 349 | | |
350 | 350 | | |
351 | 351 | | |
352 | | - | |
| 352 | + | |
353 | 353 | | |
354 | 354 | | |
355 | 355 | | |
| |||
405 | 405 | | |
406 | 406 | | |
407 | 407 | | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
408 | 411 | | |
409 | 412 | | |
410 | 413 | | |
| |||
0 commit comments