Commit Graph

61 Commits

Author SHA1 Message Date
Jojii
42fd2e27e2 Strict mode max collection vector size (#5501)
* Strict mode config: Max collection size

* api specs

* Add tests + set/update payload check

* Improve function names and add comments

* rename config to separate vectors and payload

* fix tests

* Adjust configs docs

* add benchmark

* improve performance by caching shard info

* add bench for size_info() and fix tests

* Also limit the batch-size for vector updates (#5508)

* Also limit the batch-size for vector updates

* clippy

* add lost commit

* Load cache on collection initialization

* add unit type to parameter name

* fix renaming in test

* clearer error message

* fix test

* review remarks

* remove unused function for now

---------

Co-authored-by: Arnaud Gourlay <arnaud.gourlay@gmail.com>
2024-12-05 17:28:09 +01:00
Tim Visée
a4cd7258af Fix panic on query with huge limit (#5484)
* Limit maximum preallocation on search results aggregator hash set

Prevents an allocation failure and panic if a user specifies a huge
search limit.

* Prevent overflow on fixed length priority queue limit with u64::MAX

* Fix overflow with high limit in search API

* Add two basic tests covering high search limit
2024-11-19 20:53:05 +01:00
Jojii
5417428951 Add max upsert batch size strict mode option (#5485) 2024-11-19 19:06:57 +01:00
Predrag Knezevic
9d67c6325b Test collections unique per openapi test module (#5384)
Collection name under test is equal to the test module name, without `.py` suffix.

* Helps by debugging/tracing failed tests and find relevant logs lines in qdrant log files
* Opens up a possibility to run tests in parallel, given that there are no data sharing
  between test modules

Change details:
* defined module scoped `collection_name` fixture in `conftest.py`
* removed `collection_name` module variable
* each test signature modified to declare the dependency to `collection_name` fixture
* `@pytest.mark.parametrize` migrated to `@pytest-cases.parametrize` in cases when
  `collection_name` was used as the value
2024-11-06 20:09:31 +01:00
Predrag Knezevic
6790e83336 Retry collection delete in test teardown (#5364)
Although test logic passes the assertions, the test might fail
if during the teardown the created collection is not deleted,
because the client could not reach the database due to networking issue.

In order to make test executions more robust, collection deletes
are retried in case of networking issues.
2024-11-05 00:44:11 +01:00
Tim Visée
fedebbbf0e Fix immutable map index mishandling point deletions (#5346)
* Fix search and delete using subslice index, rather than container intex

* Add sanity checks in debug assertions

* test

---------

Co-authored-by: generall <andrey@vasnetsov.com>
2024-11-01 19:57:22 +01:00
Predrag Knezevic
3a01ef3943 Add wait=true in openapi test for all point delete calls transparently (#5348)
If `wait=true` param is not set for delete vector API calls, a test asserting later
that data are gonna can become flaky, because at the assertion time the data could be
still there.

The following files contain such tests at the moment:
* `test_multi_vector_uint8.py`
* `test_multi_vector.py`
* `test_multi_vector_unnamed.py`
* `test_optional_vectors.py`

In order to fix these and prevent the flakiness of future test,
`request_with_validation` helper add `wait=true` param, if it is not set
for delete vector calls.
2024-11-01 18:12:59 +01:00
Predrag Knezevic
7fef49af03 Enable running integration tests against non-localhost available instance (#5345)
* `QDRANT_HOST` variable is used by all openapi tests, removed its copies from
  `test_multi_vector_uint8.py`, `test_multi_vector_unnamed.py`, `test_query.py`,
  `test_shard_snapshot.py`, and `test_snapshot.py`
* Added optional `QDRANT_HOST_HEADERS` env variable to set custom HTTP headers
  in order to reach Qdrant instance behind a reverse proxy. The content of the
  variable is JSON payload, e.g. `{"host": "qdrant.local"}`
* Adapted `./tests/basic_*.sh` scripts to aware of `QDRANT_HOST_HEADERS` env variable
2024-10-31 18:30:41 +01:00
Andrey Vasnetsov
633d996e61 HasVector filtering condition (#5303)
* include vector storage into struct vector index

* implement has_vector

* generate schemas

* refactor query filter optimizer so avoid too many function arguments

* test + fix for sparse vectors

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

Co-authored-by: Jojii <15957865+JojiiOfficial@users.noreply.github.com>

* Update lib/segment/src/index/query_optimization/optimizer.rs

Co-authored-by: Jojii <15957865+JojiiOfficial@users.noreply.github.com>

* fmt

---------

Co-authored-by: Jojii <15957865+JojiiOfficial@users.noreply.github.com>
2024-10-25 18:47:03 +02:00
Jojii
27883dbb41 Add strict mode config to update collection API + Populate strict mode in API (#5187)
* add strict mode to update collection API

* update API specs

* clippy

* Update lib/storage/src/content_manager/toc/collection_meta_ops.rs

* Strict mode integration tests (#5189)

* Add integration tests for strict mode

* add full update test

* Apply suggestions from code review

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

* Adjust error messages

* improve checking of error response

---------

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

* prefer explicit structu conversion

---------

Co-authored-by: Tim Visée <tim+github@visee.me>
Co-authored-by: generall <andrey@vasnetsov.com>
2024-10-14 10:27:00 +02:00
Jojii
b94d02ad30 Add error handling if vector is missing for point (#5211)
* add error handling for missing vectors

* add integration test

* add call without specifying 'using' parameter
2024-10-10 12:48:34 +02:00
Luis Cossío
045779233a Facets: Support for bool payload (#5100)
* enable faceting with boolean index

* test and fix

* also test uuid
2024-10-01 09:17:50 -03:00
tellet-q
ec35d9ef3d Add tests on uuid payload index queries with filters (#4971)
* Add on_disk:True for uuid index schema check

* Add tests for uuid payload index

* Fix test

* Add test comparing filtered queries between keyword index and uuid index

* Remove order by case

* Clean up
2024-08-29 13:03:48 +02: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
Arnaud Gourlay
caeb262e86 Search distance matrix REST API (#4884)
* Search distance matrix REST API

* apply Validator upgrade

* min sample size is 2 thanks Luis

* review: rethink pair view

* remove rows-based similarity matrix output

* fmt

* upd openapi

* we have only 70 apis now

---------

Co-authored-by: generall <andrey@vasnetsov.com>
2024-08-19 00:21:55 +02:00
Arnaud Gourlay
c8844388d7 Update Validator 0.18 (#4894)
* Update Validator 0.18

* fix new test error message

* clearer geo error message

* fix error message

* fix unit tests

* Put spaces back

---------

Co-authored-by: timvisee <tim@visee.me>
2024-08-15 15:22:51 +02:00
xzfc
50f0a6a4d4 Test payload schemas (#4822)
* test: don't parametrize test_payload_indexing.py with on_disk_vectors

* test: add test_payload_schemas()
2024-08-05 11:41:04 +02:00
xzfc
e58dbbb5be chore: move tests/openapi/openapi_integration/* → tests/openapi/* (#4820) 2024-08-03 21:44:22 +02:00
Natanael Mojica
112df0ae18 Refactor: Convert app and cluster info metrics from counters to gauges #4696 (#4733)
* Refactor: Convert app and cluster info metrics from counters to gauges

- Change app_info, app_status_recovery_mode, and cluster_enabled metrics from COUNTER to GAUGE
- Update metric values to use boolean as f64 for consistency and clarity
- Improve metric type accuracy for better representation of state information

* fix: Update docs regarding metrics type

* openapi: Update app_info metric type

* metrics: Update test to check for the right metric type
2024-07-24 08:39:24 +02:00
Luis Cossío
6fd0bf7643 universal-query: Expose random sampling query (#4657)
* expose random sampling query

* fix random query rescoring

* only ignore offset when there are no prefetches

* fix offset and with_payload/with_vector

* gen grpc docs

* make tests less flaky

* gen openapi schema

* Remove suffixed spaces

---------

Co-authored-by: timvisee <tim@visee.me>
2024-07-22 16:13:00 -04:00
Arnaud Gourlay
eef7e37e33 universal-search: Query group API should support lookup_from (#4706)
* universal-search: Query group API should support lookup_from

* sync docs
2024-07-19 15:45:19 +02:00
Luis Cossío
27e28cd393 universal-query: Distribution-Based Score Fusion (#4614)
* refactor fusion into method

* expose distribution-based score fusion

* gen openapi and docs

* Better rest description

* add basic integration test
2024-07-12 08:11:59 -04:00
Arnaud Gourlay
bb9f9f8e94 universal-query: Grouping REST API (#4616)
* universal-query: Grouping REST API

* add API docs

* bump API count

* add jwt validation test

* fix API

* better test

* stay on CoreSearchRequest where possible

* use existing scoring helper

* push broken test to illustrate issue

* track best score per point_id to enable sort on payload

* add example test for query discover with groups

* track ScoredPoint instead of PointId

* add default values for smoother ux
2024-07-10 08:26:57 +02:00
xzfc
cf08ac68dc Switch to poetry (#4518)
* Use poetry for openapi tests

* Use poetry for consensus tests

* Use poetry for gen_storage_compat_data/populate_db.py

* Make consensus_tests scripts executable

* Use poetry for test-consensus-compose

* Cleanup

* Don't call poetry run in scripts
2024-07-08 18:17:43 +00:00
Luis Cossío
b572171145 universal-query: handle score threshold at collection level (#4630) 2024-07-08 10:48:34 -04:00
Luis Cossío
f5ccca039a universal-query: resolve offset at collection level only (#4611)
* resolve offset at collection level only

* update test

* remove offset field from `QueryScrollRequest` and `RescoreParams`
2024-07-04 08:57:05 +02:00
Arnaud Gourlay
7c689f09db universal-query: lookup_from implementation (#4508)
* universal-query: lookup_from implementation

* pushin test demonstrating broken equivalence

* more tests and fixes

* validate fusion not use with 'using' field

* cleanup collection info propagation

* do not clone the query in CollectionQueryResolveRequest

* cleanup

* address last code review
2024-06-25 20:42:54 +02:00
Arnaud Gourlay
ee3655a355 Fix discovery API id exclusion and lookup (#4553)
* Fix discovery API id exclusion and lookup

* do not generate a filter if there are no ids to exclude
2024-06-25 16:19:41 +02:00
Ivan Pleshkov
8cab109978 Avg multivector (#4542)
* avg multivector

* integration test

* remove unwrap
2024-06-25 14:15:15 +02:00
Arnaud Gourlay
f7f4ba2592 Fix id exclusion when recommending from a different collection (#4551)
* Fix id exclusion when recommanding from a different collection

* add line at eof
2024-06-25 10:54:22 +02:00
Arnaud Gourlay
7c4809e1d3 universal-query: Add validations to query input (#4536)
* universal-query: Add validations to query input

* update openapi spec

* use raw request to by-pass local validations

* add validation for order_by and factorize
2024-06-24 16:56:36 +02:00
Luis Cossío
46b9ea44ec order_by: Begin migration to order_value in Record [v1.10] (#4526)
* begin migration to order_value

* gen openapi and grpc docs

* cargo clippy --fix

* fixup
2024-06-24 14:25:50 +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
Luis Cossío
d107aee6b7 Add layer of response structure specific to query (#4498) 2024-06-19 08:31:39 +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
Luis Cossío
44ccd7826d use get instead of indexing (#4496) 2024-06-18 10:27:24 -04:00
Luis Cossío
8839711686 Skip serializing null fields in Record and ScoredPoint (REST) (#4394)
* skip serializing null fields in Record and ScoredPoint

* update tests

* fix consensus tests
2024-06-18 09:27:19 -04:00
Arnaud Gourlay
c14d988514 universal-query: API testing with multi named vectors (#4463)
* universal-query: API testing with multi named vectors

* more filtering tests

* test rff with filter

* inner filter equivalence

* add more test cases
2024-06-13 20:48:56 +02:00
Andrey Vasnetsov
3e4c6dc0d3 Fix inplace updates for sparse index (#4375)
* include old vector into update function and clean posting lists accordingly

* add integration test

* fix counter

* also remove old vector if the insertion is empty

* clippy

* borrow once

* fix max_next_weight correcton on delete + test

* vector index responsible for updating vector storage

* review fixes

* add debug assert
2024-06-12 12:13:49 +02:00
Luis Cossío
f62119c670 universal-query: Basic integration tests (#4409)
Adds basic comparison to current existing endpoints
2024-06-10 19:50:33 -04:00
Arnaud Gourlay
1d5f5a0783 Bump Python Request 2.23 (#4281) 2024-05-21 10:58:12 +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
AMIR
0ee46a5c1c Simplify REST API nesting (#3323) (#3414)
* Simplify REST api nesting (#3323)

* tiny clarity refactor for test

* simpler generated openapi

* fix tests

* wrap deserializer functions into a struct impl

* fix null case

---------

Co-authored-by: Luis Cossío <luis.cossio@outlook.com>
2024-05-13 16:16:35 -04:00
Luis Cossío
71159e5cdd setup for faster openapi snapshot tests (#4219) 2024-05-10 20:26:24 +02:00
Arnaud Gourlay
802c3ebbe5 Test Multivector storage mmap and uint8 (#4197) 2024-05-08 11:57:34 +02:00
dependabot[bot]
7e0cf40605 Bump werkzeug from 3.0.1 to 3.0.3 in /tests/openapi (#4189)
Bumps [werkzeug](https://github.com/pallets/werkzeug) from 3.0.1 to 3.0.3.
- [Release notes](https://github.com/pallets/werkzeug/releases)
- [Changelog](https://github.com/pallets/werkzeug/blob/main/CHANGES.rst)
- [Commits](https://github.com/pallets/werkzeug/compare/3.0.1...3.0.3)

---
updated-dependencies:
- dependency-name: werkzeug
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-08 11:11:03 +02:00
Arnaud Gourlay
571143ae87 Simplify MaxSim configuration (#4171)
* Simplify MaxSim configuration

* enable extension of multivectorconfig

* rename multi_vec_config to multivec_config
2024-05-06 14:19:42 +02:00
Arnaud Gourlay
4f797c1bb4 REST API multivector for write and retrieve (#4117)
* REST API multivector for write and retrieve

* add test showing search is not supported

* use helper

* debug asserts

* better naming

* iterator style

* better naming

* add validation test for checking all inner vectors have the same size
2024-05-03 10:55:17 +02:00
Andrey Vasnetsov
c173a9f5e5 Sparse idf dot (#4126)
* introduce QueryContext, which accumulates runtime info needed for executing search

* fmt

* propagate query context into segment internals

* [WIP] prepare idf stats for search query context

* Split SparseVector and RemmapedSparseVector to guarantee we will not mix them up on the type level

* implement filling of the query context with IDF statistics

* implement re-weighting of the sparse query with idf

* fmt

* update idf param only if explicitly specified (more consistent with diff param update

* replace idf bool with modifier enum, improve further extensibility

* test and fixes

* Update lib/collection/src/operations/types.rs

Co-authored-by: Arnaud Gourlay <arnaud.gourlay@gmail.com>

* review fixes

* fmt

---------

Co-authored-by: Arnaud Gourlay <arnaud.gourlay@gmail.com>
2024-04-29 14:54:14 +02:00
Andrey Vasnetsov
20eb2e1f2f remove usage of vectors_count (#4052)
* remove usage of vectors_count

* skip serialization if none

* add deprecated mention

* Add colon after deprecation note

---------

Co-authored-by: timvisee <tim@visee.me>
2024-04-18 15:22:01 +02:00