Commit Graph

47 Commits

Author SHA1 Message Date
dependabot[bot]
18a7587d4b build(deps): bump rand_distr from 0.5.1 to 0.6.0 (#8148)
* build(deps): bump rand_distr from 0.5.1 to 0.6.0

Bumps [rand_distr](https://github.com/rust-random/rand_distr) from 0.5.1 to 0.6.0.
- [Release notes](https://github.com/rust-random/rand_distr/releases)
- [Changelog](https://github.com/rust-random/rand_distr/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-random/rand_distr/compare/0.5.1...0.6.0)

---
updated-dependencies:
- dependency-name: rand_distr
  dependency-version: 0.6.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Migrate main code base to rand 0.10

* Migrate tests

* Migrate benches

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: timvisee <tim@visee.me>
2026-02-25 14:15:04 +01:00
Ivan Boldyrev
9bf8369a6a Use IdTrackerEnum type instead of dyn IdTracker (#8168)
* Use `IdTrackerEnum` type instead of `dyn IdTracker`

It would allow to be more flexible on the IdTracker trait, making it
dyn-incompatible eventually.

Coauthored with Claude Code.

* Review fixes
2026-02-24 10:53:23 +01:00
Ivan Boldyrev
428f1e76d4 Batched scans for dense vectors (#7514)
* Batched iteration for plain `HNSWIndex` searches
* Batched iteration for `PlainVectorIndex` search
2025-11-20 17:34:02 +07:00
Tim Visée
3fc51c69b0 Migrate away from RocksDB based dense vector storage (#6603)
* Add function to open all appendable dense vector storage types

* Add function to find appendable dense storage files without opening it

* Add function to migrate RocksDB dense vector storage into mmap

* Add feature flag and actively migrate on load

* Log number of migrated points

* Add function to open all simple dense vector storage types

* Add test for simple dense vector storage migration

* Use correct column families

* Use more generic feature flag

* Also migrate vector deletes

* Fix review remarks
2025-06-04 17:40:13 +02:00
xzfc
44341bb78d Move filtering logic from RawScorer to FilteredScorer (#6245) 2025-04-23 18:23:25 +00:00
xzfc
a534e954ae Remove is_stopped from RawScorer (#6305)
* Introduce CancelledError

* Remove is_stopped from RawScorer
2025-04-09 10:54:42 +02:00
Jojii
bf47c97257 Measure io writes for vector upsertions (#5944)
* Add counter to vector storage API

* Measuring IO write for dense vectors

* Tests, GPU and sparse

* Measure multi vectors too

* Fix comment
2025-03-10 15:27:06 +01:00
Tim Visée
3e536347e1 Bump Rust edition to 2024 (#6042)
* Bump Rust edition to 2024

* gen is a reserved keyword now

* Remove ref mut on references

* Mark extern C as unsafe

* Wrap unsafe function bodies in unsafe block

* Geo hash implements Copy, don't reference but pass by value instead

* Replace secluded self import with parent

* Update execute_cluster_read_operation with new match semantics

* Fix lifetime issue

* Replace map_or with is_none_or

* set_var is unsafe now

* Reformat
2025-02-25 11:21:25 +01:00
Luis Cossío
af74d1b96a bump and migrate to rand 0.9.0 (#5892)
* bump and migrate to rand 0.9.0

also bump rand_distr to 0.5.0 to match it

* Migrate AVX2 and SSE implementations

* Remove unused thread_rng placeholders

* More random migrations

* Migrate GPU tests

* bump seed

---------

Co-authored-by: timvisee <tim@visee.me>
Co-authored-by: Arnaud Gourlay <arnaud.gourlay@gmail.com>
2025-01-28 16:19:11 +01:00
Jojii
e0d0e233d8 Timeout aware hardware counter (#5555)
* Make hardware counting timeout aware

* improve test

* rebuild everything

* fmt

* post-rebase fixes

* upd tests

* fix tests

---------

Co-authored-by: generall <andrey@vasnetsov.com>
2024-12-10 12:12:36 +01:00
Andrey Vasnetsov
e0d507dac7 Inference interface in REST and gRPC (#5165)
* include document & image objects into grpc API

* introduce image and object to rest api

* minor refactoring

* rename Vector -> VectorInternal

* decompose vector data structures

* add schema

* fmt

* grpc docs

* fix conversion

* fix clippy

* fix another conversion

* rename VectorInput -> VectorInputInternal

* replace grpc TryFrom with async functions

* fmt

* replace rest TryFrom with async functions

* add image and object into query rest

* separate inference related conversions

* move json-related conversions into a separate file

* move vector-related transformations into a separate file

* move more vector related-conversions into dedicated module
2024-10-09 10:15:46 +02:00
xzfc
a0ea3caccf Enable some of the pedantic clippy lints (#4715)
* Use workspace lints

* Enable lint: manual_let_else

* Enable lint: enum_glob_use

* Enable lint: filter_map_next

* Enable lint: ref_as_ptr

* Enable lint: ref_option_ref

* Enable lint: manual_is_variant_and

* Enable lint: flat_map_option

* Enable lint: inefficient_to_string

* Enable lint: implicit_clone

* Enable lint: inconsistent_struct_constructor

* Enable lint: unnecessary_wraps

* Enable lint: needless_continue

* Enable lint: unused_self

* Enable lint: from_iter_instead_of_collect

* Enable lint: uninlined_format_args

* Enable lint: doc_link_with_quotes

* Enable lint: needless_raw_string_hashes

* Enable lint: used_underscore_binding

* Enable lint: ptr_as_ptr

* Enable lint: explicit_into_iter_loop

* Enable lint: cast_lossless
2024-07-22 08:19:19 +00:00
Ivan Pleshkov
a629fc4d4c Fix hnsw full scan threshold (#4369)
* fix hnsw full scan threshold

* add test

* are you happy clippy

* separate open_vector_storage

* remove public fields from builder

* wip: do not create segment in builder before build

* avoid arc in storage test and low-level loading functions

* WIP: remove internal segment from SegmentBuilder

* fmt

* finalize segment builder fixes

* Revert "are you happy clippy"

This reverts commit c04afa6989.

* Revert "add test"

This reverts commit 8e7ad6207e.

* Revert "fix hnsw full scan threshold"

This reverts commit 8904443fcb.

* remove _daatabse from builder

* fix optimizer test

* fix id tracker versions persistence

* do flush for segment components on build

---------

Co-authored-by: generall <andrey@vasnetsov.com>
2024-06-04 11:16:11 +02:00
Arnaud Gourlay
54d28d2d53 Integrate Multivector at segment level (#3973)
* Integrate Multivector at segment level

* more tests - green with lower accuracy

* decrease expected accuracy to fix test

* cleanup test

* multivector can not be empty

* vary number of vector per multivec point
2024-04-08 12:22:24 +02:00
Andrey Vasnetsov
e090dc0fec Refactor vector storage infra to be generic over vector element type (#3900)
* make SimpleDenseVectorStorage generic against VectorElementType

* make generic loading of the simple dense storage

* move memmap_dense_vector_storage

* move mmap_dense_vectors

* move appendable_mmap_dense_vector_storage

* fmt

* move dynamic_mmap_flags

* move simple_dense_vector_storage

* move PrimitiveVectorElement

* fmt

* make MmapDenseVectors generic

* make MemmapDenseVectorStorage generic to data type

* fix UringReader on non-linux platform

* make ChunkedMmapVectors generic of the vector element type

* make AppendableMmapDenseVectorStorage generic of the vector element type

* make PrimitiveVectorElement trait even more global

* make Metric generic over vector element type and refactor it into GenericMetric

* make DenseVectorStorage generic over vector element

* remove temorary trait for migrating Metric

* make CustomQueryScorer generic against vector element type

* refactor PrimitiveVectorElement to use Cow and allow owned conversions

* Move score post-processing out of metric object

* naive implementation of metrics for byte vectors
2024-03-25 13:21:21 +01:00
Arnaud Gourlay
82ef966ad8 Remove duplicated VectorRef conversion (#3864) 2024-03-19 14:35:17 +01:00
Arnaud Gourlay
758779c3cd Use DenseVector alias where possible (#3705) 2024-02-28 10:31:16 +01:00
Jojii
c15adf5c72 allow stopping segment loading (#3498)
* allow stopping segment loading

* fix benches
2024-02-08 12:52:03 +01:00
Arnaud Gourlay
10e986bf98 Rename SimpleDenseVectorStorage (#3223) 2023-12-13 17:08:37 +00:00
Ivan Pleshkov
0607be64c9 Sparse vectors rest search and upsert (#3051)
* sparse vector sparse search and upsert

are you happy fmt

fix build

update openapi

batch changes

update openapi

named sparse vector

* review remarks

* cowvalue to cowvector
2023-11-21 09:18:15 +01:00
Ivan Pleshkov
cb917ea0db raw scorer with operation result (#2897) 2023-10-31 23:44:20 +01:00
Ivan Pleshkov
e610ab202d Use enum vector type in vector storage (#2841)
* use enum vector type in vector storage

* add to_vec_ref
2023-10-19 14:49:31 +02:00
Arnaud Gourlay
5bb80fbc77 Move ScoredPointOffset into common (#2734) 2023-09-28 12:11:29 +02:00
Luis Cossío
b25fc4c8ea Refactor batch search to allow different scorers (#2529)
* add enum for vector query on segment search

* rename newly introduced types

* fix: handle QueryVector on async scorer

* handle QueryVector in QuantizedVectors impl

* fix async scorer test after refactor

* rebase + refactor on queue_proxy_shard.rs

* constrain refactor propagation to segment_searcher

* fmt

* fix after rebase
2023-09-05 09:26:24 -03:00
Tim Visée
bce35092ed Add support for deleted vectors in segments (#1724)
* Use resize rather than while-push loop

* Add deleted flags to simple vector storage

* Add deleted flag to memmap vector storage

* Map BitSlice on mmap file for deleted flags

* Use vector specific deletion BitSlice in RawScorer

* Use BitSlice for deleted points, fix check point logic, clarify names

* Extract div_ceil function to shared module

* We can use unchecked set and replace because we just checked the length

* Add deleted count function to vector storage

* Add vector storage point deletion tests

* Keep deleted state in simple vector storage with update_from, add test

* Keep deleted state in memmap vector storage with update_from, add test

* Simplify div_ceil

* Improve deletion handling in update_from in mmap vector storage

* Improve performance, use trickery to get BitSlice view over deleted mmap

* Use BitSlice where possible, construct BitVec more efficiently

* Incorporate vector specific delete flags in quantized raw scorer

* Don't pin MmapMut, it is not required

* With quantization, keep mmap deleted flags in RAM for better performance

* Advice the kernel to prepare deleted flags mmap for faster future access

* Simplify deleted bitslice access, add bound check, remove unused function

* Fix compilation on Windows

* Cleanup

* Rename delete functions to delete_{point,vec} to prevent confusion

* Use then_some rather than match a boolean

* Lock deleted flags in memory only when quantization is available

* Add docs and stabilize issue link to dev_ceil

* Flush deleted mmap when closing segment

This requires us to to wrap the memory map struct in an Arc and Mutex.
Though this may look inefficient, it doesn't have a negative side effect
on deleted flag performance, because the flags are accessed through a
BitSlice that is separate and doesn't use locking.

* Rename some point functions to vec because that makes more sense

* Simplify delete flag fetching option, use deref func instead of asterisk

* Do not calculate slice size manually, use size_of_val

* remove test raw scorer

* use deref in check

---------

Co-authored-by: Andrey Vasnetsov <andrey@vasnetsov.com>
2023-04-20 12:06:29 +02:00
Ivan Pleshkov
faf1235333 Remove deleted flags from vector storage (#1561)
* remove deleted flags from vector storage

* remove deleted flags from mmap

* new simple vector storage format

* are you happy clippy

* remove id_tracker from raw_scorer

* revert vector storage format changes

---------

Co-authored-by: Andrey Vasnetsov <andrey@vasnetsov.com>
2023-03-15 14:05:07 +01:00
Andrey Vasnetsov
501a4b1831 add benchmark for random vector scoring 2023-03-11 23:25:18 +01:00
Ivan Pleshkov
35719c0fab Remove vector scorer trait (#1546)
* remove vector scorer

* nits

---------

Co-authored-by: Andrey Vasnetsov <andrey@vasnetsov.com>
2023-03-11 20:13:24 +01:00
Ivan Pleshkov
84e6cd8290 Vector storages enum (#1533)
* separate scoring and data containing

* vector storage enum

* fix test build

* are you happy clippy

* review fixes
2023-03-09 09:43:20 +04:00
Ivan Pleshkov
f6b2186193 [WIP] Many named vectors per point (#958)
* many named vectors per point (segment-level)

* operation result for dim function

* beautifulized vector name

* fix naming bug

* segment version migration

* fmt

* add segment tests

* are you happy clippy

* fix build

* [WIP] many named vectors per point (collection-level) (#975)

* config and search

* fix placeholders for proxy segment move

* remove VectorType from collection

* are you happy fmt

* vectors in grps messages

* create collections with vectors

* segment holder fixes

* are you happy fmt

* remove default vector name placeholders

* are you happy fmt

* are you happy clippy

* fix build

* fix web api

* are you happy clippy

* are you happy fmt

* record vector&vectors

* openapi update

* fix openapi integration tests

* segment builder fix todo

* vector names for update from segment

* remove unwrap

* backward compatibility

* upd openapi

* backward compatible PointStruct

* upd openapi

* fix record back-comp

* fmt

* vector configuration backward compatibility

* fix vetor storage size estimation

* fmt

* multi-vec segment test + index test

* fmt

* api integration tests

* [WIP] Named vectors struct (#1002)

* move to separate file

* named vectors as struct

* use cow

* fix build

* keys iterator

* avoid copy in PointStruct -> get_vectors

* avoid another copy

Co-authored-by: Andrey Vasnetsov <andrey@vasnetsov.com>

Co-authored-by: Andrey Vasnetsov <andrey@vasnetsov.com>
2022-09-11 20:59:23 +02:00
Ivan Pleshkov
f9fb0777a0 Wrap rocksdb column usages (#951)
* wrap rocksdb column usages

* remove obsolete comments

* are you happy clippy
2022-08-22 09:41:08 +02:00
Russ Cam
8e1f2ca353 Use tempfile (#922)
This commit replaces tempdir with tempfile.
tempdir is archived.

Closes #544
2022-08-10 09:39:21 +02:00
Egor Ivkov
026bd040b0 Add import formatting rules (#820)
* Add import formatting rules

* Review fix: update rusty hook
2022-07-15 15:42:25 +03:00
Ivan Pleshkov
effb79733d Unite rocksdb of segment (#585)
unite rocksdb for segment
2022-05-13 17:06:07 +04:00
Ivan Pleshkov
a91e77b824 fix segment benches 2022-03-09 21:40:16 +00:00
Ivan Pleshkov
2c4fd0a205 Merge branch 'master' into remove-blas 2022-03-09 15:48:25 +00:00
Prokudin Alexander
ee461ce0a6 Extend clippy to workspace and fix some warnings (#199)
* Fix clippy in linting workflow

* Add toolchain override flag

* Add components to toolchain installation explicitly

* Add --workspace flag to clippy to check all packages

* Remove unnecessary clones

* remove redundant .clone() calls

* fix wrong arguments order in tests (typo)

* Fix vec! macro usage in test

* Correct redundant assert! usages

* Provide a quick fix for 'unused' test function lint

* fix unsound Send + Sync

* fix clippy complains

* fmt

* fix clippy

Co-authored-by: Andrey Vasnetsov <andrey@vasnetsov.com>
2022-01-17 23:33:26 +01:00
Ivan Pleshkov
297f54141d remove blas 2022-01-03 22:16:27 +03:00
Ivan Pleshkov
bcaa160ad8 Remove dyn Metric from vector storage and use generics (#163)
* Remove dyn Metric from vector storage and use generics

* upd benchmark code

* fix benchmark usage

* fmt

Co-authored-by: Andrey Vasnetsov <andrey@vasnetsov.com>
2021-12-31 09:38:33 +01:00
Marcin Puc
c1a790a7af Add more refactorings (#122) 2021-11-12 19:16:00 +01:00
Marcin Puc
fdcc4fa674 Fix ndarray imports in segment benches (#121) 2021-11-11 10:42:27 +01:00
Marcin Puc
c603f0075e Add various refactorings (#118) 2021-11-10 21:32:25 +01:00
Konstantin
93e0fb5c2c [CLIPPY] Fix the last portion of rules and enable CI check (#53)
* [CLIPPY] Fixed the warning for references of the user defined types

* [CLIPPY] Fix module naming issue

* [CLIPPY] Fix the last set of warnings and enable clippy check during CI

* Moved cargo fmt and cargo clippy into it's own action
2021-07-03 13:12:21 +02:00
Konstantin
a667747369 Applied and enforced rust fmt code formatting tool (#48)
* Apply cargo fmt command

* Enabled cargo fmt on build
2021-06-29 10:17:50 +02:00
Andrey Vasnetsov
3616631300 Filtrable hnsw (#26)
* raw points scorer

* raw point scorer for memmap storage

* search interface prepare

* graph binary saving + store PointOffsetId as u32

* WIP: entry points

* connect new link method

* update libs + search layer method + visited list + search context + update rust

* implement Euclid metric + always use MinHeap for priority queue

* small refactor

* search for 0 level entry

* update visited pool to be lock free and thread safe

* use ef_construct from graph layer struct + limit visited links to M

* add metric pre-processing before on vector upsert

* old hnsw heuristic

* save hnsw graph for export

* search method + tests

* small fixes

* add benchmark and profiler

* build time optimizations

* use SeaHash

* remove unsed benchmark

* merge hnsw graph function

* WIP:HNSW index build function

* HNSW build_index with additional indexing

* refactor fixtures

* graph save and load test

* test and fixes for filterable HNSW

* enable hnsw index for query planning

* fix cardinality estimation tests + remove query planner as class

* small refactor

* store full copy of collection settings with collection + allow partial override on creation #16

* API for updating collection parameters #16

* refactor: move collection error -> types

* report collection status in info API #17

* update OpenAPI Schema
2021-05-30 17:14:42 +02:00
Andrey Vasnetsov
8a85c10934 use BLAS for vector dot production 2021-01-04 22:59:22 +01:00
Andrey Vasnetsov
bd7ed06bfe add benchmark for vector similarity speed comparasion 2021-01-03 01:25:41 +01:00