Gouzi Mohaled commited on
Commit
55c9a77
·
1 Parent(s): bfed346

Ajout des de la première partie des fichiers

Browse files
Files changed (11) hide show
  1. .codespellrc +6 -0
  2. .dockerignore +11 -0
  3. .gitattributes +4 -35
  4. .gitignore +18 -0
  5. .rusty-hook.toml +5 -0
  6. Cargo.lock +0 -0
  7. Cargo.toml +272 -0
  8. LICENSE +201 -0
  9. README.md +232 -11
  10. rustfmt.toml +5 -0
  11. shell.nix +114 -0
.codespellrc ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ [codespell]
2
+ # openapi.json is typically a released version and could carry old typos
3
+ skip = .git,*.pdf,*.svg,openapi.json,key.pem,Cargo.lock
4
+ # hel - Query token
5
+ # generall - the boss
6
+ ignore-words-list = crate,hel,generall
.dockerignore ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ tests/
2
+ target/
3
+ storage/
4
+ snapshots/
5
+ lib/segment/target
6
+ lib/api/target
7
+ lib/collection/target
8
+ lib/storage/target
9
+ *.tar
10
+ .git
11
+ .github/
.gitattributes CHANGED
@@ -1,35 +1,4 @@
1
- *.7z filter=lfs diff=lfs merge=lfs -text
2
- *.arrow filter=lfs diff=lfs merge=lfs -text
3
- *.bin filter=lfs diff=lfs merge=lfs -text
4
- *.bz2 filter=lfs diff=lfs merge=lfs -text
5
- *.ckpt filter=lfs diff=lfs merge=lfs -text
6
- *.ftz filter=lfs diff=lfs merge=lfs -text
7
- *.gz filter=lfs diff=lfs merge=lfs -text
8
- *.h5 filter=lfs diff=lfs merge=lfs -text
9
- *.joblib filter=lfs diff=lfs merge=lfs -text
10
- *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
- *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
- *.model filter=lfs diff=lfs merge=lfs -text
13
- *.msgpack filter=lfs diff=lfs merge=lfs -text
14
- *.npy filter=lfs diff=lfs merge=lfs -text
15
- *.npz filter=lfs diff=lfs merge=lfs -text
16
- *.onnx filter=lfs diff=lfs merge=lfs -text
17
- *.ot filter=lfs diff=lfs merge=lfs -text
18
- *.parquet filter=lfs diff=lfs merge=lfs -text
19
- *.pb filter=lfs diff=lfs merge=lfs -text
20
- *.pickle filter=lfs diff=lfs merge=lfs -text
21
- *.pkl filter=lfs diff=lfs merge=lfs -text
22
- *.pt filter=lfs diff=lfs merge=lfs -text
23
- *.pth filter=lfs diff=lfs merge=lfs -text
24
- *.rar filter=lfs diff=lfs merge=lfs -text
25
- *.safetensors filter=lfs diff=lfs merge=lfs -text
26
- saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
- *.tar.* filter=lfs diff=lfs merge=lfs -text
28
- *.tar filter=lfs diff=lfs merge=lfs -text
29
- *.tflite filter=lfs diff=lfs merge=lfs -text
30
- *.tgz filter=lfs diff=lfs merge=lfs -text
31
- *.wasm filter=lfs diff=lfs merge=lfs -text
32
- *.xz filter=lfs diff=lfs merge=lfs -text
33
- *.zip filter=lfs diff=lfs merge=lfs -text
34
- *.zst filter=lfs diff=lfs merge=lfs -text
35
- *tfevents* filter=lfs diff=lfs merge=lfs -text
 
1
+ tests/storage-compat/storage.tar.bz2 filter=lfs diff=lfs merge=lfs -text
2
+ tests/storage-compat/collection.snapshot.gz filter=lfs diff=lfs merge=lfs -text
3
+ tests/low-ram/storage.tar.xz filter=lfs diff=lfs merge=lfs -text
4
+ tests/storage-compat/full-snapshot.snapshot.gz filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
.gitignore ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /target
2
+ /.idea
3
+ /.vscode
4
+ /.devcontainer
5
+ /storage
6
+ /snapshots
7
+ /consensus_test_logs
8
+ /config/local
9
+ /tls
10
+ /static
11
+ *.log
12
+ .qdrant-initialized
13
+ /.hypothesis
14
+ **/__pycache__
15
+ tests/storage-compat/compatibility.tar
16
+ tests/storage-compat/full-snapshot.snapshot.gz
17
+ tests/storage-compat/storage.tar.bz2
18
+ venv
.rusty-hook.toml ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ [hooks]
2
+ pre-push = "cargo +nightly fmt --all -- --check"
3
+
4
+ [logging]
5
+ verbose = true
Cargo.lock ADDED
The diff for this file is too large to render. See raw diff
 
Cargo.toml ADDED
@@ -0,0 +1,272 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [package]
2
+ name = "qdrant"
3
+ version = "1.12.4"
4
+ authors = [
5
+ "Andrey Vasnetsov <[email protected]>",
6
+ "Qdrant Team <[email protected]>",
7
+ ]
8
+ readme = "README.md"
9
+ homepage = "https://qdrant.tech/"
10
+ repository = "https://github.com/qdrant/qdrant"
11
+ license = "Apache-2.0"
12
+ edition = "2021"
13
+ rust-version = "1.77"
14
+ default-run = "qdrant"
15
+
16
+ [lints]
17
+ workspace = true
18
+
19
+ [features]
20
+ default = ["web", "parking_lot"]
21
+ web = ["actix-web"]
22
+ multiling-chinese = ["segment/multiling-chinese"]
23
+ multiling-japanese = ["segment/multiling-japanese"]
24
+ multiling-korean = ["segment/multiling-korean"]
25
+ service_debug = ["parking_lot", "parking_lot/deadlock_detection"]
26
+ tracing = [
27
+ "api/tracing",
28
+ "collection/tracing",
29
+ "segment/tracing",
30
+ "storage/tracing",
31
+ ]
32
+ console = ["console-subscriber"]
33
+ console-subscriber = ["tracing", "dep:console-subscriber"]
34
+ tracy = ["tracing-tracy"]
35
+ tracing-tracy = ["tracing", "dep:tracing-tracy"]
36
+ tokio-tracing = ["tokio/tracing"]
37
+ stacktrace = ["rstack-self"]
38
+ chaos-testing = []
39
+ data-consistency-check = ["collection/data-consistency-check"]
40
+ gpu = ["gpu/gpu"]
41
+
42
+ [dev-dependencies]
43
+ serde_urlencoded = "0.7"
44
+ sealed_test = "1.1.0"
45
+
46
+ tempfile = { workspace = true }
47
+ rusty-hook = "^0.11.2"
48
+
49
+
50
+ [dependencies]
51
+ parking_lot = { workspace = true, optional = true }
52
+
53
+ thiserror = { workspace = true }
54
+ log = { workspace = true }
55
+ colored = "2"
56
+ serde = { workspace = true }
57
+ serde_json = { workspace = true }
58
+ chrono = { workspace = true }
59
+ rand = { workspace = true }
60
+ schemars = { workspace = true }
61
+ itertools = { workspace = true }
62
+ anyhow = "1.0.93"
63
+ futures = { workspace = true }
64
+ futures-util = { workspace = true }
65
+ clap = { version = "4.5.20", features = ["derive"] }
66
+ serde_cbor = { workspace = true }
67
+ uuid = { workspace = true }
68
+ sys-info = "0.9.1"
69
+ wal = { workspace = true }
70
+
71
+ config = "~0.14.1"
72
+
73
+ tokio = { workspace = true }
74
+
75
+ actix-cors = "0.7.0"
76
+ actix-files = "0.6.6"
77
+ actix-web = { version = "4.9.0", optional = true, features = ["rustls-0_23", "actix-tls"] }
78
+ actix-web-validator = "6.0.0"
79
+ tonic = { workspace = true }
80
+ tonic-reflection = { workspace = true }
81
+ tower = { version = "0.5.1", features = ["util"] }
82
+ tower-layer = "0.3.3"
83
+ reqwest = { workspace = true }
84
+ # rustls minor version must be synced with actix-web
85
+ rustls = { version = "0.23.18", default-features = false, features = [ "logging", "std", "tls12", "ring"] }
86
+ rustls-pki-types = "1.10.0"
87
+ rustls-pemfile = "2.2.0"
88
+ prometheus = { version = "0.13.4", default-features = false }
89
+ validator = { workspace = true }
90
+ jsonwebtoken = "9.3.0"
91
+
92
+ # Consensus related crates
93
+ raft = { version = "0.7.0", features = ["prost-codec"], default-features = false }
94
+ slog = { version = "2.7.0", features = ["max_level_trace", "release_max_level_debug"] }
95
+ slog-stdlog = "4.1.1"
96
+ prost-for-raft = { workspace = true }
97
+ raft-proto = { version = "0.7.0", features = ["prost-codec"], default-features = false }
98
+
99
+ common = { path = "lib/common/common" }
100
+ cancel = { path = "lib/common/cancel" }
101
+ memory = { path = "lib/common/memory" }
102
+ issues = { path = "lib/common/issues" }
103
+ segment = { path = "lib/segment" }
104
+ collection = { path = "lib/collection" }
105
+ storage = { path = "lib/storage" }
106
+ api = { path = "lib/api" }
107
+ gpu = { path = "lib/gpu" }
108
+
109
+ actix-multipart = "0.7.2"
110
+ constant_time_eq = "0.3.1"
111
+
112
+ # Profiling
113
+ tracing = { workspace = true }
114
+ tracing-subscriber = { version = "0.3", features = ["env-filter"] }
115
+ tracing-log = { version = "0.2", default-features = false, features = ["log-tracer", "std"] }
116
+ console-subscriber = { version = "0.4", default-features = false, features = ["parking_lot"], optional = true }
117
+ tracing-tracy = { version = "0.11.3", features = ["ondemand"], optional = true }
118
+ actix-web-extras = "0.1.0"
119
+
120
+ [target.'cfg(target_os = "linux")'.dependencies]
121
+ # Pyroscope integration
122
+ pyroscope = "0.5.7"
123
+ pyroscope_pprofrs = "0.2.7"
124
+ # Backtrace
125
+ rstack-self = { version = "0.3.0", optional = true }
126
+
127
+ [target.'cfg(all(not(target_env = "msvc"), any(target_arch = "x86_64", target_arch = "aarch64")))'.dependencies]
128
+ tikv-jemallocator = { version = "0.6", features = ["stats", "unprefixed_malloc_on_supported_platforms", "background_threads"] }
129
+ tikv-jemalloc-ctl = { version = "0.6", features = ["stats"] }
130
+
131
+ [workspace.lints.clippy]
132
+ cast_lossless = "warn"
133
+ doc_link_with_quotes = "warn"
134
+ enum_glob_use = "warn"
135
+ explicit_into_iter_loop = "warn"
136
+ filter_map_next = "warn"
137
+ flat_map_option = "warn"
138
+ from_iter_instead_of_collect = "warn"
139
+ implicit_clone = "warn"
140
+ inconsistent_struct_constructor = "warn"
141
+ inefficient_to_string = "warn"
142
+ manual_is_variant_and = "warn"
143
+ manual_let_else = "warn"
144
+ needless_continue = "warn"
145
+ needless_raw_string_hashes = "warn"
146
+ ptr_as_ptr = "warn"
147
+ ref_option_ref = "warn"
148
+ uninlined_format_args = "warn"
149
+ unnecessary_wraps = "warn"
150
+ unused_self = "warn"
151
+ used_underscore_binding = "warn"
152
+
153
+ [workspace.lints.rust]
154
+ # https://blog.rust-lang.org/2024/05/06/check-cfg.html#expecting-custom-cfgs
155
+ unexpected_cfgs = { level = "warn", check-cfg = ['cfg(tokio_unstable)'] }
156
+
157
+ [workspace.dependencies]
158
+ ahash = { version = "0.8.11", features = ["serde"] }
159
+ atomicwrites = "0.4.4"
160
+ bytes = "1.8.0"
161
+ chrono = { version = "0.4.38", features = ["serde"] }
162
+ criterion = "0.5.1"
163
+ data-encoding = "2.6.0"
164
+ delegate = "0.13.1"
165
+ fnv = "1.0"
166
+ futures = "0.3.31"
167
+ futures-util = "0.3.30"
168
+ generic-tests = "0.1.3"
169
+ half = { version = "2.4.1", features = ["alloc", "serde", "num-traits"] }
170
+ indexmap = { version = "2", features = ["serde"] }
171
+ indicatif = "0.17.8"
172
+ itertools = "0.13.0"
173
+ log = "0.4.22"
174
+ memmap2 = "0.9.5"
175
+ nix = { version = "0.29", features = ["fs"]}
176
+ num-traits = "0.2.19"
177
+ ordered-float = "4.5"
178
+ rayon = "1.10.0"
179
+ parking_lot = { version = "0.12.3", features = ["deadlock_detection", "serde"] }
180
+ ph = "0.8.5"
181
+ pprof = { version = "0.13.0", features = ["flamegraph", "prost-codec"] }
182
+ prost = "0.12.6"
183
+ prost-build = { version = "0.12.6", features = ["cleanup-markdown"] }
184
+ prost-wkt-types = "0.5"
185
+ prost-for-raft = { package = "prost", version = "=0.11.9" } # version of prost used by raft
186
+ rand = "0.8.5"
187
+ reqwest = { version = "0.12.9", default-features = false, features = ["http2", "stream", "rustls-tls", "blocking"] }
188
+ schemars = { version = "0.8.21", features = ["uuid1", "preserve_order", "chrono", "url", "indexmap2"] }
189
+ semver = { version = "1.0", features = ["serde"] }
190
+ serde = { version = "~1.0", features = ["derive", "rc"] }
191
+ serde_cbor = "0.11.2"
192
+ serde_variant = "0.1.3"
193
+ sha2 = "0.10.8"
194
+ serde_json = {version = "~1.0", features = ["preserve_order"]}
195
+ strum = { version = "0.26.3", features = ["derive"] }
196
+ tap = "1.0.1"
197
+ tar = "0.4.41"
198
+ tempfile = "3.14.0"
199
+ tokio = { version = "1.41.1", features = ["full"] }
200
+ tokio-util = { version = "0.7", features = ["io", "io-util"] }
201
+ tonic = { version = "0.11.0", features = ["gzip", "tls"] }
202
+ tonic-build = { version = "0.11.0", features = ["prost"] }
203
+ tonic-reflection = "0.11.0"
204
+ tracing = { version = "0.1", features = ["async-await"] }
205
+ uuid = { version = "1.11", features = ["v4", "serde"] }
206
+ validator = { version = "0.18.1", features = ["derive"] }
207
+ wal = { git = "https://github.com/qdrant/wal.git", rev = "f42e853debf22a3a746de444d625bb8cc1d2e61e" }
208
+ zerocopy = { version = "0.7.34", features = ["derive"] }
209
+ atomic_refcell = "0.1.13"
210
+ byteorder = "1.5.0"
211
+ thiserror = "1.0.68"
212
+ bitvec = "1.0.1"
213
+ merge = "0.1.0"
214
+ dashmap = "6.1"
215
+
216
+ [[bin]]
217
+ name = "schema_generator"
218
+ path = "src/schema_generator.rs"
219
+ test = false
220
+ bench = false
221
+
222
+ [[bin]]
223
+ name = "wal_inspector"
224
+ path = "src/wal_inspector.rs"
225
+ test = false
226
+ bench = false
227
+
228
+ [workspace]
229
+ members = [
230
+ "lib/api",
231
+ "lib/collection",
232
+ "lib/common/*",
233
+ "lib/segment",
234
+ "lib/sparse",
235
+ "lib/storage",
236
+ ]
237
+
238
+ [profile.release]
239
+ lto = "fat"
240
+ codegen-units = 1
241
+
242
+ # Inherit from release, because we are not rebuilding often,
243
+ # and we don't want the huge binary sizes from debug builds.
244
+ [profile.ci]
245
+ inherits = "release"
246
+ lto = false
247
+ opt-level = 0
248
+
249
+ # Inherits by default from release
250
+ [profile.bench]
251
+ lto = false
252
+ debug = true
253
+ codegen-units = 256 # restore default value for faster compilation
254
+
255
+ # Profile for performance testing, which is faster to build than release.
256
+ [profile.perf]
257
+ inherits = "release"
258
+ lto = false
259
+ opt-level = 3
260
+ codegen-units = 256 # restore default value for faster compilation
261
+
262
+ # Override for fast sha256 hashing in dev builds
263
+ [profile.dev.package.sha2]
264
+ opt-level = 3
265
+
266
+ # Override for fast sha256 hashing in ci builds
267
+ [profile.ci.package.sha2]
268
+ opt-level = 3
269
+
270
+ [patch.crates-io]
271
+ # Temporary patch until our PRs are merged.
272
+ tar = { git = "https://github.com/qdrant/tar-rs", branch="main" }
LICENSE ADDED
@@ -0,0 +1,201 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
README.md CHANGED
@@ -1,11 +1,232 @@
1
- ---
2
- title: Colibri.qdrant
3
- emoji: 🐢
4
- colorFrom: green
5
- colorTo: pink
6
- sdk: docker
7
- pinned: false
8
- license: other
9
- ---
10
-
11
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <p align="center">
2
+ <img height="100" src="https://github.com/qdrant/qdrant/raw/master/docs/logo.svg" alt="Qdrant">
3
+ </p>
4
+
5
+ <p align="center">
6
+ <b>Vector Search Engine for the next generation of AI applications</b>
7
+ </p>
8
+
9
+ <p align=center>
10
+ <a href="https://github.com/qdrant/qdrant/actions/workflows/rust.yml"><img src="https://img.shields.io/github/actions/workflow/status/qdrant/qdrant/rust.yml?style=flat-square" alt="Tests status"></a>
11
+ <a href="https://api.qdrant.tech/"><img src="https://img.shields.io/badge/Docs-OpenAPI%203.0-success?style=flat-square" alt="OpenAPI Docs"></a>
12
+ <a href="https://github.com/qdrant/qdrant/blob/master/LICENSE"><img src="https://img.shields.io/github/license/qdrant/qdrant?style=flat-square" alt="Apache 2.0 License"></a>
13
+ <a href="https://qdrant.to/discord"><img src="https://img.shields.io/discord/907569970500743200?logo=Discord&style=flat-square&color=7289da" alt="Discord"></a>
14
+ <a href="https://qdrant.to/roadmap"><img src="https://img.shields.io/badge/Roadmap-2024-bc1439.svg?style=flat-square" alt="Roadmap 2024"></a>
15
+ <a href="https://cloud.qdrant.io/"><img src="https://img.shields.io/badge/Qdrant-Cloud-24386C.svg?logo=cloud&style=flat-square" alt="Qdrant Cloud"></a>
16
+ </p>
17
+
18
+ **Qdrant** (read: _quadrant_) is a vector similarity search engine and vector database.
19
+ It provides a production-ready service with a convenient API to store, search, and manage points—vectors with an additional payload
20
+ Qdrant is tailored to extended filtering support. It makes it useful for all sorts of neural-network or semantic-based matching, faceted search, and other applications.
21
+
22
+ Qdrant is written in Rust 🦀, which makes it fast and reliable even under high load. See [benchmarks](https://qdrant.tech/benchmarks/).
23
+
24
+ With Qdrant, embeddings or neural network encoders can be turned into full-fledged applications for matching, searching, recommending, and much more!
25
+
26
+ Qdrant is also available as a fully managed **[Qdrant Cloud](https://cloud.qdrant.io/)** ⛅ including a **free tier**.
27
+
28
+ <p align="center">
29
+ <strong><a href="docs/QUICK_START.md">Quick Start</a> • <a href="#clients">Client Libraries</a> • <a href="#demo-projects">Demo Projects</a> • <a href="#integrations">Integrations</a> • <a href="#contacts">Contact</a>
30
+
31
+ </strong>
32
+ </p>
33
+
34
+ ## Getting Started
35
+
36
+ ### Python
37
+
38
+ ```
39
+ pip install qdrant-client
40
+ ```
41
+
42
+ The python client offers a convenient way to start with Qdrant locally:
43
+
44
+ ```python
45
+ from qdrant_client import QdrantClient
46
+ qdrant = QdrantClient(":memory:") # Create in-memory Qdrant instance, for testing, CI/CD
47
+ # OR
48
+ client = QdrantClient(path="path/to/db") # Persists changes to disk, fast prototyping
49
+ ```
50
+
51
+ ### Client-Server
52
+
53
+ To experience the full power of Qdrant locally, run the container with this command:
54
+
55
+ ```bash
56
+ docker run -p 6333:6333 qdrant/qdrant
57
+ ```
58
+
59
+ Now you can connect to this with any client, including Python:
60
+
61
+ ```python
62
+ qdrant = QdrantClient("http://localhost:6333") # Connect to existing Qdrant instance
63
+ ```
64
+
65
+ Before deploying Qdrant to production, be sure to read our [installation](https://qdrant.tech/documentation/guides/installation/) and [security](https://qdrant.tech/documentation/guides/security/) guides.
66
+
67
+ ### Clients
68
+
69
+ Qdrant offers the following client libraries to help you integrate it into your application stack with ease:
70
+
71
+ - Official:
72
+ - [Go client](https://github.com/qdrant/go-client)
73
+ - [Rust client](https://github.com/qdrant/rust-client)
74
+ - [JavaScript/TypeScript client](https://github.com/qdrant/qdrant-js)
75
+ - [Python client](https://github.com/qdrant/qdrant-client)
76
+ - [.NET/C# client](https://github.com/qdrant/qdrant-dotnet)
77
+ - [Java client](https://github.com/qdrant/java-client)
78
+ - Community:
79
+ - [Elixir](https://hexdocs.pm/qdrant/readme.html)
80
+ - [PHP](https://github.com/hkulekci/qdrant-php)
81
+ - [Ruby](https://github.com/andreibondarev/qdrant-ruby)
82
+ - [Java](https://github.com/metaloom/qdrant-java-client)
83
+
84
+ ### Where do I go from here?
85
+
86
+ - [Quick Start Guide](docs/QUICK_START.md)
87
+ - End to End [Colab Notebook](https://colab.research.google.com/drive/1Bz8RSVHwnNDaNtDwotfPj0w7AYzsdXZ-?usp=sharing) demo with SentenceBERT and Qdrant
88
+ - Detailed [Documentation](https://qdrant.tech/documentation/) are great starting points
89
+ - [Step-by-Step Tutorial](https://qdrant.to/qdrant-tutorial) to create your first neural network project with Qdrant
90
+
91
+ ## Demo Projects <a href="https://replit.com/@qdrant"><img align="right" src="https://replit.com/badge/github/qdrant/qdrant" alt="Run on Repl.it"></a>
92
+
93
+ ### Discover Semantic Text Search 🔍
94
+
95
+ Unlock the power of semantic embeddings with Qdrant, transcending keyword-based search to find meaningful connections in short texts. Deploy a neural search in minutes using a pre-trained neural network, and experience the future of text search. [Try it online!](https://qdrant.to/semantic-search-demo)
96
+
97
+ ### Explore Similar Image Search - Food Discovery 🍕
98
+
99
+ There's more to discovery than text search, especially when it comes to food. People often choose meals based on appearance rather than descriptions and ingredients. Let Qdrant help your users find their next delicious meal using visual search, even if they don't know the dish's name. [Check it out!](https://qdrant.to/food-discovery)
100
+
101
+ ### Master Extreme Classification - E-commerce Product Categorization 📺
102
+
103
+ Enter the cutting-edge realm of extreme classification, an emerging machine learning field tackling multi-class and multi-label problems with millions of labels. Harness the potential of similarity learning models, and see how a pre-trained transformer model and Qdrant can revolutionize e-commerce product categorization. [Play with it online!](https://qdrant.to/extreme-classification-demo)
104
+
105
+ <details>
106
+ <summary> More solutions </summary>
107
+
108
+ <table>
109
+ <tr>
110
+ <td width="30%">
111
+ <img src="https://qdrant.tech/content/images/text_search.png">
112
+ </td>
113
+ <td width="30%">
114
+ <img src="https://qdrant.tech/content/images/image_search.png">
115
+ </td>
116
+ <td width="30%">
117
+ <img src="https://qdrant.tech/content/images/recommendations.png">
118
+ </td>
119
+ </tr>
120
+ <tr>
121
+ <td>
122
+ Semantic Text Search
123
+ </td>
124
+ <td>
125
+ Similar Image Search
126
+ </td>
127
+ <td>
128
+ Recommendations
129
+ </td>
130
+ </tr>
131
+ </table>
132
+
133
+ <table>
134
+ <tr>
135
+ <td>
136
+ <img width="300px" src="https://qdrant.tech/content/images/chat_bots.png">
137
+ </td>
138
+ <td>
139
+ <img width="300px" src="https://qdrant.tech/content/images/matching_engines.png">
140
+ </td>
141
+ <td>
142
+ <img width="300px" src="https://qdrant.tech/content/images/anomalies_detection.png">
143
+ </td>
144
+ </tr>
145
+ <tr>
146
+ <td>
147
+ Chat Bots
148
+ </td>
149
+ <td>
150
+ Matching Engines
151
+ </td>
152
+ <td>
153
+ Anomaly Detection
154
+ </td>
155
+ </tr>
156
+ </table>
157
+
158
+ </details>
159
+
160
+ ## API
161
+
162
+ ### REST
163
+
164
+ Online OpenAPI 3.0 documentation is available [here](https://api.qdrant.tech/).
165
+ OpenAPI makes it easy to generate a client for virtually any framework or programming language.
166
+
167
+ You can also download raw OpenAPI [definitions](https://github.com/qdrant/qdrant/blob/master/docs/redoc/master/openapi.json).
168
+
169
+ ### gRPC
170
+
171
+ For faster production-tier searches, Qdrant also provides a gRPC interface. You can find gRPC documentation [here](https://qdrant.tech/documentation/quick-start/#grpc).
172
+
173
+ ## Features
174
+
175
+ ### Filtering and Payload
176
+
177
+ Qdrant can attach any JSON payloads to vectors, allowing for both the storage and filtering of data based on the values in these payloads.
178
+ Payload supports a wide range of data types and query conditions, including keyword matching, full-text filtering, numerical ranges, geo-locations, and more.
179
+
180
+ Filtering conditions can be combined in various ways, including `should`, `must`, and `must_not` clauses,
181
+ ensuring that you can implement any desired business logic on top of similarity matching.
182
+
183
+
184
+ ### Hybrid Search with Sparse Vectors
185
+
186
+ To address the limitations of vector embeddings when searching for specific keywords, Qdrant introduces support for sparse vectors in addition to the regular dense ones.
187
+
188
+ Sparse vectors can be viewed as an generalization of BM25 or TF-IDF ranking. They enable you to harness the capabilities of transformer-based neural networks to weigh individual tokens effectively.
189
+
190
+
191
+ ### Vector Quantization and On-Disk Storage
192
+
193
+ Qdrant provides multiple options to make vector search cheaper and more resource-efficient.
194
+ Built-in vector quantization reduces RAM usage by up to 97% and dynamically manages the trade-off between search speed and precision.
195
+
196
+
197
+ ### Distributed Deployment
198
+
199
+ Qdrant offers comprehensive horizontal scaling support through two key mechanisms:
200
+ 1. Size expansion via sharding and throughput enhancement via replication
201
+ 2. Zero-downtime rolling updates and seamless dynamic scaling of the collections
202
+
203
+
204
+ ### Highlighted Features
205
+
206
+ * **Query Planning and Payload Indexes** - leverages stored payload information to optimize query execution strategy.
207
+ * **SIMD Hardware Acceleration** - utilizes modern CPU x86-x64 and Neon architectures to deliver better performance.
208
+ * **Async I/O** - uses `io_uring` to maximize disk throughput utilization even on a network-attached storage.
209
+ * **Write-Ahead Logging** - ensures data persistence with update confirmation, even during power outages.
210
+
211
+
212
+ # Integrations
213
+
214
+ Examples and/or documentation of Qdrant integrations:
215
+
216
+ - [Cohere](https://docs.cohere.com/docs/qdrant-and-cohere) ([blogpost on building a QA app with Cohere and Qdrant](https://qdrant.tech/articles/qa-with-cohere-and-qdrant/)) - Use Cohere embeddings with Qdrant
217
+ - [DocArray](https://docs.docarray.org/user_guide/storing/index_qdrant/) - Use Qdrant as a document store in DocArray
218
+ - [Haystack](https://haystack.deepset.ai/integrations/qdrant-document-store) - Use Qdrant as a document store with Haystack ([blogpost](https://haystack.deepset.ai/blog/qdrant-integration)).
219
+ - [LangChain](https://python.langchain.com/docs/integrations/providers/qdrant/) ([blogpost](https://qdrant.tech/articles/langchain-integration/)) - Use Qdrant as a memory backend for LangChain.
220
+ - [LlamaIndex](https://gpt-index.readthedocs.io/en/latest/examples/vector_stores/QdrantIndexDemo.html) - Use Qdrant as a Vector Store with LlamaIndex.
221
+ - [OpenAI - ChatGPT retrieval plugin](https://github.com/openai/chatgpt-retrieval-plugin/blob/main/docs/providers/qdrant/setup.md) - Use Qdrant as a memory backend for ChatGPT
222
+ - [Microsoft Semantic Kernel](https://devblogs.microsoft.com/semantic-kernel/the-power-of-persistent-memory-with-semantic-kernel-and-qdrant-vector-database/) - Use Qdrant as persistent memory with Semantic Kernel
223
+
224
+ ## Contacts
225
+
226
+ - Have questions? Join our [Discord channel](https://qdrant.to/discord) or mention [@qdrant_engine on Twitter](https://qdrant.to/twitter)
227
+ - Want to stay in touch with latest releases? Subscribe to our [Newsletters](https://qdrant.to/newsletter)
228
+ - Looking for a managed cloud? Check [pricing](https://qdrant.tech/pricing/), need something personalised? We're at [[email protected]](mailto:[email protected])
229
+
230
+ ## License
231
+
232
+ Qdrant is licensed under the Apache License, Version 2.0. View a copy of the [License file](https://github.com/qdrant/qdrant/blob/master/LICENSE).
rustfmt.toml ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ # Check https://rust-lang.github.io/rustfmt for more options
2
+
3
+ reorder_imports = true
4
+ imports_granularity = "Module"
5
+ group_imports = "StdExternalCrate"
shell.nix ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # A nix-shell file that sets up a convenient environment to develop Qdrant.
2
+ #
3
+ # It includes all necessary dependencies used to build and develop Qdrant's Rust
4
+ # code, run Python tests, and execute various scripts within the repository.
5
+ #
6
+ # To use this shell, you must have the Nix package manager installed on your
7
+ # system. See https://nixos.org/download/. Available for Linux, macOS, and WSL2.
8
+ #
9
+ # Usage: Run `nix-shell` in the root directory of this repository. You will then
10
+ # be dropped into a new shell with all programs and dependencies available.
11
+ #
12
+ # To update dependencies, run ./tools/nix/update.py.
13
+
14
+ let
15
+ sources = import ./tools/nix/npins;
16
+ fenix = import sources.fenix { inherit pkgs; };
17
+ pkgs = import sources.nixpkgs { };
18
+ poetry2nix = import sources.poetry2nix { inherit pkgs; };
19
+
20
+ versions = builtins.fromJSON (builtins.readFile ./tools/nix/versions.json);
21
+
22
+ rust-combined =
23
+ let
24
+ stable = fenix.toolchainOf {
25
+ channel = versions.stable.version;
26
+ sha256 = versions.stable.sha256;
27
+ };
28
+ nightly = fenix.toolchainOf {
29
+ channel = "nightly";
30
+ date = versions.nightly.date;
31
+ sha256 = versions.nightly.sha256;
32
+ };
33
+ in
34
+ fenix.combine [
35
+ nightly.rustfmt # should be the first
36
+ stable.rust
37
+ stable.rust-analyzer
38
+ stable.rust-src
39
+ ];
40
+
41
+ # A workaround to allow running `cargo +nightly fmt`
42
+ cargo-wrapper = pkgs.writeScriptBin "cargo" ''
43
+ #!${pkgs.stdenv.shell}
44
+ [ "$1" != "+nightly" ] || [ "$2" != "fmt" ] || shift
45
+ exec ${rust-combined}/bin/cargo "$@"
46
+ '';
47
+
48
+ # Python dependencies used in tests
49
+ python-env = poetry2nix.mkPoetryEnv {
50
+ projectDir = ./tests; # reads pyproject.toml and poetry.lock
51
+ preferWheels = true; # wheels speed up building of the environment
52
+ };
53
+
54
+ # Use mold linker to speed up builds
55
+ mkShell =
56
+ if !pkgs.stdenv.isDarwin then
57
+ pkgs.mkShell.override { stdenv = pkgs.stdenvAdapters.useMoldLinker pkgs.stdenv; }
58
+ else
59
+ pkgs.mkShell;
60
+ in
61
+ mkShell {
62
+ buildInputs = [
63
+ # Rust toolchain
64
+ cargo-wrapper # should be before rust-combined
65
+ rust-combined
66
+
67
+ # Crates' build dependencies
68
+ pkgs.iconv # for libc on darwin
69
+ pkgs.libunwind # for unwind-sys
70
+ pkgs.pkg-config # for unwind-sys and other deps
71
+ pkgs.protobuf # for prost-wkt-types
72
+ pkgs.rustPlatform.bindgenHook # for bindgen deps
73
+
74
+ # For tests and tools
75
+ pkgs.cargo-nextest # mentioned in .github/workflows/rust.yml
76
+ pkgs.ccache # mentioned in shellHook
77
+ pkgs.curl # used in ./tests
78
+ pkgs.gnuplot # optional runtime dep for criterion
79
+ pkgs.jq # used in ./tests and ./tools
80
+ pkgs.nixfmt-rfc-style # to format this file
81
+ pkgs.npins # used in tools/nix/update.py
82
+ pkgs.poetry # used to update poetry.lock
83
+ pkgs.sccache # mentioned in shellHook
84
+ pkgs.wget # used in tests/storage-compat
85
+ pkgs.yq-go # used in tools/generate_openapi_models.sh
86
+ pkgs.ytt # used in tools/generate_openapi_models.sh
87
+ python-env # used in tests
88
+ ];
89
+
90
+ shellHook = ''
91
+ # Caching for C/C++ deps, particularly for librocksdb-sys
92
+ export CC="ccache $CC"
93
+ export CXX="ccache $CXX"
94
+
95
+ # Caching for Rust
96
+ PATH="${pkgs.sccache}/bin:$PATH"
97
+ export RUSTC_WRAPPER="sccache"
98
+
99
+ # Caching for lindera-unidic
100
+ [ "''${LINDERA_CACHE+x}" ] ||
101
+ export LINDERA_CACHE="''${XDG_CACHE_HOME:-$HOME/.cache}/lindera"
102
+
103
+ # Fix for older macOS
104
+ # https://github.com/rust-rocksdb/rust-rocksdb/issues/776
105
+ if [[ "$OSTYPE" == "darwin"* ]]; then
106
+ export CFLAGS="-mmacosx-version-min=10.13"
107
+ export CXXFLAGS="-mmacosx-version-min=10.13"
108
+ export MACOSX_DEPLOYMENT_TARGET="10.13"
109
+ fi
110
+
111
+ # https://qdrant.tech/documentation/guides/common-errors/#too-many-files-open-os-error-24
112
+ [ "$(ulimit -n)" -ge 10000 ] || ulimit -n 10000
113
+ '';
114
+ }