This repository was archived by the owner on Nov 7, 2025. It is now read-only.
Commit 871ba58
authored
Introduce unique ids (#1435)
An attempt to introduce unique object IDs in the ClickHouse realm.
A returned document id (`_id` field) would have the following syntax:
```
{hex-encoded timestamp field}qqq{hex-encoded hash of the document}
```
Of course, the `{hex-encoded hash of the document}` lives only in Quesma
memory:
1. It needs to be re-calculated when returning search hits
2. Quesma need to filter out based on it when rendering hits
Therefore when fetching document with specific `_id` we could filter out
documents with matching timestamp and then filter for that with matching
fields, returning the right entry.
This fixes the issue, where JSON view of single document could return a
random object from search hits, not necessarily the one clicked.
<img width="1458" alt="image"
src="https://github.com/user-attachments/assets/0b808dba-0255-4be0-ac5f-acb7a21569ba"
/>
**However** (and it's a pretty big however), the "surrounding document"
view **cannot return the surrounding documents**. While the query
doesn't error it also doesn't return any documents. The experiment to
have that working [is carried out is a separate
PR](#1446), although it's not
clear yet if this way of doing things is going to guarantee 100%
correctness.1 parent 57e07b7 commit 871ba58
File tree
4 files changed
+109
-24
lines changed- platform
- model/typical_queries
- parsers/elastic_query_dsl
- testdata
4 files changed
+109
-24
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
7 | 10 | | |
8 | 11 | | |
9 | 12 | | |
| |||
12 | 15 | | |
13 | 16 | | |
14 | 17 | | |
| 18 | + | |
15 | 19 | | |
16 | 20 | | |
17 | 21 | | |
| |||
239 | 243 | | |
240 | 244 | | |
241 | 245 | | |
242 | | - | |
243 | | - | |
244 | | - | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
245 | 249 | | |
246 | 250 | | |
247 | 251 | | |
| |||
250 | 254 | | |
251 | 255 | | |
252 | 256 | | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
253 | 301 | | |
254 | 302 | | |
255 | 303 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
38 | | - | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
39 | 41 | | |
40 | 42 | | |
41 | 43 | | |
| |||
322 | 324 | | |
323 | 325 | | |
324 | 326 | | |
| 327 | + | |
325 | 328 | | |
326 | 329 | | |
327 | 330 | | |
| |||
331 | 334 | | |
332 | 335 | | |
333 | 336 | | |
334 | | - | |
335 | | - | |
336 | | - | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
337 | 340 | | |
338 | | - | |
| 341 | + | |
339 | 342 | | |
340 | 343 | | |
341 | 344 | | |
342 | 345 | | |
343 | 346 | | |
344 | 347 | | |
345 | 348 | | |
| 349 | + | |
346 | 350 | | |
347 | 351 | | |
348 | 352 | | |
| |||
399 | 403 | | |
400 | 404 | | |
401 | 405 | | |
| 406 | + | |
402 | 407 | | |
403 | 408 | | |
404 | 409 | | |
| |||
1233 | 1238 | | |
1234 | 1239 | | |
1235 | 1240 | | |
| 1241 | + | |
| 1242 | + | |
| 1243 | + | |
| 1244 | + | |
| 1245 | + | |
1236 | 1246 | | |
1237 | 1247 | | |
1238 | 1248 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
| 15 | + | |
14 | 16 | | |
15 | 17 | | |
16 | 18 | | |
| |||
24 | 26 | | |
25 | 27 | | |
26 | 28 | | |
27 | | - | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
28 | 32 | | |
29 | 33 | | |
30 | 34 | | |
| |||
131 | 135 | | |
132 | 136 | | |
133 | 137 | | |
134 | | - | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
135 | 162 | | |
136 | 163 | | |
137 | 164 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2148 | 2148 | | |
2149 | 2149 | | |
2150 | 2150 | | |
2151 | | - | |
| 2151 | + | |
2152 | 2152 | | |
2153 | 2153 | | |
2154 | 2154 | | |
| |||
2386 | 2386 | | |
2387 | 2387 | | |
2388 | 2388 | | |
2389 | | - | |
| 2389 | + | |
2390 | 2390 | | |
2391 | 2391 | | |
2392 | 2392 | | |
| |||
2407 | 2407 | | |
2408 | 2408 | | |
2409 | 2409 | | |
2410 | | - | |
2411 | | - | |
| 2410 | + | |
| 2411 | + | |
2412 | 2412 | | |
2413 | 2413 | | |
2414 | 2414 | | |
| |||
2420 | 2420 | | |
2421 | 2421 | | |
2422 | 2422 | | |
2423 | | - | |
| 2423 | + | |
2424 | 2424 | | |
2425 | 2425 | | |
2426 | 2426 | | |
| |||
2429 | 2429 | | |
2430 | 2430 | | |
2431 | 2431 | | |
2432 | | - | |
| 2432 | + | |
2433 | 2433 | | |
2434 | 2434 | | |
2435 | 2435 | | |
| |||
2440 | 2440 | | |
2441 | 2441 | | |
2442 | 2442 | | |
2443 | | - | |
| 2443 | + | |
2444 | 2444 | | |
2445 | 2445 | | |
2446 | 2446 | | |
| |||
2449 | 2449 | | |
2450 | 2450 | | |
2451 | 2451 | | |
2452 | | - | |
| 2452 | + | |
2453 | 2453 | | |
2454 | 2454 | | |
2455 | 2455 | | |
| |||
2460 | 2460 | | |
2461 | 2461 | | |
2462 | 2462 | | |
2463 | | - | |
| 2463 | + | |
2464 | 2464 | | |
2465 | 2465 | | |
2466 | 2466 | | |
| |||
2469 | 2469 | | |
2470 | 2470 | | |
2471 | 2471 | | |
2472 | | - | |
| 2472 | + | |
2473 | 2473 | | |
2474 | 2474 | | |
2475 | 2475 | | |
| |||
2480 | 2480 | | |
2481 | 2481 | | |
2482 | 2482 | | |
2483 | | - | |
| 2483 | + | |
2484 | 2484 | | |
2485 | 2485 | | |
2486 | 2486 | | |
| |||
2489 | 2489 | | |
2490 | 2490 | | |
2491 | 2491 | | |
2492 | | - | |
| 2492 | + | |
2493 | 2493 | | |
2494 | 2494 | | |
2495 | 2495 | | |
| |||
2500 | 2500 | | |
2501 | 2501 | | |
2502 | 2502 | | |
2503 | | - | |
| 2503 | + | |
2504 | 2504 | | |
2505 | 2505 | | |
2506 | 2506 | | |
| |||
0 commit comments