Commit Graph

72 Commits

Author SHA1 Message Date
eltu
aa0f49798e Full-Text Index ASCII Folding (Normalization) (#7408)
* Add ASCII folding to tokenization process

Introduced an optional ASCII folding feature within the `TokensProcessor` to normalize non-ASCII characters to their ASCII equivalents. Updated tests and documentation to reflect the changes.

* Refactor tokenization code for improved readability and maintainability

Reorganized and reformatted the tokenization module, including `TokensProcessor` initialization and ASCII folding mappings for better clarity. Updated tests to align with the changes.

* Update test cases to reflect optional tokenizer settings changes

Adjusted `ascii_folding`, `lowercase`, and `phrase_matching` settings in tests to `None` where applicable, aligning with updates in tokenizer configuration defaults.

* address review remarks

* fix codespell

* thx coderabbit

* Don't copy tokens that are already ASCII

* Shrink folded string to fit

---------

Co-authored-by: Luis Cossío <luis.cossio@outlook.com>
Co-authored-by: timvisee <tim@visee.me>
2025-10-16 13:53:01 +02:00
Andrey Vasnetsov
e86d60e6b0 slow requests log (#7188)
* wip: generalization trait for queries

* implement generalization for point operations

* fmt

* log priority queue

* wip: SlowRequestsListener

* fmt

* fix clippy

* simplify generalization

* fmt

* implement collection of requests profiles for update API

* implement API for viewing slow requests log

* add collection name to update worker

* add datetime to log

* fmt

* probabilistic counter of unique requests

* rename

* compute hash before converting into json value

* move logable out of generalizable

* fmt

* log query request

* fmt

* some fixes

* move measurement into local shard

* fmt

* upd openapi (not important)

* For enum variants, has discriminant

* Make SearchParams Copy

* Hash 0.0 and -0.0 the same

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Correctly hash enum variants and float values

* Hash through ordered float instead

* Fix priority queue not keeping longest request for hash

* SearchParams implements Copy

* Fix clippy warning

* Add unordered_hash_unique

* skip serialization if none

* Use OrderedFloat for hashing a float

* Use OrderedFloat for hashing a float

* only log updates if they are performed

---------

Co-authored-by: timvisee <tim@visee.me>
Co-authored-by: Tim Visée <tim+github@visee.me>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: xzfc <xzfcpw@gmail.com>
2025-09-19 19:59:25 +02:00
xzfc
23dd2bbbfb shell.nix: switch to rustup (#7049)
* shell.nix: npins upgrade

* shell.nix: bump to rust 1.89

* shell.nix: use rustup instead of fenix
2025-08-13 12:09:12 +00:00
tellet-q
f0612d6680 Refactor bash tests: tls (#6995)
* Refactor tls bash test

* Update codespell

* Address review
2025-08-11 10:05:47 +02:00
Andrey Vasnetsov
b58fd263d2 add example of multi-node docker-compose file for easier experiemnting (#6953)
* add example of multi-node docker-compose file for easier experiemnting

* rename peers and add healthcheck
2025-08-07 00:49:21 +02:00
tellet-q
9597a8bee1 Hardcode the link (#6985)
* Hardcode the link

* Fix image build
2025-08-06 11:24:16 +02:00
Kumar Shivendu
edd3f12899 Fix coverage failure after recent changes (#6948) 2025-07-29 21:28:58 +05:30
Andrey Vasnetsov
9102c888a1 add retries to curl (#6820) 2025-07-08 09:54:23 +02:00
xzfc
ff0df47714 Move codespell config to tools/codespell.toml (#6707) 2025-06-16 22:06:06 +00:00
xzfc
5169bf26a3 shell.nix: bump to rust 1.87 (#6547)
* shell.nix: bump to rust 1.87

* shell.nix: workaround for jemalloc
2025-05-16 10:16:58 +00:00
n0x29a
73e7b17ee8 Refactor: move HardwareUsage to the Usage map (#6532)
---------

Co-authored-by: jojii <jojii@gmx.net>
2025-05-14 21:01:49 +02:00
Kumar Shivendu
c8a960604a Introduce coverage reports for integration tests (#6414)
* Introduce coverage reports for integration tests

* Install cargo-llvm-cov

* Use multiline script

* Explicityl setup COVERAGE env var

* fix integration tests and log generated data

* fix ls path

* upload lcov file to GH artifacts

* integration profraw dynamic filename

* Fix llvm profile filename template

* Use interrupt instead of kill and merge consensus test results into same file

* Drop upload artifact stage

* install llvm-cov

* upload as artifact and export coverage files

* try simplifying workflow

* Migrate coverage generation to existing dedicated gh workflow

* trigger on coverage related branches

* Build only if qdrant binary with cov doesnt exist

* Use valid yaml

* include mode in profraw filename

* split coverage workflow into parallel jobs

* add poetry version to env

* log poetry version to install

* clean up integration test workflow

* Simplify comments
2025-04-25 16:42:41 +05:30
Andrey Vasnetsov
75e5635d23 Add a tool to view percentage of mmaps cache (#6310)
* Add a tool to view percentage of mmaps cache

* review fixes
2025-04-03 10:50:16 +02:00
xzfc
8f2b5822a6 shell.nix: bump to rust 1.85 (#6060) 2025-02-25 14:00:04 +00:00
Kumar Shivendu
b09ae8dd7c Fix coverage test OOD on CI (#5927)
* Fix coverage test OOD on CI

* Temporarily run coverage CI on PR

* Clean artifacts per package and store in tmp dir

* fix typo in gh workflow

* Add monitoring script again for debugging

* trigger script

* Fix monitor script path

* dont checkout dev branch

* Merge .info file only if test passed

* Try merging .info file only if it exists

* trigger ci

* fix workflow

* trigger ci

* Customize branch to check out

* Remove monitor.sh script

* remove unused env var
2025-02-05 21:45:47 +05:30
Kumar Shivendu
b2ba0f966f Setup code coverage reports (#5751)
* Setup code coverage for Rust tests

* Add API key env var for codecov

* Save code coverage report for upload

* Trigger CI

* Try without explicit build step

* Run coverage job on self hosted runner

* Fix mistake because of which is was running fewer tests

* Run coverage on ubuntu latest

* Trigger CI

* fix name

* run coverage on all os

* Adjust after rebase to dev

* Avoid running coverage in other jobs

* fix test job

* reset test workflow

* Trigger CI

* run coverage after tests

* Add script to monitor resources

* fix indentation

* remove coverage dependency on test job

* fix needs field

* add monitoring script

* Run tail -f to monitor resources concurrently with tests

* Split commands

* Use --jobs=1 to possibly minimize RAM

* Try generating coverage one by one

* Dont clean coverage artifacts

* Merge .lcov files with lcov command

* Upload merged lcov.info file

* Run coverage for fewer packages

* Improve coverage script

* Move coverage.sh to tools dir

* Prepare for review

* Improve CI output and failure handling

* Generate HTML report if running locally

* Cleanup

* Run coverage on schedule and only for dev branch
2025-01-29 23:51:22 +05:30
xzfc
876ddd9944 shell.nix: bump to rust 1.83 (#5578)
* shell.nix: bump to rust 1.83

* shell.nix: add cmake (required by gpu deps)
2024-12-03 17:08:01 +00:00
Arnaud Gourlay
ae857340ed Do not build schema_generator by default (#5482) 2024-11-19 16:46:02 +01:00
xzfc
10ce515ecf shell.nix: bump to rust 1.81, misc changes (#5185)
* shell.nix: add a comment

* tools/nix/update.py: let it run outside of the nix-shell

* shell.nix: bump to rust 1.81
2024-10-07 10:30:20 +00:00
xzfc
35dad67771 Add shell.nix (#4821) 2024-08-08 16:57:14 +00:00
Luis Merino
36d7e11624 Fix web UI index path http security headers (#4517)
* Draft: web-ui root endpoint x-frame-options: deny header

* Switch to async

* Simplify setting frame options header by using DefaultHeaders

---------

Co-authored-by: timvisee <tim@visee.me>
2024-06-25 13:44:25 +02:00
xzfc
b87e6d2bdd Improve tools/*.sh (#4365)
* Speedup tools/generate_openapi_models.sh

* Improve tools/generate_grpc_docs.sh
2024-05-31 09:51:37 +00:00
xzfc
3ad1528ebe Use /usr/bin/env bash in shebangs (#3570) 2024-02-09 11:42:29 +01:00
Kaan C. Fidan
c7402a45d7 Manhattan distance (#3079)
* implemented Manhattan distance

* updated quantization dependency

* fixed negative distances and doc consistency

* fixed neon implementation

* updated quantization dependency

* updated quantization dependency

* removed redundant copy operation

* updated quantization dependency

* Change back to upstream quantization dependency

---------

Co-authored-by: timvisee <tim@visee.me>
2023-12-02 21:28:38 +01:00
Tim Visée
d321b64b97 Add tool script to clean old RocksDB log files from disk (#3071) 2023-11-22 09:58:53 +01:00
Andrey Vasnetsov
74de1483be Shard key create confirmation (#3027)
* create dedicated API for creating shards with explicit avait on the consensus

* fmt

* update api definitions
2023-11-16 15:58:32 +01:00
Roman Titov
cab234c391 Add shard snapshot gRPC API (#2825)
* Fix paste-bugs in `snapshot_service.proto`

* Add shard snapshot gRCP API definition

* Add validation to shard snapshot gRPC API definition

* Implement conversions between gRPC and `collection` types

* Extract shard snapshot API implementation into common sub-module

* Implement shard snapshot gRPC API

* Generate gRPC docs

* Refactor `ShardSnapshots` gRPC service to be internal API only

* fixup! Refactor `ShardSnapshots` gRPC service to be internal API only

Move `ShardSnapshotRecoverResponse` to `shard_snapshots_service.proto`

* fixup! fixup! Refactor `ShardSnapshots` gRPC service to be internal API only

Update `api/src/grpc/qdrant.rs`

* fixup! fixup! Refactor `ShardSnapshots` gRPC service to be internal API only

Update gRPC docs

* Switch `ShardSnapshots` gRPC service to use `validate_and_log` instead of `validate`
2023-10-18 14:34:58 +02:00
Andrey Vasnetsov
326ef54664 openapi definitions for shard shashots API (#2571)
* openapi definitions for shard shashots API

* review fixes
2023-09-04 14:54:08 +02:00
Luis Cossío
0caeb3a5e3 remove dist zip after unzipping it (#2487) 2023-08-22 18:02:02 +02:00
Andrey Vasnetsov
0ccca76949 allow to configure qdrant init file with env variable (#2316)
* allow to configure qdrant init file with env variable

* Return path type from get_init_file_path

---------

Co-authored-by: timvisee <tim@visee.me>
2023-07-24 16:37:36 +02:00
Tim Visée
e1a69099fc Add script to list commits that have yet to be picked into master (#2108)
* Add script to list commits that have yet to be picked into master

This allows us to easily detect cherry-picks we missed from dev to
master on our release branch.

* Update missed cherry picks ignore hash
2023-06-28 14:57:49 +02:00
Andrey Vasnetsov
aef9e0833d use bash in the entrypoint.sh for good traps 2023-06-19 14:34:16 +02:00
Andrey Vasnetsov
967d387a37 Web UI integration (#2009)
* wip: integrate UI web interface

* fmt

* Api key exclusion rule + fixes

* upd welcome url

* rollback api key in config
2023-06-06 21:42:24 +02:00
Roman Titov
abffa27ff0 Refactor Dockerfile (#1594)
* Refactor Dockerfile

- fix cross-compilation
- improve caching

TODO:
- check if `lld` is used/works for linkage (and enable if not used, or remove if doesn't work)

* Remove `aarch64` linker config from `.cargo/config.toml` (seems to be unnecessary)

* Expose `LINKER` argument and enable `lld` linker

* Add `mold` linker support

* Document Dockerfile

* Add closing ` in the Dockerfile comments

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

---------

Co-authored-by: Tim Visée <tim+github@visee.me>
2023-05-26 16:01:43 +02:00
Roman Titov
7fa637c0f0 Add script to generate docker-compose.yaml for Qdrant cluster (#1489)
* Add a simple script to generate `docker-compose.yaml` for a cluster of specified number of nodes

* Improve service error from `RequestError` conversion

* fixup! Improve service error from `RequestError` conversion [skip ci]

* fixup! Add a simple script to generate `docker-compose.yaml` for a cluster of specified number of nodes [skip ci]

* Add CPU limit to the `docker-compose-gen.sh` [skip ci]

* fixup! Add CPU limit to the `docker-compose-gen.sh` [skip ci]

* Move docker-compose generator script into tools directory, add docs

* Apply suggestions from code review

Co-authored-by: Roman Titov <ffuugoo@users.noreply.github.com>

* Simplify error message constructing

---------

Co-authored-by: timvisee <tim@visee.me>
Co-authored-by: Tim Visée <tim+github@visee.me>
2023-05-25 16:49:12 +02:00
Andrey Vasnetsov
e8edbe02ed it's a trap! (#1975) 2023-05-25 15:57:36 +02:00
Andrey Vasnetsov
72c3b9070d temporary disable mold to let the docker build (#1954) 2023-05-23 20:44:37 +02:00
Luis Cossío
e90a03e00b Group by key (#1768)
* test: test must_not is_null

* vcs: ignore vscode files

* feat: group-by initial implementation

* cargo fmt

* refactor: same request behavior on reco and search

* refactor: get rid of RefCell

* refactor-fix: correct hashmap keys, and early stops

* chore: small improvements

* feat: groups aggregator

* fix: pull changes from other files

* cargo fix

* cargo fmt

* docs: edit docstrings

* allow dead code (while the complete feature is beint built)

* chore: restructure

* feat: introduce GroupKey, minor other improvements

* cargo fmt

* chore: specify aggregator visibility

* fix: oops, leaking "private" type

* refactor-fix: restructure and refactor group_by

* cargo fix

* fix: don't panic when there is no group-by field

* remove print statements

* amend: `>=`  -> `==`

* perf: remove double clone

* chore: sync aggregator from other branch

* chore: cleanup print statemets

* test: ignore big tests

* cargo fmt

* refactor: add early stop when the groups have been filled, improve code

* chore: sync aggregator, remove print from test

* refactor: consider shard_selection, improve collection_by_name handling

* feat: add bucketing to table of content

* refactor: better errors, improve tests

* test: add integration tests

* feat: add endpoints

* refactor: introduce ScoredPoint wrapper, restructure types

* sync aggregator

* edit internal grouping visibility

* feat: group_by internals

* cargo fmt

* cargo fmt

* refactor: turn inner fn into closure

* test: fix test to support new vector output representation

* feat: wire up grouping with actix

* expose grouped_by field

* fix: change output group format

* feat: wire up openapi

* fix: finish wiring up grouping in actix

* tests: fix test_group.py

* cargo fmt

* refactor: extract constants

* remove Hash from ScoredPoint

* `Option<collection_by_name>` -> `collection_by_name`

* fix: handle better cases on `match_on`

* fix: consider that subsequent calls can bring better results

* cargo fmt

* fix clippy warnings

* cargo fmt

* refactor: move `Group` to `types`, localize `hydrate_from`, remove `Deref` impls

* refactor `add_points`

* refactor: turn `GroupKey` into enum

* refactor: make `HashablePoint` inner struct private

* feat: add grpc layer, make new `PointGroup` type to use as output

* fix: update openapi models

* docs: update grpc docs

* fix merge errors

* refactor: add BaseGroupRequest to make code DRYer, improve doc comments

* cargo fmt

* perf: increase precision; choose best groups by score

* misc: add more integration tests, fix review comments

* cargo fmt

* fix: reimplement interface to flatten search and recommend requests, excluding offset

* cargo fmt

* refactor: move `r#do` impl to `GroupRequest`

* fix: update grpc docs

* perf: sort in reverse order

* fix: use fist value of a Value::Array

* fix: validate group_by to not support bracket notation, fix int. tests

* fix: update grpc validation

* tests: update collection_tests

* refactor: move validation to the api layers

* Oops: reupdate tests

* refactor: let the derives derive (thanks @ffuugoo)

* refactor: use a new GroupId on the output

also increases performance by copying less

* remove hashable set, take ordering into an account, fix mutliple groups values support

* fmt

* refactor group_id + rename per_group -> group_size, fix clippy

* remove GroupKey wrapper

* @agourlay review fixes

* refactor: `group_min_scores` and `group_max_scores` ->  `group_best_scores`

* refactor: use set difference on `keys_of_unfilled_best_groups`

* refactor: use set intersection on `len_of_filled_best_groups`

* refactor: turn best_group_keys into iterator

* fix: remove [] syntax limitation

* fix: update openapi.json

---------

Co-authored-by: Andrey Vasnetsov <andrey@vasnetsov.com>
2023-05-15 23:05:20 +02:00
Jesse
34055f0ddf Custom build profile for CI docker builds (#1859)
* Use custom build profile for docker builds

* trigger ci

* change source code to trigger ci with rebuild one more time

---------

Co-authored-by: Andrey Vasnetsov <andrey@vasnetsov.com>
2023-05-08 20:39:59 +02:00
Jesse
b67c655ddb Add caching of docker layers in CI (#1856)
* Add caching of docker layers in CI

Build required docker images for CI in a workflow step using buildkit's
gha cache type. This will populate the local layer cache from github
actions' cache. Builds in subsequent CI steps will be nearly instant,
because all layers can be reused.

* add minor change to see if build time is any faster

---------

Co-authored-by: Andrey Vasnetsov <andrey@vasnetsov.com>
2023-05-08 17:02:29 +02:00
Roman Titov
16b7fb7688 Improve handling out-of-RAM errors during Qdrant startup (#1777)
* WIP: Start working on out-of-RAM errors handling [skip ci]

* Implement basic handling of out-of-RAM errors during Qdrant startup

* Try to fix CI fail by allowing both V1 and V2 cgroups

* Try to fix CI fail by improving cgroups handling

* Fix cgroups path detection/handling (+ some minor stylistic changes)

* fixup! Fix cgroups path detection/handling (+ some minor stylistic changes)

* Add test

* Enable low RAM test

* fixup! Add test

* free memory checks

* rm unused function

* Oom fallback script (#1809)

* add recover mode in qdrant + script for handelling OOM

* fix clippy

* reformat entrypoint.sh

* fix test

* add logging to test

* fix test

* fix test

---------

Co-authored-by: Andrey Vasnetsov <andrey@vasnetsov.com>
2023-05-02 20:54:13 +02:00
Roman Titov
cf04b1a92b Add /cluster/recover API endpoint (#1451)
- Add required internal `raft::raw_node::RawNode::report_snapshot` calls
- Add methods to propagate `raft::raw_node::RawNode::request_snapshot` call to the consensus thread
- Add `/cluster/recover` API endpooint
- Add `test_collection_recovery.py` integration test (disabled on CI; documents current, incorrect behavior)
2023-02-15 04:19:11 +10:00
Ivan Pleshkov
f50f1f4c71 #1119 disable updating feature (#1126)
* disable updating feature

* customize error message

* update namings

* Update src/actix/api/service_api.rs

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

* fix build

* update api

* update api and allow deletion

* update openapi

* replace Bad Request with Forbidden

Co-authored-by: Arnaud Gourlay <arnaud.gourlay@gmail.com>
Co-authored-by: Andrey Vasnetsov <andrey@vasnetsov.com>
2022-10-18 12:58:38 +02:00
Andrey Vasnetsov
01807d5cf3 Multiplatform build fix 2 (#1000)
* upd dockerfile to multi-arch build

* debug actions

* fail faster on install

* add buildplatform

* enable CI

* dedicated push for github registry

* default platform

* fix default target arch

* revert debug ci changes
2022-09-12 13:26:40 +02:00
Ivan Pleshkov
42e930ab8f Segment telemetry (#814)
* segment telemetry

* anonymize trait

* fix build

* are you happy fmt

* anonimyze implementations

* sliding window avg (#826)

* Actix web telemetry (#828)

* actix web telemetry

* small as move

* use tokio mutex instead of std

* add comments

* are you happy fmt

* use u16 as http status code

* telemetry structs rename

* fix build

* using parking lot mutex

* telemetry web api (#842)

* telemetry web api

* telemetry openapi (#843)

* use async mutex for telemetry collector

* use tokio mutex for telemetry collector

* are you happy fmt
2022-07-22 19:27:07 +04:00
Andrey Vasnetsov
fac87018c4 Snapshoting API (#764)
* wip: rest api for snapshots

* fmt

* fix tests

* fmt

* wip: collection snapshoting and recovery

* fmt

* remote shard snapshots

* remote shard test

* fmt

* extend proxy snapshot test + fix double read lock

* fmt + clippy

* openapi schema

* Update openapi/openapi-snapshots.ytt.yaml

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

* Update openapi/openapi-snapshots.ytt.yaml

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

* Update src/main.rs

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

* Update src/main.rs

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

* reduce writes on snapshots location

Co-authored-by: Arnaud Gourlay <arnaud.gourlay@gmail.com>
2022-07-01 13:21:57 +02:00
Snyk bot
00408e4c84 fix: upgrade @openapi-contrib/json-schema-to-openapi-schema from 1.2.0 to 1.3.0 (#665)
Snyk has created this PR to upgrade @openapi-contrib/json-schema-to-openapi-schema from 1.2.0 to 1.3.0.

See this package in npm:
https://www.npmjs.com/package/@openapi-contrib/json-schema-to-openapi-schema

See this project in Snyk:
https://app.snyk.io/org/generall/project/c2542b2d-d01b-437b-a5c7-acdb8524555a?utm_source=github&utm_medium=referral&page=upgrade-pr
2022-06-07 13:25:58 +02:00
Andrey Vasnetsov
7c254a0de0 preserve fields order in OpenAPI schema (#655) 2022-06-02 19:12:30 +02:00
Andrey Vasnetsov
c286bde562 Cluster api (#631)
* cluster status API

* add cluster api to OpenAPI specification
2022-05-27 14:52:51 +02:00
Andrey Vasnetsov
5800319edb refactor distances + add score_threshold + fix negative euclid distance (#569)
* refactor distances + add score_threshold + fix negative euclid distance

* generate docs

* fix clippy

* Update lib/segment/src/spaces/tools.rs

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

Co-authored-by: Arnaud Gourlay <arnaud.gourlay@gmail.com>
2022-05-09 17:32:48 +02:00