Commit Graph

211 Commits

Author SHA1 Message Date
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
761069bc0a Restore SnapshotFormat::Streamable snapshots (#5179) 2024-10-04 16:39:56 +00:00
xzfc
bc2104604c Introduce SnapshotFormat (#5175) 2024-10-04 16:09:30 +00:00
xzfc
7932286709 Update tar_ext::BuilderExt (#5112)
* tar_ext::BuilderExt: generalize and add drop workaround

- Generalize: instead of taking `std::fs::File`, take
  `impl Write + Seek`.
- Add a workaround for drop: `tar::Builder<W>::drop` might panic if the
  underlying writer panics when using in async context.

* Drop unnecessary write_fn usage

* tar_ext::BuilderExt: support both seekable and streaming variants

* tar_ext::BuilderExt: support both owned/borrowed variants
2024-10-04 14:10:09 +00:00
Luis Cossío
025f4e3066 Expose on_disk text index (#5074)
* map index: fix reachable code marked as unreachable

* plumber work to get mmap text index to interfaces

* test: add fixture for mmap text index, always create mmap segment

* various fixes

- ensure dir is created for mmap
- implement is_on_disk() for text index
- invert deleted condition for filter in mmap inverted index

* update grpc docs and openapi

* implement return of files

* review nit

* fix after rebase

---------

Co-authored-by: generall <andrey@vasnetsov.com>
2024-09-16 21:27:30 +02:00
Arnaud Gourlay
ea6376feb1 Rename payload storage operations for consistency (#5087) 2024-09-16 12:42:11 +02:00
xzfc
a6400138f8 Direct snapshot creation (#5061) 2024-09-12 19:39:15 +00:00
Arnaud Gourlay
b2d22c9792 Remove unecessary clippy allow deadcode (#5033) 2024-09-06 12:04:49 +02:00
Luis Cossío
b49e416382 Integer and UUID facets (#4946)
* move FacetIndex into facet_index.rs

* add support for integer facets

* add support for uuid facets

* use separate internal structure

* rename FacetValue::Keyword into FacetValue::String in REST

* fix after rebase
2024-08-27 11:30:57 -04:00
Andrey Vasnetsov
abd51d984a Implement better handling of UUID index (#4961)
* rename keyword -> string for internal data structures

* implement MatchAny and expect for filter on UUID mmap index

* implement MatchAny and expect for cardinality estimation on UUID mmap index

* refactor PayloadFieldIndex filter for handling incorrect empty query parsing case
2024-08-27 00:53:30 +02:00
Luis Cossío
cd8d882dc8 perf: Limit bad performance of filtered faceting (#4903) 2024-08-20 10:12:20 -04:00
Luis Cossío
99f6d99fba Exact facet mode (#4878) 2024-08-19 23:21:17 -04:00
Luis Cossío
045fb7038c Facets in REST (#4848)
* rename to FacetRequestInternal

* add rest endpoint

* fix correctness by fetching the whole list of values

* fix mmap map index variant

Also removes test for sorted output, for now

* add ytt spec

* fix clippy

* use hashmap inside of local shard

* rename operation to `facet`, add access test

* whitelist endpoint

* change api

* make limit optional
2024-08-19 16:03:26 -04:00
Andrey Vasnetsov
6e0086b6c2 make range and lookup params optional (#4905) 2024-08-19 10:52:27 +02:00
Ivan Pleshkov
07c25f00f1 fix mmap field index snapshot (#4847) 2024-08-07 15:40:10 +02:00
Arnaud Gourlay
2fcb4c2452 Make scroll cancellable (#4827)
* Make scroll cancellable

* comments and fix

* better comment
2024-08-05 19:05:45 +02:00
xzfc
7bbb7eed36 Integration tests for on-disk payload indices (#4819)
* refactor: let SegmentBuilder::update take unlocked segments

* style: split long lines

* refactor: introduce TestSegments

* test: add tests for mmap indices
2024-08-03 22:00:03 +02:00
Luis Cossío
ba43d16880 Support timeout in Facets (#4792)
* nits in segments_searcher

* implement timeout into segment faceting

* Add timeout to internal service api

* refactor iterator_ext, and add test
2024-08-02 12:57:20 -04:00
Jojii
5602b618ce Rename tenant to principal for float,int,datetime (#4789)
* Rename tenant to principal for float,int,datetime

* Apply review proposal
2024-07-31 17:09:52 +02:00
Luis Cossío
ebad154f92 Facets in segment (#4753)
* faceting in segment

* Add segment integration test

* nits

* count from filtered stream, not value->points map directly

* drop AtomicRef from fn signature

* count only unique values per point

* use entry in hashmap

---------

Co-authored-by: generall <andrey@vasnetsov.com>
2024-07-30 13:18:19 -04:00
xzfc
26b0f08455 Tidy up integration tests (#4756) 2024-07-26 21:28:37 +02:00
xzfc
9e6a83e60a Add {Integer,Float,Datetime}IndexParams::on_disk to the API (#4755)
* Add {Keyword,Integer,Float,Datetime}IndexParams::on_disk to the API

* Add PayloadFieldSchema::is_on_disk()
2024-07-26 10:12:35 +00:00
Jojii
7432ece2f9 remove testing non-defragmented segments for non-defragmentation (#4734) 2024-07-23 10:47:13 +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
Jojii
68373fb600 Basic defragmentation (#4610)
* sorting

* migrate tests and move logic into SegmentBuilder

* add test and improve implementation

* improve code

* review

* code review improvements

* add index building to test

* Do not clone ranges

* Resolve clippy warnings due to recent PR on dev

* review suggestions

* Defragmentation in api (#4684)

* add tenant config to api

* deduplicate used defragmentation keys

* rename is_tenant to is_primary

* use all values to defrag key

* rename is_primary -> is_tenant

* update schema

---------

Co-authored-by: generall <andrey@vasnetsov.com>
Co-authored-by: timvisee <tim@visee.me>
2024-07-18 11:43:56 +02:00
xzfc
69b63baa07 Drop JsonPathString (#4621)
* drop some code

* Drop JsonPathString

* Fix test_remove_key

Drop failing tests:
- Deleting array indices is not idempotent, so we don't support it.
- Empty JSONPath is not supported.

* Make json_path::path() non-generic

* Remove references to JsonPathV2

* Drop JsonPathInterface

* Move json_path::v2 code into json_path

* Drop validate_not_empty

* Drop JsonPath::head() as being unused

* Replace path() with JsonPath::new()

* Restore comments

* Move tests to json_path

* Use json() consistently in tests

* Replace many into calls with Into trait

---------

Co-authored-by: timvisee <tim@visee.me>
2024-07-11 04:06:40 +00:00
Roman Titov
e251cb84fd Merge pull request #4620
* Add `force` flag to `SegmentEntry::flush` and `ShardHolder::flush_all…
2024-07-08 15:58:19 +02:00
xzfc
7b8ac92208 Extend PayloadSchemaParams to every PayloadSchemaType (#4613)
* Move IntegerIndexType and TextIndexType into a common file

* Formatting

* Extend PayloadSchemaParams to every PayloadSchemaType
2024-07-05 12:09:31 +00:00
xzfc
58a15c985f Set USE_COMPRESSED to true (#4575)
* Set USE_COMPRESSED to true

* Switch to using compressed posting lists in tests
2024-06-27 14:09:02 +00:00
xzfc
b9c0bd0f7d Drop SparseVectorIndexDatatype in favor of VectorStorageDatatype (#4541)
* Drop SparseVectorIndexDatatype in favour of VectorStorageDatatype

* Split Datatype doc for VectorParams and SparseIndexParams
2024-06-24 19:27:34 +02:00
xzfc
cde39fb8a2 Move build_index out of VectorIndex (#4490)
* Move build_index out of VectorIndex

* Build index in HNSWIndex::open()

* Introduce HnswIndexOpenArgs

* Proper deletion

* Improve tests

* HNSW::open(): add warn, comment and assert

* Revert to making up the config if it does not exist
2024-06-24 14:44:34 +02:00
Andrey Vasnetsov
d4807dcc8b Api consistency update (#4533)
* rename search_params -> params

* rename multivector_config + generate schema

* upd tests
2024-06-23 23:56:42 +02:00
Andrey Vasnetsov
1878713679 Fix multivector for unnamed vectors (#4482)
* minor conversion improvement

* use NamedVectors in update_vectors

* remove merge from VectorStruct

* rename Multi -> Named in vector struct

* add multi-dense vectors option into VectorStruct

* generate openapi

* rename VectorStruct -> VectorStructInternal

* add conversion for anonymous multivec in grpc

* renames for BatchVectorStruct

* implement multi-dense for batch

* allow multi-dense in batch upserts

* test and fixes
2024-06-18 20:38:24 +02:00
xzfc
53e883ea48 Add datatype option for sparse vector index (#4454)
* Add SparseVectorIndexDatatype

* Update tests

* Review fixes

* review

* gen openAPI

---------

Co-authored-by: generall <andrey@vasnetsov.com>
2024-06-18 13:32:06 +00:00
Ivan Pleshkov
3ed43b50e8 fix building cancellation flaky test (#4477) 2024-06-18 10:14:36 +02:00
xzfc
05ff867ff3 Integrate compressed posting list (attempt 2) (#4453)
* Rename InvertedIndex* -> InvertedIndexCompressed*

* Extract method VectorIndexEnum::fill_idf_statistics

* Extend VectorIndexEnum with new variants

* Introduce sparse::InvertedIndex::Version

* Replace SparseVectorIndexVersion -> InvertedIndex::Version

* Introduce sparse_vector_index::OpenArgs

* SparseVectorIndex::open: do not build index if directory is empty

Otherwise it would build the index twice since `SegmentBuilder::build()`
calls `::open()`, then `::build_index()`. This restores the old (<=v1.9)
behavior.

* Renames
2024-06-17 14:41:38 +02:00
Ivan Pleshkov
61cfb8bcb5 Test fix segment builder for sparse (#4397)
* test fix segment builder for sparse

* are you happy fmt
2024-06-05 13:52:08 +02: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
Luis Cossío
57aee5addf universal-query: Impl of query_internal in collection (#4331)
* move ScoredPointTies to segment, make inner by reference

* `query_internal` implementation

* remove empty utils mod

* use `then_with`

* Improve readability, remove duplicated code

* refactoring suggestions

* don't collect eagerly

* remove unused import

* dont panic on empty transpose input

---------

Co-authored-by: generall <andrey@vasnetsov.com>
2024-05-31 08:56:06 -04:00
Ivan Pleshkov
912e081bff Mmap for quantized multivector offsets (#4354)
* mmap for quantized multivector offsets

* resolve save vector

* fmt

---------

Co-authored-by: generall <andrey@vasnetsov.com>
2024-05-30 14:56:58 +02:00
xzfc
f026fc8a42 Recreate sparse vector index (#4313)
* Recreate sparse vector index

* Rename index file; add simple migration
2024-05-29 17:04:17 +00:00
Ivan Pleshkov
ef1a8b8f55 Use correct vector storage size (#4312)
* use correct vector storage size

* remove dim from segment entry

* are you happy fmt

* codespell and proportions

* remove obsolete comment

* remove `try_vector_dim`

* are you happy fmt

* remove todo

* revert code of conduct

* check div 0

* Simplify a bit with max iterator

* Update lib/segment/src/index/hnsw_index/hnsw.rs

Co-authored-by: Tim Visée <tim+github@visee.me>

* are you happy fmt

* Update lib/segment/src/index/plain_payload_index.rs

Co-authored-by: Tim Visée <tim+github@visee.me>

* review fix

* set full scan threshold 0 for test

* use u128 also for multivector storages

* fix sparse vector size calculation

* Move size calculation into if-branch

---------

Co-authored-by: timvisee <tim@visee.me>
Co-authored-by: Tim Visée <tim+github@visee.me>
2024-05-28 16:38:56 +02:00
Ivan Pleshkov
93ed4ab5c8 Multidense vectors quantization (#4202)
* quantized multivector definition

new multiquantization scorers

encode query

maxsim for quantized vectors

remove obsolete todo

reuse existing scorers

create multivector quantized storage

save load offsets

add test

fix vectors count

tempopery disable test while debugging

fix tests

fix build

less static lifetimes

less static lifetimes

fix build

* fix build after rebase

* add persistence test

* fix codespell

* increase accuracy in tests

* review remarks

* add comment references

* are you happy codespell

* don't use bincode
2024-05-28 12:36:09 +02:00
Andrey Vasnetsov
d4dc0f3f42 allow reading of the non-existent sparse vector same way we allow dense (#4322) 2024-05-24 21:42:38 +02:00
xzfc
93a42b4e2d Compressed posting lists (#4253) 2024-05-22 18:18:20 +00:00
Ivan Pleshkov
a68965f05a Fix wrong multivectors count in storage (#4283)
* fix wrong multivectors count in storage

* add test
2024-05-21 12:27:07 +02:00
xzfc
ccf7f1d24f InvertedIndexImmutableRam and index migrations (#4220)
* Move StorageVersion from segment crate to common/io

* Refine StorageVersion API

* Move methods from SparseVectorDataConfig to enum SparseIndexType

* Introduce InvertedIndexImmutableRam

* Add migrate

* Don't migrate
2024-05-16 06:47:47 +00:00
Luis Cossío
bfa72bb6d8 universal-query: Add query() to ShardOperation trait (#4210)
* add `query` to shard trait

* add missing conversions for query

* update grpc docs

* Query response has intermediate results

* add ShardQueryResponse description

* move pub use to the top, keep only one way of reaching reexports
2024-05-15 09:36:46 -04:00
Ivan Pleshkov
e80844969f Float16 integration and API (#4234)
* f16 integration

tests

api

fix test

are you happy clippy

* fix build
2024-05-15 10:36:55 +02:00
Arnaud Gourlay
86ca51aa2d Allow basic multivec search on legacy API (#4203)
* Allow multivec search on legacy REST API

* show that it works for gRPC as well

* better error message

* update error assertion

* show validation on REST as well

* remove unecessary test

* fix conversion - dim is not vec count

* fmt

* Use TypedMultiDenseVectorRef everywhere (#4224)

* Use TypedMultiDenseVectorRef everywhere

* remove obsolete test

* fix codespell

* fix build

* test single dense vector expansion on upsert

---------

Co-authored-by: Ivan Pleshkov <pleshkov.ivan@gmail.com>
2024-05-14 17:54:11 +02:00