zeusdb-vector-database 0.12.0__tar.gz → 0.13.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/Cargo.lock +5 -5
  2. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/Cargo.toml +1 -1
  3. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/PKG-INFO +17 -17
  4. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/README.md +16 -16
  5. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/bindings/python/src/hnsw_index/mod.rs +9 -3
  6. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/crates/core/src/admit.rs +55 -52
  7. zeusdb_vector_database-0.13.0/crates/core/src/bitmap.rs +407 -0
  8. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/crates/core/src/columns.rs +680 -170
  9. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/crates/core/src/error.rs +29 -3
  10. zeusdb_vector_database-0.13.0/crates/core/src/graph/dump.rs +3621 -0
  11. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/crates/core/src/graph/fuzz.rs +146 -2
  12. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/crates/core/src/graph/mod.rs +321 -118
  13. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/crates/core/src/graph/mutable/insert.rs +16 -9
  14. zeusdb_vector_database-0.13.0/crates/core/src/graph/mutable/layout_tests.rs +85 -0
  15. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/crates/core/src/graph/mutable/mod.rs +595 -239
  16. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/crates/core/src/graph/store.rs +7 -0
  17. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/crates/core/src/graph/structure.rs +98 -27
  18. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/crates/core/src/graph/test_graph.rs +1 -1
  19. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/crates/core/src/graph/traverse.rs +9 -9
  20. zeusdb_vector_database-0.13.0/crates/core/src/ids.rs +1319 -0
  21. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/crates/core/src/lib.rs +12 -5
  22. zeusdb_vector_database-0.13.0/crates/core/src/metadata.rs +856 -0
  23. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/crates/core/src/operation.rs +159 -6
  24. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/crates/core/src/space.rs +154 -27
  25. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/crates/hnsw/Cargo.toml +4 -0
  26. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/crates/hnsw/src/collection/apply.rs +33 -18
  27. zeusdb_vector_database-0.13.0/crates/hnsw/src/collection/close_up_tests.rs +2089 -0
  28. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/crates/hnsw/src/collection/construct.rs +19 -7
  29. zeusdb_vector_database-0.13.0/crates/hnsw/src/collection/dense.rs +2537 -0
  30. zeusdb_vector_database-0.13.0/crates/hnsw/src/collection/id_range_tests.rs +887 -0
  31. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/crates/hnsw/src/collection/insert.rs +1583 -391
  32. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/crates/hnsw/src/collection/journal_tests.rs +45 -3
  33. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/crates/hnsw/src/collection/mod.rs +219 -58
  34. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/crates/hnsw/src/collection/mutation_tests.rs +192 -2
  35. zeusdb_vector_database-0.13.0/crates/hnsw/src/collection/numbering_tests.rs +369 -0
  36. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/crates/hnsw/src/collection/persist.rs +166 -67
  37. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/crates/hnsw/src/collection/persist_tests.rs +484 -16
  38. zeusdb_vector_database-0.13.0/crates/hnsw/src/collection/positions_tests.rs +2650 -0
  39. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/crates/hnsw/src/collection/query.rs +3 -5
  40. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/crates/hnsw/src/collection/replay_tests.rs +470 -10
  41. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/crates/hnsw/src/collection/search.rs +18 -23
  42. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/crates/hnsw/src/collection/stats.rs +63 -36
  43. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/crates/hnsw/src/collection/training.rs +109 -57
  44. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/crates/hnsw/src/locks.rs +1 -1
  45. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/crates/hnsw/src/persistence/tests.rs +76 -16
  46. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/crates/hnsw/src/persistence.rs +351 -122
  47. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/crates/hnsw/src/rerank.rs +41 -20
  48. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/crates/sparse/Cargo.toml +11 -0
  49. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/crates/sparse/src/calibrate.rs +4 -4
  50. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/crates/sparse/src/index.rs +623 -77
  51. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/crates/sparse/src/lib.rs +11 -2
  52. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/crates/sparse/src/persist.rs +246 -25
  53. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/crates/sparse/src/search.rs +518 -34
  54. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/crates/sparse/src/verify.rs +21 -14
  55. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/pyproject.toml +1 -1
  56. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/src/zeusdb_vector_database/__init__.py +1 -1
  57. zeusdb_vector_database-0.12.0/crates/core/src/graph/dump.rs +0 -1881
  58. zeusdb_vector_database-0.12.0/crates/core/src/ids.rs +0 -720
  59. zeusdb_vector_database-0.12.0/crates/core/src/metadata.rs +0 -379
  60. zeusdb_vector_database-0.12.0/crates/hnsw/src/collection/dense.rs +0 -969
  61. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/LICENSE +0 -0
  62. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/NOTICE +0 -0
  63. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/bindings/python/Cargo.toml +0 -0
  64. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/bindings/python/src/conversion.rs +0 -0
  65. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/bindings/python/src/durability.rs +0 -0
  66. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/bindings/python/src/hnsw_index/construct.rs +0 -0
  67. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/bindings/python/src/hnsw_index/input.rs +0 -0
  68. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/bindings/python/src/hnsw_index/query.rs +0 -0
  69. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/bindings/python/src/lib.rs +0 -0
  70. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/bindings/python/src/logging.rs +0 -0
  71. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/bindings/python/src/tokenizer.rs +0 -0
  72. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/crates/core/Cargo.toml +0 -0
  73. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/crates/core/src/checksum.rs +0 -0
  74. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/crates/core/src/distance.rs +0 -0
  75. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/crates/core/src/filter.rs +0 -0
  76. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/crates/core/src/frame.rs +0 -0
  77. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/crates/core/src/fusion.rs +0 -0
  78. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/crates/core/src/graph/guard_tests.rs +0 -0
  79. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/crates/core/src/graph/levels.rs +0 -0
  80. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/crates/core/src/int8.rs +0 -0
  81. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/crates/core/src/journal.rs +0 -0
  82. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/crates/core/src/kill.rs +0 -0
  83. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/crates/core/src/pq.rs +0 -0
  84. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/crates/core/src/rng.rs +0 -0
  85. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/crates/core/src/storage/fs.rs +0 -0
  86. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/crates/core/src/storage/mod.rs +0 -0
  87. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/crates/core/src/test_vectors.rs +0 -0
  88. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/crates/hnsw/src/collection/crash_tests.rs +0 -0
  89. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/crates/hnsw/src/collection/durability_tests.rs +0 -0
  90. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/crates/hnsw/src/collection/features_tests.rs +0 -0
  91. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/crates/hnsw/src/collection/identity_tests.rs +0 -0
  92. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/crates/hnsw/src/collection/input.rs +0 -0
  93. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/crates/hnsw/src/collection/int8_tests.rs +0 -0
  94. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/crates/hnsw/src/collection/page.rs +0 -0
  95. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/crates/hnsw/src/collection/query_tests.rs +0 -0
  96. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/crates/hnsw/src/collection/spaces_tests.rs +0 -0
  97. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/crates/hnsw/src/flusher.rs +0 -0
  98. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/crates/hnsw/src/journal.rs +0 -0
  99. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/crates/hnsw/src/lib.rs +0 -0
  100. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/crates/hnsw/src/persistence/features.rs +0 -0
  101. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/crates/hnsw/src/persistence/framed.rs +0 -0
  102. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/crates/hnsw/src/persistence/legacy.rs +0 -0
  103. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/crates/sparse/src/corpus.rs +0 -0
  104. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/crates/text/Cargo.toml +0 -0
  105. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/crates/text/src/dictionary.rs +0 -0
  106. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/crates/text/src/lib.rs +0 -0
  107. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/crates/text/src/tokenizer.rs +0 -0
  108. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/crates/text/src/vectorize.rs +0 -0
  109. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/src/zeusdb_vector_database/logging_config.py +0 -0
  110. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/src/zeusdb_vector_database/py.typed +0 -0
  111. {zeusdb_vector_database-0.12.0 → zeusdb_vector_database-0.13.0}/src/zeusdb_vector_database/vector_database.py +0 -0
@@ -1002,7 +1002,7 @@ dependencies = [
1002
1002
 
1003
1003
  [[package]]
1004
1004
  name = "zeusdb-vector-core"
1005
- version = "0.12.0"
1005
+ version = "0.13.0"
1006
1006
  dependencies = [
1007
1007
  "rand",
1008
1008
  "rand_chacha",
@@ -1015,7 +1015,7 @@ dependencies = [
1015
1015
 
1016
1016
  [[package]]
1017
1017
  name = "zeusdb-vector-hnsw"
1018
- version = "0.12.0"
1018
+ version = "0.13.0"
1019
1019
  dependencies = [
1020
1020
  "chrono",
1021
1021
  "rand",
@@ -1030,7 +1030,7 @@ dependencies = [
1030
1030
 
1031
1031
  [[package]]
1032
1032
  name = "zeusdb-vector-python"
1033
- version = "0.12.0"
1033
+ version = "0.13.0"
1034
1034
  dependencies = [
1035
1035
  "chrono",
1036
1036
  "numpy",
@@ -1045,7 +1045,7 @@ dependencies = [
1045
1045
 
1046
1046
  [[package]]
1047
1047
  name = "zeusdb-vector-sparse"
1048
- version = "0.12.0"
1048
+ version = "0.13.0"
1049
1049
  dependencies = [
1050
1050
  "serde",
1051
1051
  "tempfile",
@@ -1055,7 +1055,7 @@ dependencies = [
1055
1055
 
1056
1056
  [[package]]
1057
1057
  name = "zeusdb-vector-text"
1058
- version = "0.12.0"
1058
+ version = "0.13.0"
1059
1059
  dependencies = [
1060
1060
  "serde",
1061
1061
  "zeusdb-vector-core",
@@ -27,7 +27,7 @@ resolver = "2"
27
27
  members = ["crates/*", "bindings/*"]
28
28
 
29
29
  [workspace.package]
30
- version = "0.12.0"
30
+ version = "0.13.0"
31
31
  edition = "2021"
32
32
  # The same licence pyproject.toml declares, LICENSE holds and NOTICE restates.
33
33
  # cargo-deny reads this field. The wheel's metadata is unaffected, because
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: zeusdb-vector-database
3
- Version: 0.12.0
3
+ Version: 0.13.0
4
4
  Classifier: Programming Language :: Rust
5
5
  Classifier: Programming Language :: Python :: Implementation :: CPython
6
6
  Requires-Dist: numpy>=2.2.6,<3.0.0
@@ -820,7 +820,7 @@ storage_mode_description: raw_only
820
820
  | `quantized_codes_memory_mb` | The map holding a second copy of every product quantized code, which grows with the record count. `0.00` on a scalar index, whose rows live in the graph alone |
821
821
  | `codebook_memory_mb`, `sdc_table_memory_mb`, `centroid_norm_memory_mb` | The trained product quantization tables, fixed by `dim`, `subvectors` and `bits` |
822
822
  | `scale_memory_mb` | The scales of a scalar index, `dim` floats once per index |
823
- | `index_bookkeeping_memory_mb` | The id store that finds a record, the per-record metadata, the declared columns, the live sets, the index level metadata and, on a product quantized index, the table of the code map |
823
+ | `index_bookkeeping_memory_mb` | The id store that finds a record, the per-record metadata, the declared columns, the live sets, the table that finds each record's graph node, the index level metadata and, on a product quantized index, the table of the code map |
824
824
  | `reserved_memory_mb` | The part of `total_memory_mb` no record has been written into. It is committed and not resident, and it is exactly what `shrink_to_fit()` returns |
825
825
  | `total_memory_mb` | The sum of the memory figures above, `reserved_memory_mb` being inside that sum rather than beside it, plus `sparse_memory_mb` and `dictionary_memory_mb` where the index declares a sparse space |
826
826
  | `quantization_type` | `pq`, `int8`, or `none` on an unquantized index |
@@ -832,14 +832,14 @@ On a quantized index it also carries `quantization_active`, `quantization_traine
832
832
 
833
833
  | mode | reported | reserved | written | resident | reported / resident |
834
834
  |---|---:|---:|---:|---:|---:|
835
- | no quantization | 513.40 MiB | 204.36 | 309.04 | 312.68 | 1.64 |
836
- | `quantized_with_raw` | 543.88 | 219.45 | 324.43 | 348.41 | 1.56 |
837
- | `quantized_only` | 31.88 | 0.42 | 31.46 | 54.70 | 0.58 |
838
- | `int8` | 89.93 | 0.42 | 89.51 | 92.48 | 0.97 |
835
+ | no quantization | 513.71 MiB | 204.54 | 309.17 | 311.55 | 1.65 |
836
+ | `quantized_with_raw` | 544.06 | 219.50 | 324.56 | 344.26 | 1.58 |
837
+ | `quantized_only` | 32.07 | 0.47 | 31.60 | 49.84 | 0.64 |
838
+ | `int8` | 90.11 | 0.47 | 89.64 | 92.30 | 0.98 |
839
839
 
840
840
  **Size infrastructure from the resident figure, and compare two configurations by `total_memory_mb` minus `reserved_memory_mb`**, which is what each has written and is free of where each landed in its doubling cycle. The two rows that hold raw vectors report far above what they hold, because at `dim=1536` the store holding the vectors is reserved under a byte budget well short of the declaration and then grows by doubling, so its last doubling left capacity for far more records than the index holds; `shrink_to_fit()` hands that back once the inserts are done. The `quantized_only` row reports below what it holds, because the map that keys a code by id costs two small heap blocks a record and the allocator charges each block more than the index asked for.
841
841
 
842
- `index_bookkeeping_memory_mb` is proportional to the record count and independent of the dimension. At 100,000 records with short decimal ids and no metadata it reads 36.6 bytes a record, being 20 for the id store and 16 for the per-record metadata entry. A uuid costs 35 more, a record carrying metadata costs 40 bytes a field beside the text of its string values, and a `quantized_only` product quantized index adds the code map's table and its copy of the id at 69 bytes a record. The figure steps with the id store's table rather than climbing smoothly, so it reads 41.9 bytes a record at 115,000 records, where the table has just doubled.
842
+ `index_bookkeeping_memory_mb` is proportional to the record count and independent of the dimension. At 100,000 records with short decimal ids and no metadata it reads 40.4 bytes a record, being 20 for the id store, 16 for the per-record metadata entry and 4 for the table that finds the record's graph node. A uuid costs 35 more, a record carrying metadata costs 40 bytes a field beside the text of its string values, and a `quantized_only` product quantized index adds the code map's table and its copy of the id at 69 bytes a record. The figure steps with the id store's table rather than climbing smoothly, so it reads 45.7 bytes a record at 115,000 records, where the table has just doubled.
843
843
 
844
844
  **Figures the keys give by arithmetic.** None of these is a key, because each is a division over two that are:
845
845
 
@@ -1148,7 +1148,7 @@ Clearing an empty index returns `0` and is not an error. The generated ID counte
1148
1148
 
1149
1149
  #### ♻️ Return the graph's spare capacity
1150
1150
 
1151
- An index built by inserting grows its graph buffers geometrically, so the last growth leaves the largest of them holding close to twice what they use. `shrink_to_fit()` returns that slack to the allocator and reports the bytes it released, and `get_stats()["reserved_memory_mb"]` prices the same slack before the call is made.
1151
+ An index built by inserting grows its graph buffers geometrically, so the last growth leaves the largest of them holding close to twice what they use. `shrink_to_fit()` returns that slack to the allocator, with the entries that the id store, the per-record metadata and the declared columns reserved and no record has written, and reports the bytes it released. `get_stats()["reserved_memory_mb"]` prices the same bytes before the call is made.
1152
1152
 
1153
1153
  ```python
1154
1154
  fresh = vdb.create("hnsw", dim=8, expected_size=300)
@@ -1172,7 +1172,7 @@ True
1172
1172
  0
1173
1173
  ```
1174
1174
 
1175
- The index above declared 300 records and was given 500, so its graph grew and left slack behind, and `reserved_memory_mb` named it before the call: the call returns exactly that figure and the key reads `0.00` afterwards. `index`, the index used throughout this section, returns `0` instead, because `compact()` was called on it earlier and compaction already shrinks the graph it rebuilds.
1175
+ The index above declared 300 records and was given 500, so its graph and its stores grew and left slack behind, and `reserved_memory_mb` named it before the call: the call returns exactly that figure and the key reads `0.00` afterwards. `index`, the index used throughout this section, returns no graph slack, because `compact()` was called on it earlier and compaction already shrinks the graph it rebuilds. It returns the entries its stores reserved for the 10,000 records its `expected_size` declares, since it holds far fewer.
1176
1176
 
1177
1177
  **No node, edge or distance is touched**, so every search returns the same page with the same scores.
1178
1178
 
@@ -1417,11 +1417,11 @@ Measured resident, one index per interpreter, 50,000 records of real embeddings
1417
1417
 
1418
1418
  | dataset | dim | unquantized | `quantized_only` | `quantized_with_raw` | `int8` |
1419
1419
  |---|---:|---:|---:|---:|---:|
1420
- | dbpedia-openai | 1,536 | 312.7 MiB | 54.7 MiB, 0.17x | 348.4 MiB, 1.11x | 92.5 MiB, 0.30x |
1421
- | sift-128 | 128 | 42.4 MiB | 29.5 MiB, 0.70x | 55.9 MiB, 1.32x | 24.4 MiB, 0.58x |
1422
- | glove-100 | 100 | 37.0 MiB | 30.1 MiB, 0.81x | 49.4 MiB, 1.33x | 23.4 MiB, 0.63x |
1420
+ | dbpedia-openai | 1,536 | 311.6 MiB | 49.8 MiB, 0.16x | 344.3 MiB, 1.10x | 92.3 MiB, 0.30x |
1421
+ | sift-128 | 128 | 42.6 MiB | 29.9 MiB, 0.70x | 54.7 MiB, 1.28x | 24.2 MiB, 0.57x |
1422
+ | glove-100 | 100 | 37.3 MiB | 29.9 MiB, 0.80x | 50.9 MiB, 1.37x | 23.0 MiB, 0.62x |
1423
1423
 
1424
- **Pick `quantized_only` when memory is the constraint and `quantized_with_raw` when accuracy is, and read [Scalar Quantization](#-scalar-quantization) before either.** What `quantized_only` saves is set by the share of a record that is the vector, and that share falls with the dimension: 19% at `dim=100`, 30% at `dim=128` and 83% at `dim=1,536` on the rows above. `get_stats()` prices your own index on your own records, which is the figure to size against.
1424
+ **Pick `quantized_only` when memory is the constraint and `quantized_with_raw` when accuracy is, and read [Scalar Quantization](#-scalar-quantization) before either.** What `quantized_only` saves is set by the share of a record that is the vector, and that share falls with the dimension: 20% at `dim=100`, 30% at `dim=128` and 84% at `dim=1,536` on the rows above. `get_stats()` prices your own index on your own records, which is the figure to size against.
1425
1425
 
1426
1426
  `create()` warns when `quantized_only` cannot repay its fixed tables at the `expected_size` you declared, naming the record count above which it starts saving. Raise `expected_size` if your estimate was low, or drop `quantization_config`. `quantized_with_raw` never repays them, so it gets the warning that names the mode instead.
1427
1427
 
@@ -1580,9 +1580,9 @@ Recall at 10 against exact search on 100,000 records, and resident memory on 50,
1580
1580
 
1581
1581
  | dataset | dim | unquantized | `quantized_only` | `int8` |
1582
1582
  |---|---:|---:|---:|---:|
1583
- | dbpedia-openai | 1,536 | 0.9929, 312.7 MiB | 0.4893, 54.7 MiB | 0.9861, 92.5 MiB |
1584
- | sift-128 | 128 | 0.9988, 42.4 MiB | 0.4038, 29.5 MiB | 0.9827, 24.4 MiB |
1585
- | glove-100 | 100 | 0.8858, 37.0 MiB | 0.2647, 30.1 MiB | 0.8788, 23.4 MiB |
1583
+ | dbpedia-openai | 1,536 | 0.9929, 311.6 MiB | 0.4893, 49.8 MiB | 0.9861, 92.3 MiB |
1584
+ | sift-128 | 128 | 0.9988, 42.6 MiB | 0.4038, 29.9 MiB | 0.9827, 24.2 MiB |
1585
+ | glove-100 | 100 | 0.8858, 37.3 MiB | 0.2647, 29.9 MiB | 0.8788, 23.0 MiB |
1586
1586
 
1587
1587
  A scalar index gives up two hundredths of recall for a third to two thirds of the memory, and searching it is no slower than searching an unquantized one. A trained index writes `int8_scales.zdbint8` and `int8_rows.zdbint8` in place of the two `pq_` files.
1588
1588
 
@@ -2577,7 +2577,7 @@ sparse_memory_mb 0.00
2577
2577
  | `sparse_weighting` | `dot` or `bm25` |
2578
2578
  | `sparse_records` | Records the space holds, which may be fewer than the index holds |
2579
2579
  | `sparse_postings` | Live entries across every record, one per distinct term per record |
2580
- | `sparse_dead_postings` | Occurrences left by removed records, reclaimed at `compact()` |
2580
+ | `sparse_dead_postings` | Occurrences left by removed records. `compact()`, `rebuild()` and quantization training drop them, and so does a removal once the records removed since the last drop outnumber both 4,096 and the records held. A saved directory holds none |
2581
2581
  | `sparse_memory_mb` | What the postings and their index hold |
2582
2582
  | `sparse_tokenizer` | `simple` or `external`, on a text layer alone |
2583
2583
  | `term_count` | Distinct terms the dictionary holds, on a text layer alone |
@@ -798,7 +798,7 @@ storage_mode_description: raw_only
798
798
  | `quantized_codes_memory_mb` | The map holding a second copy of every product quantized code, which grows with the record count. `0.00` on a scalar index, whose rows live in the graph alone |
799
799
  | `codebook_memory_mb`, `sdc_table_memory_mb`, `centroid_norm_memory_mb` | The trained product quantization tables, fixed by `dim`, `subvectors` and `bits` |
800
800
  | `scale_memory_mb` | The scales of a scalar index, `dim` floats once per index |
801
- | `index_bookkeeping_memory_mb` | The id store that finds a record, the per-record metadata, the declared columns, the live sets, the index level metadata and, on a product quantized index, the table of the code map |
801
+ | `index_bookkeeping_memory_mb` | The id store that finds a record, the per-record metadata, the declared columns, the live sets, the table that finds each record's graph node, the index level metadata and, on a product quantized index, the table of the code map |
802
802
  | `reserved_memory_mb` | The part of `total_memory_mb` no record has been written into. It is committed and not resident, and it is exactly what `shrink_to_fit()` returns |
803
803
  | `total_memory_mb` | The sum of the memory figures above, `reserved_memory_mb` being inside that sum rather than beside it, plus `sparse_memory_mb` and `dictionary_memory_mb` where the index declares a sparse space |
804
804
  | `quantization_type` | `pq`, `int8`, or `none` on an unquantized index |
@@ -810,14 +810,14 @@ On a quantized index it also carries `quantization_active`, `quantization_traine
810
810
 
811
811
  | mode | reported | reserved | written | resident | reported / resident |
812
812
  |---|---:|---:|---:|---:|---:|
813
- | no quantization | 513.40 MiB | 204.36 | 309.04 | 312.68 | 1.64 |
814
- | `quantized_with_raw` | 543.88 | 219.45 | 324.43 | 348.41 | 1.56 |
815
- | `quantized_only` | 31.88 | 0.42 | 31.46 | 54.70 | 0.58 |
816
- | `int8` | 89.93 | 0.42 | 89.51 | 92.48 | 0.97 |
813
+ | no quantization | 513.71 MiB | 204.54 | 309.17 | 311.55 | 1.65 |
814
+ | `quantized_with_raw` | 544.06 | 219.50 | 324.56 | 344.26 | 1.58 |
815
+ | `quantized_only` | 32.07 | 0.47 | 31.60 | 49.84 | 0.64 |
816
+ | `int8` | 90.11 | 0.47 | 89.64 | 92.30 | 0.98 |
817
817
 
818
818
  **Size infrastructure from the resident figure, and compare two configurations by `total_memory_mb` minus `reserved_memory_mb`**, which is what each has written and is free of where each landed in its doubling cycle. The two rows that hold raw vectors report far above what they hold, because at `dim=1536` the store holding the vectors is reserved under a byte budget well short of the declaration and then grows by doubling, so its last doubling left capacity for far more records than the index holds; `shrink_to_fit()` hands that back once the inserts are done. The `quantized_only` row reports below what it holds, because the map that keys a code by id costs two small heap blocks a record and the allocator charges each block more than the index asked for.
819
819
 
820
- `index_bookkeeping_memory_mb` is proportional to the record count and independent of the dimension. At 100,000 records with short decimal ids and no metadata it reads 36.6 bytes a record, being 20 for the id store and 16 for the per-record metadata entry. A uuid costs 35 more, a record carrying metadata costs 40 bytes a field beside the text of its string values, and a `quantized_only` product quantized index adds the code map's table and its copy of the id at 69 bytes a record. The figure steps with the id store's table rather than climbing smoothly, so it reads 41.9 bytes a record at 115,000 records, where the table has just doubled.
820
+ `index_bookkeeping_memory_mb` is proportional to the record count and independent of the dimension. At 100,000 records with short decimal ids and no metadata it reads 40.4 bytes a record, being 20 for the id store, 16 for the per-record metadata entry and 4 for the table that finds the record's graph node. A uuid costs 35 more, a record carrying metadata costs 40 bytes a field beside the text of its string values, and a `quantized_only` product quantized index adds the code map's table and its copy of the id at 69 bytes a record. The figure steps with the id store's table rather than climbing smoothly, so it reads 45.7 bytes a record at 115,000 records, where the table has just doubled.
821
821
 
822
822
  **Figures the keys give by arithmetic.** None of these is a key, because each is a division over two that are:
823
823
 
@@ -1126,7 +1126,7 @@ Clearing an empty index returns `0` and is not an error. The generated ID counte
1126
1126
 
1127
1127
  #### ♻️ Return the graph's spare capacity
1128
1128
 
1129
- An index built by inserting grows its graph buffers geometrically, so the last growth leaves the largest of them holding close to twice what they use. `shrink_to_fit()` returns that slack to the allocator and reports the bytes it released, and `get_stats()["reserved_memory_mb"]` prices the same slack before the call is made.
1129
+ An index built by inserting grows its graph buffers geometrically, so the last growth leaves the largest of them holding close to twice what they use. `shrink_to_fit()` returns that slack to the allocator, with the entries that the id store, the per-record metadata and the declared columns reserved and no record has written, and reports the bytes it released. `get_stats()["reserved_memory_mb"]` prices the same bytes before the call is made.
1130
1130
 
1131
1131
  ```python
1132
1132
  fresh = vdb.create("hnsw", dim=8, expected_size=300)
@@ -1150,7 +1150,7 @@ True
1150
1150
  0
1151
1151
  ```
1152
1152
 
1153
- The index above declared 300 records and was given 500, so its graph grew and left slack behind, and `reserved_memory_mb` named it before the call: the call returns exactly that figure and the key reads `0.00` afterwards. `index`, the index used throughout this section, returns `0` instead, because `compact()` was called on it earlier and compaction already shrinks the graph it rebuilds.
1153
+ The index above declared 300 records and was given 500, so its graph and its stores grew and left slack behind, and `reserved_memory_mb` named it before the call: the call returns exactly that figure and the key reads `0.00` afterwards. `index`, the index used throughout this section, returns no graph slack, because `compact()` was called on it earlier and compaction already shrinks the graph it rebuilds. It returns the entries its stores reserved for the 10,000 records its `expected_size` declares, since it holds far fewer.
1154
1154
 
1155
1155
  **No node, edge or distance is touched**, so every search returns the same page with the same scores.
1156
1156
 
@@ -1395,11 +1395,11 @@ Measured resident, one index per interpreter, 50,000 records of real embeddings
1395
1395
 
1396
1396
  | dataset | dim | unquantized | `quantized_only` | `quantized_with_raw` | `int8` |
1397
1397
  |---|---:|---:|---:|---:|---:|
1398
- | dbpedia-openai | 1,536 | 312.7 MiB | 54.7 MiB, 0.17x | 348.4 MiB, 1.11x | 92.5 MiB, 0.30x |
1399
- | sift-128 | 128 | 42.4 MiB | 29.5 MiB, 0.70x | 55.9 MiB, 1.32x | 24.4 MiB, 0.58x |
1400
- | glove-100 | 100 | 37.0 MiB | 30.1 MiB, 0.81x | 49.4 MiB, 1.33x | 23.4 MiB, 0.63x |
1398
+ | dbpedia-openai | 1,536 | 311.6 MiB | 49.8 MiB, 0.16x | 344.3 MiB, 1.10x | 92.3 MiB, 0.30x |
1399
+ | sift-128 | 128 | 42.6 MiB | 29.9 MiB, 0.70x | 54.7 MiB, 1.28x | 24.2 MiB, 0.57x |
1400
+ | glove-100 | 100 | 37.3 MiB | 29.9 MiB, 0.80x | 50.9 MiB, 1.37x | 23.0 MiB, 0.62x |
1401
1401
 
1402
- **Pick `quantized_only` when memory is the constraint and `quantized_with_raw` when accuracy is, and read [Scalar Quantization](#-scalar-quantization) before either.** What `quantized_only` saves is set by the share of a record that is the vector, and that share falls with the dimension: 19% at `dim=100`, 30% at `dim=128` and 83% at `dim=1,536` on the rows above. `get_stats()` prices your own index on your own records, which is the figure to size against.
1402
+ **Pick `quantized_only` when memory is the constraint and `quantized_with_raw` when accuracy is, and read [Scalar Quantization](#-scalar-quantization) before either.** What `quantized_only` saves is set by the share of a record that is the vector, and that share falls with the dimension: 20% at `dim=100`, 30% at `dim=128` and 84% at `dim=1,536` on the rows above. `get_stats()` prices your own index on your own records, which is the figure to size against.
1403
1403
 
1404
1404
  `create()` warns when `quantized_only` cannot repay its fixed tables at the `expected_size` you declared, naming the record count above which it starts saving. Raise `expected_size` if your estimate was low, or drop `quantization_config`. `quantized_with_raw` never repays them, so it gets the warning that names the mode instead.
1405
1405
 
@@ -1558,9 +1558,9 @@ Recall at 10 against exact search on 100,000 records, and resident memory on 50,
1558
1558
 
1559
1559
  | dataset | dim | unquantized | `quantized_only` | `int8` |
1560
1560
  |---|---:|---:|---:|---:|
1561
- | dbpedia-openai | 1,536 | 0.9929, 312.7 MiB | 0.4893, 54.7 MiB | 0.9861, 92.5 MiB |
1562
- | sift-128 | 128 | 0.9988, 42.4 MiB | 0.4038, 29.5 MiB | 0.9827, 24.4 MiB |
1563
- | glove-100 | 100 | 0.8858, 37.0 MiB | 0.2647, 30.1 MiB | 0.8788, 23.4 MiB |
1561
+ | dbpedia-openai | 1,536 | 0.9929, 311.6 MiB | 0.4893, 49.8 MiB | 0.9861, 92.3 MiB |
1562
+ | sift-128 | 128 | 0.9988, 42.6 MiB | 0.4038, 29.9 MiB | 0.9827, 24.2 MiB |
1563
+ | glove-100 | 100 | 0.8858, 37.3 MiB | 0.2647, 29.9 MiB | 0.8788, 23.0 MiB |
1564
1564
 
1565
1565
  A scalar index gives up two hundredths of recall for a third to two thirds of the memory, and searching it is no slower than searching an unquantized one. A trained index writes `int8_scales.zdbint8` and `int8_rows.zdbint8` in place of the two `pq_` files.
1566
1566
 
@@ -2555,7 +2555,7 @@ sparse_memory_mb 0.00
2555
2555
  | `sparse_weighting` | `dot` or `bm25` |
2556
2556
  | `sparse_records` | Records the space holds, which may be fewer than the index holds |
2557
2557
  | `sparse_postings` | Live entries across every record, one per distinct term per record |
2558
- | `sparse_dead_postings` | Occurrences left by removed records, reclaimed at `compact()` |
2558
+ | `sparse_dead_postings` | Occurrences left by removed records. `compact()`, `rebuild()` and quantization training drop them, and so does a removal once the records removed since the last drop outnumber both 4,096 and the records held. A saved directory holds none |
2559
2559
  | `sparse_memory_mb` | What the postings and their index hold |
2560
2560
  | `sparse_tokenizer` | `simple` or `external`, on a text layer alone |
2561
2561
  | `term_count` | Distinct terms the dictionary holds, on a text layer alone |
@@ -1172,7 +1172,8 @@ impl HNSWIndex {
1172
1172
  self.inner.indexed_fields()
1173
1173
  }
1174
1174
 
1175
- /// Return the graph's spare buffer capacity to the allocator.
1175
+ /// Return the graph's spare buffer capacity, and the per-record stores',
1176
+ /// to the allocator.
1176
1177
  ///
1177
1178
  /// A graph built by insertion grows its arenas geometrically, so the last
1178
1179
  /// growth leaves the largest of them holding close to twice what it uses. A
@@ -1183,14 +1184,19 @@ impl HNSWIndex {
1183
1184
  ///
1184
1185
  /// `compact()` does not reclaim it. Compaction rebuilds by inserting, so the
1185
1186
  /// replacement graph regrows exactly the same slack, which is why this is
1186
- /// its own operation. `compact()` calls it on the graph it built, so a
1187
- /// caller who runs compaction gets both.
1187
+ /// its own operation. `compact()` shrinks the graph it built in the same
1188
+ /// way, so a caller who runs compaction gets the graph's slack back too.
1188
1189
  ///
1189
1190
  /// **No node, edge or distance is touched.** Fourteen buffers are
1190
1191
  /// reallocated at their current lengths and their contents copied, so the
1191
1192
  /// topology after the call is the topology before it and every search
1192
1193
  /// returns the same page with the same scores.
1193
1194
  ///
1195
+ /// The id store, the per-record metadata and the declared columns give
1196
+ /// back what they reserved past their records the same way, at their
1197
+ /// lengths, so no record, field or value moves either. What the call
1198
+ /// returns is exactly what `get_stats()["reserved_memory_mb"]` priced.
1199
+ ///
1194
1200
  /// **The index stays writable.** Every buffer is a growable vector, so the
1195
1201
  /// next `add()` reallocates the per node arenas once and then proceeds as
1196
1202
  /// before. Shrinking an index that is still being written to therefore
@@ -12,19 +12,22 @@
12
12
  //! per posting. Measured on a postings scan the call is 28 to 33 percent of
13
13
  //! the whole loop, so an admit set that is a bitmap hands it over through
14
14
  //! `as_bitmap` and the index runs a loop monomorphised over the bit test.
15
- //! `enumerate` is the other door. An admit set that can walk itself in id
16
- //! order lets an index score the members directly rather than traverse or
17
- //! scan, which is what the exact scan under a selective filter does.
15
+ //! `enumerate` is the other door. An admit set that can walk itself in
16
+ //! position order lets an index score the members directly rather than
17
+ //! traverse or scan, which is what the exact scan under a selective filter
18
+ //! does.
19
+ //!
20
+ //! Every set names records by their position.
18
21
 
19
- use crate::columns::Bitmap;
20
- use crate::space::{Hits, RecordId};
22
+ use crate::bitmap::Bitmap;
23
+ use crate::space::{Hits, Position};
21
24
 
22
25
  /// Which records a search may return.
23
26
  pub trait Admit: Sync {
24
- fn admits(&self, id: RecordId) -> bool;
27
+ fn admits(&self, at: Position) -> bool;
25
28
 
26
- /// How many ids this admits, where known. `None` means unknown, which is
27
- /// what a predicate over metadata answers.
29
+ /// How many positions this admits, where known. `None` means unknown,
30
+ /// which is what a predicate over metadata answers.
28
31
  fn len_hint(&self) -> Option<usize>;
29
32
 
30
33
  /// Whether this set admits every record, which a caller with no filter
@@ -40,10 +43,10 @@ pub trait Admit: Sync {
40
43
  None
41
44
  }
42
45
 
43
- /// Walk every admitted id in increasing order, stopping when `visit`
44
- /// returns false. Returns false if this set cannot enumerate itself, in
45
- /// which case `visit` was never called.
46
- fn enumerate(&self, visit: &mut dyn FnMut(RecordId) -> bool) -> bool {
46
+ /// Walk every admitted position in increasing order, stopping when
47
+ /// `visit` returns false. Returns false if this set cannot enumerate
48
+ /// itself, in which case `visit` was never called.
49
+ fn enumerate(&self, visit: &mut dyn FnMut(Position) -> bool) -> bool {
47
50
  let _ = visit;
48
51
  false
49
52
  }
@@ -51,8 +54,8 @@ pub trait Admit: Sync {
51
54
 
52
55
  impl Admit for Bitmap {
53
56
  #[inline]
54
- fn admits(&self, id: RecordId) -> bool {
55
- self.contains(id.slot())
57
+ fn admits(&self, at: Position) -> bool {
58
+ self.contains(at.slot())
56
59
  }
57
60
 
58
61
  fn len_hint(&self) -> Option<usize> {
@@ -63,8 +66,8 @@ impl Admit for Bitmap {
63
66
  Some(self)
64
67
  }
65
68
 
66
- fn enumerate(&self, visit: &mut dyn FnMut(RecordId) -> bool) -> bool {
67
- self.for_each_while(|slot| visit(RecordId::from_slot(slot)));
69
+ fn enumerate(&self, visit: &mut dyn FnMut(Position) -> bool) -> bool {
70
+ self.for_each_while(|slot| visit(Position::from_slot(slot)));
68
71
  true
69
72
  }
70
73
  }
@@ -77,26 +80,26 @@ pub enum Candidates {
77
80
  #[default]
78
81
  All,
79
82
  Bitmap(Bitmap),
80
- /// Strictly increasing record ids.
81
- Sorted(Vec<RecordId>),
83
+ /// Strictly increasing positions.
84
+ Sorted(Vec<Position>),
82
85
  }
83
86
 
84
87
  impl Candidates {
85
88
  /// Turn a page into a candidate set, which is how one arm feeds the next.
86
89
  pub fn from_hits(hits: &Hits) -> Self {
87
- let mut ids: Vec<RecordId> = hits.items.iter().map(|h| h.id).collect();
88
- ids.sort_unstable();
89
- ids.dedup();
90
- Candidates::Sorted(ids)
90
+ let mut positions: Vec<Position> = hits.items.iter().map(|h| h.position).collect();
91
+ positions.sort_unstable();
92
+ positions.dedup();
93
+ Candidates::Sorted(positions)
91
94
  }
92
95
  }
93
96
 
94
97
  impl Admit for Candidates {
95
- fn admits(&self, id: RecordId) -> bool {
98
+ fn admits(&self, at: Position) -> bool {
96
99
  match self {
97
100
  Candidates::All => true,
98
- Candidates::Bitmap(b) => b.contains(id.slot()),
99
- Candidates::Sorted(ids) => ids.binary_search(&id).is_ok(),
101
+ Candidates::Bitmap(b) => b.contains(at.slot()),
102
+ Candidates::Sorted(positions) => positions.binary_search(&at).is_ok(),
100
103
  }
101
104
  }
102
105
 
@@ -108,7 +111,7 @@ impl Admit for Candidates {
108
111
  match self {
109
112
  Candidates::All => None,
110
113
  Candidates::Bitmap(b) => Some(b.count()),
111
- Candidates::Sorted(ids) => Some(ids.len()),
114
+ Candidates::Sorted(positions) => Some(positions.len()),
112
115
  }
113
116
  }
114
117
 
@@ -119,13 +122,13 @@ impl Admit for Candidates {
119
122
  }
120
123
  }
121
124
 
122
- fn enumerate(&self, visit: &mut dyn FnMut(RecordId) -> bool) -> bool {
125
+ fn enumerate(&self, visit: &mut dyn FnMut(Position) -> bool) -> bool {
123
126
  match self {
124
127
  Candidates::All => false,
125
128
  Candidates::Bitmap(b) => b.enumerate(visit),
126
- Candidates::Sorted(ids) => {
127
- for &id in ids {
128
- if !visit(id) {
129
+ Candidates::Sorted(positions) => {
130
+ for &at in positions {
131
+ if !visit(at) {
129
132
  break;
130
133
  }
131
134
  }
@@ -140,8 +143,8 @@ impl Admit for Candidates {
140
143
  pub struct And<'a>(pub &'a dyn Admit, pub &'a dyn Admit);
141
144
 
142
145
  impl Admit for And<'_> {
143
- fn admits(&self, id: RecordId) -> bool {
144
- self.0.admits(id) && self.1.admits(id)
146
+ fn admits(&self, at: Position) -> bool {
147
+ self.0.admits(at) && self.1.admits(at)
145
148
  }
146
149
 
147
150
  fn admits_all(&self) -> bool {
@@ -159,16 +162,16 @@ impl Admit for And<'_> {
159
162
 
160
163
  /// Drive from whichever side is smaller and can enumerate, and test the
161
164
  /// other. Returns false only when neither side can enumerate.
162
- fn enumerate(&self, visit: &mut dyn FnMut(RecordId) -> bool) -> bool {
165
+ fn enumerate(&self, visit: &mut dyn FnMut(Position) -> bool) -> bool {
163
166
  let (drive, test): (&dyn Admit, &dyn Admit) = match (self.0.len_hint(), self.1.len_hint()) {
164
167
  (Some(a), Some(b)) if b < a => (self.1, self.0),
165
168
  (None, Some(_)) => (self.1, self.0),
166
169
  _ => (self.0, self.1),
167
170
  };
168
- if drive.enumerate(&mut |id| !test.admits(id) || visit(id)) {
171
+ if drive.enumerate(&mut |at| !test.admits(at) || visit(at)) {
169
172
  return true;
170
173
  }
171
- test.enumerate(&mut |id| !drive.admits(id) || visit(id))
174
+ test.enumerate(&mut |at| !drive.admits(at) || visit(at))
172
175
  }
173
176
  }
174
177
 
@@ -179,8 +182,8 @@ mod tests {
179
182
  fn ids(admit: &dyn Admit) -> Option<Vec<u32>> {
180
183
  let mut out = Vec::new();
181
184
  admit
182
- .enumerate(&mut |id| {
183
- out.push(id.0);
185
+ .enumerate(&mut |at| {
186
+ out.push(at.0);
184
187
  true
185
188
  })
186
189
  .then_some(out)
@@ -189,8 +192,8 @@ mod tests {
189
192
  struct Even;
190
193
 
191
194
  impl Admit for Even {
192
- fn admits(&self, id: RecordId) -> bool {
193
- id.0.is_multiple_of(2)
195
+ fn admits(&self, at: Position) -> bool {
196
+ at.0.is_multiple_of(2)
194
197
  }
195
198
  fn len_hint(&self) -> Option<usize> {
196
199
  None
@@ -205,8 +208,8 @@ mod tests {
205
208
  for slot in [3usize, 64, 65, 200] {
206
209
  bitmap.insert(slot);
207
210
  }
208
- assert!(bitmap.admits(RecordId(64)));
209
- assert!(!bitmap.admits(RecordId(4)));
211
+ assert!(bitmap.admits(Position(64)));
212
+ assert!(!bitmap.admits(Position(4)));
210
213
  assert_eq!(bitmap.len_hint(), Some(4));
211
214
  assert!(bitmap.as_bitmap().is_some());
212
215
  assert_eq!(ids(&bitmap), Some(vec![3, 64, 65, 200]));
@@ -216,14 +219,14 @@ mod tests {
216
219
  /// says, and a page becomes a sorted, deduplicated set.
217
220
  #[test]
218
221
  fn candidates_answer_by_shape() {
219
- assert!(Candidates::All.admits(RecordId(9)));
222
+ assert!(Candidates::All.admits(Position(9)));
220
223
  assert!(Candidates::All.admits_all());
221
224
  assert_eq!(Candidates::All.len_hint(), None);
222
225
  assert_eq!(ids(&Candidates::All), None);
223
226
 
224
- let sorted = Candidates::Sorted(vec![RecordId(2), RecordId(5), RecordId(9)]);
225
- assert!(sorted.admits(RecordId(5)));
226
- assert!(!sorted.admits(RecordId(6)));
227
+ let sorted = Candidates::Sorted(vec![Position(2), Position(5), Position(9)]);
228
+ assert!(sorted.admits(Position(5)));
229
+ assert!(!sorted.admits(Position(6)));
227
230
  assert!(!sorted.admits_all());
228
231
  assert_eq!(sorted.len_hint(), Some(3));
229
232
  assert!(sorted.as_bitmap().is_none());
@@ -232,8 +235,8 @@ mod tests {
232
235
  let hits = Hits {
233
236
  items: [9u32, 2, 9, 5]
234
237
  .iter()
235
- .map(|&id| crate::space::Hit {
236
- id: RecordId(id),
238
+ .map(|&at| crate::space::Hit {
239
+ position: Position(at),
237
240
  score: 0.0,
238
241
  })
239
242
  .collect(),
@@ -254,13 +257,13 @@ mod tests {
254
257
  let both = And(&Even, &bitmap);
255
258
  assert_eq!(ids(&both), Some(vec![0, 2, 4, 6, 8]));
256
259
  assert_eq!(both.len_hint(), Some(10));
257
- assert!(both.admits(RecordId(4)));
258
- assert!(!both.admits(RecordId(5)));
259
- assert!(!both.admits(RecordId(12)));
260
+ assert!(both.admits(Position(4)));
261
+ assert!(!both.admits(Position(5)));
262
+ assert!(!both.admits(Position(12)));
260
263
 
261
264
  let mut seen = Vec::new();
262
- assert!(both.enumerate(&mut |id| {
263
- seen.push(id.0);
265
+ assert!(both.enumerate(&mut |at| {
266
+ seen.push(at.0);
264
267
  seen.len() < 2
265
268
  }));
266
269
  assert_eq!(seen, vec![0, 2]);