usearch 2.8.4 → 2.8.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -462,6 +462,13 @@ jobs:
462
462
  permissions:
463
463
  contents: read
464
464
  packages: write
465
+ env:
466
+ MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
467
+ MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
468
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
469
+ ORG_GRADLE_PROJECT_signingKey: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGKEY }}
470
+ ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGPASSWORD }}
471
+
465
472
  steps:
466
473
  - uses: actions/checkout@v3
467
474
  with:
@@ -474,13 +481,9 @@ jobs:
474
481
  - name: Setup Gradle
475
482
  uses: gradle/gradle-build-action@v2.4.2
476
483
  - name: Execute Gradle build
477
- run: gradle clean build
484
+ run: gradle sign && gradle build
478
485
  - name: Publish package
479
- run: gradle publish -PsignArtifacts=false
480
- env:
481
- MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
482
- MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
483
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
486
+ run: gradle publish
484
487
 
485
488
  publish_swift:
486
489
  name: Publish ObjC & Swift
@@ -1,181 +1,180 @@
1
1
  {
2
- "files.associations": {
3
- "array": "cpp",
4
- "atomic": "cpp",
5
- "hash_map": "cpp",
6
- "hash_set": "cpp",
7
- "barrier": "cpp",
8
- "bit": "cpp",
9
- "*.tcc": "cpp",
10
- "bitset": "cpp",
11
- "cctype": "cpp",
12
- "chrono": "cpp",
13
- "cinttypes": "cpp",
14
- "clocale": "cpp",
15
- "cmath": "cpp",
16
- "codecvt": "cpp",
17
- "compare": "cpp",
18
- "complex": "cpp",
19
- "concepts": "cpp",
20
- "condition_variable": "cpp",
21
- "csignal": "cpp",
22
- "cstdarg": "cpp",
23
- "cstddef": "cpp",
24
- "cstdint": "cpp",
25
- "cstdio": "cpp",
26
- "cstdlib": "cpp",
27
- "cstring": "cpp",
28
- "ctime": "cpp",
29
- "cwchar": "cpp",
30
- "cwctype": "cpp",
31
- "deque": "cpp",
32
- "forward_list": "cpp",
33
- "list": "cpp",
34
- "map": "cpp",
35
- "set": "cpp",
36
- "string": "cpp",
37
- "unordered_map": "cpp",
38
- "unordered_set": "cpp",
39
- "vector": "cpp",
40
- "exception": "cpp",
41
- "algorithm": "cpp",
42
- "functional": "cpp",
43
- "iterator": "cpp",
44
- "memory": "cpp",
45
- "memory_resource": "cpp",
46
- "numeric": "cpp",
47
- "optional": "cpp",
48
- "random": "cpp",
49
- "ratio": "cpp",
50
- "regex": "cpp",
51
- "string_view": "cpp",
52
- "system_error": "cpp",
53
- "tuple": "cpp",
54
- "type_traits": "cpp",
55
- "utility": "cpp",
56
- "fstream": "cpp",
57
- "initializer_list": "cpp",
58
- "iomanip": "cpp",
59
- "iosfwd": "cpp",
60
- "iostream": "cpp",
61
- "istream": "cpp",
62
- "limits": "cpp",
63
- "mutex": "cpp",
64
- "new": "cpp",
65
- "numbers": "cpp",
66
- "ostream": "cpp",
67
- "semaphore": "cpp",
68
- "sstream": "cpp",
69
- "stdexcept": "cpp",
70
- "stop_token": "cpp",
71
- "streambuf": "cpp",
72
- "thread": "cpp",
73
- "typeindex": "cpp",
74
- "typeinfo": "cpp",
75
- "valarray": "cpp",
76
- "variant": "cpp",
77
- "__bit_reference": "cpp",
78
- "__bits": "cpp",
79
- "__config": "cpp",
80
- "__debug": "cpp",
81
- "__errc": "cpp",
82
- "__hash_table": "cpp",
83
- "__locale": "cpp",
84
- "__mutex_base": "cpp",
85
- "__node_handle": "cpp",
86
- "__nullptr": "cpp",
87
- "__split_buffer": "cpp",
88
- "__string": "cpp",
89
- "__threading_support": "cpp",
90
- "__tree": "cpp",
91
- "__tuple": "cpp",
92
- "any": "cpp",
93
- "ios": "cpp",
94
- "locale": "cpp",
95
- "queue": "cpp",
96
- "stack": "cpp",
97
- "__memory": "cpp",
98
- "filesystem": "cpp",
99
- "__availability": "cpp",
100
- "version": "cpp",
101
- "future": "cpp",
102
- "__verbose_abort": "cpp",
103
- "shared_mutex": "cpp",
104
- "ranges": "cpp",
105
- "span": "cpp",
106
- "format": "cpp",
107
- "charconv": "cpp"
108
- },
109
- "cSpell.words": [
110
- "allclose",
111
- "arange",
112
- "astype",
113
- "Availible",
114
- "bidict",
115
- "BLAS",
116
- "Cdecl",
117
- "cflags",
118
- "cibuildwheel",
119
- "citerator",
120
- "downcasted",
121
- "Downcasting",
122
- "dtype",
123
- "DUSEARCH",
124
- "emcmake",
125
- "equi",
126
- "equidimensional",
127
- "FAISS",
128
- "fbin",
129
- "groundtruth",
130
- "hashable",
131
- "HNSW",
132
- "hnswlib",
133
- "ibin",
134
- "jaccard",
135
- "libusearch",
136
- "linalg",
137
- "longlong",
138
- "memmap",
139
- "Napi",
140
- "ndarray",
141
- "ndim",
142
- "Numba",
143
- "numpy",
144
- "OPENMP",
145
- "preprocess",
146
- "Println",
147
- "pytest",
148
- "Quickstart",
149
- "rtype",
150
- "SIMD",
151
- "simsimd",
152
- "SLOC",
153
- "sorensen",
154
- "Struct",
155
- "tanimoto",
156
- "tqdm",
157
- "uninitialize",
158
- "unumusearch",
159
- "usearch",
160
- "usecases",
161
- "Vardanian",
162
- "vectorize",
163
- "Xunit"
164
- ],
165
- "autoDocstring.docstringFormat": "sphinx",
166
- "java.configuration.updateBuildConfiguration": "interactive",
167
- "python.testing.pytestArgs": [
168
- "python"
169
- ],
170
- "python.analysis.diagnosticSeverityOverrides": {
171
- "reportMissingImports": "none"
172
- },
173
- "python.testing.unittestEnabled": false,
174
- "python.testing.pytestEnabled": true,
175
- "[go]": {
176
- "editor.insertSpaces": true,
177
- "editor.formatOnSave": true,
178
- "editor.defaultFormatter": "golang.go"
179
- },
180
- "dotnet.defaultSolution": "csharp/Cloud.Unum.USearch.sln",
181
- }
2
+ "files.associations": {
3
+ "array": "cpp",
4
+ "atomic": "cpp",
5
+ "hash_map": "cpp",
6
+ "hash_set": "cpp",
7
+ "barrier": "cpp",
8
+ "bit": "cpp",
9
+ "*.tcc": "cpp",
10
+ "bitset": "cpp",
11
+ "cctype": "cpp",
12
+ "chrono": "cpp",
13
+ "cinttypes": "cpp",
14
+ "clocale": "cpp",
15
+ "cmath": "cpp",
16
+ "codecvt": "cpp",
17
+ "compare": "cpp",
18
+ "complex": "cpp",
19
+ "concepts": "cpp",
20
+ "condition_variable": "cpp",
21
+ "csignal": "cpp",
22
+ "cstdarg": "cpp",
23
+ "cstddef": "cpp",
24
+ "cstdint": "cpp",
25
+ "cstdio": "cpp",
26
+ "cstdlib": "cpp",
27
+ "cstring": "cpp",
28
+ "ctime": "cpp",
29
+ "cwchar": "cpp",
30
+ "cwctype": "cpp",
31
+ "deque": "cpp",
32
+ "forward_list": "cpp",
33
+ "list": "cpp",
34
+ "map": "cpp",
35
+ "set": "cpp",
36
+ "string": "cpp",
37
+ "unordered_map": "cpp",
38
+ "unordered_set": "cpp",
39
+ "vector": "cpp",
40
+ "exception": "cpp",
41
+ "algorithm": "cpp",
42
+ "functional": "cpp",
43
+ "iterator": "cpp",
44
+ "memory": "cpp",
45
+ "memory_resource": "cpp",
46
+ "numeric": "cpp",
47
+ "optional": "cpp",
48
+ "random": "cpp",
49
+ "ratio": "cpp",
50
+ "regex": "cpp",
51
+ "string_view": "cpp",
52
+ "system_error": "cpp",
53
+ "tuple": "cpp",
54
+ "type_traits": "cpp",
55
+ "utility": "cpp",
56
+ "fstream": "cpp",
57
+ "initializer_list": "cpp",
58
+ "iomanip": "cpp",
59
+ "iosfwd": "cpp",
60
+ "iostream": "cpp",
61
+ "istream": "cpp",
62
+ "limits": "cpp",
63
+ "mutex": "cpp",
64
+ "new": "cpp",
65
+ "numbers": "cpp",
66
+ "ostream": "cpp",
67
+ "semaphore": "cpp",
68
+ "sstream": "cpp",
69
+ "stdexcept": "cpp",
70
+ "stop_token": "cpp",
71
+ "streambuf": "cpp",
72
+ "thread": "cpp",
73
+ "typeindex": "cpp",
74
+ "typeinfo": "cpp",
75
+ "valarray": "cpp",
76
+ "variant": "cpp",
77
+ "__bit_reference": "cpp",
78
+ "__bits": "cpp",
79
+ "__config": "cpp",
80
+ "__debug": "cpp",
81
+ "__errc": "cpp",
82
+ "__hash_table": "cpp",
83
+ "__locale": "cpp",
84
+ "__mutex_base": "cpp",
85
+ "__node_handle": "cpp",
86
+ "__nullptr": "cpp",
87
+ "__split_buffer": "cpp",
88
+ "__string": "cpp",
89
+ "__threading_support": "cpp",
90
+ "__tree": "cpp",
91
+ "__tuple": "cpp",
92
+ "any": "cpp",
93
+ "ios": "cpp",
94
+ "locale": "cpp",
95
+ "queue": "cpp",
96
+ "stack": "cpp",
97
+ "__memory": "cpp",
98
+ "filesystem": "cpp",
99
+ "__availability": "cpp",
100
+ "version": "cpp",
101
+ "future": "cpp",
102
+ "__verbose_abort": "cpp",
103
+ "shared_mutex": "cpp",
104
+ "ranges": "cpp",
105
+ "span": "cpp",
106
+ "format": "cpp",
107
+ "charconv": "cpp"
108
+ },
109
+ "cSpell.words": [
110
+ "allclose",
111
+ "arange",
112
+ "astype",
113
+ "Availible",
114
+ "bidict",
115
+ "BLAS",
116
+ "Cdecl",
117
+ "cflags",
118
+ "cibuildwheel",
119
+ "citerator",
120
+ "downcasted",
121
+ "Downcasting",
122
+ "dtype",
123
+ "DUSEARCH",
124
+ "emcmake",
125
+ "equi",
126
+ "equidimensional",
127
+ "FAISS",
128
+ "fbin",
129
+ "groundtruth",
130
+ "hashable",
131
+ "HNSW",
132
+ "hnswlib",
133
+ "ibin",
134
+ "jaccard",
135
+ "libusearch",
136
+ "linalg",
137
+ "longlong",
138
+ "memmap",
139
+ "Napi",
140
+ "ndarray",
141
+ "ndim",
142
+ "Numba",
143
+ "numpy",
144
+ "OPENMP",
145
+ "preprocess",
146
+ "Println",
147
+ "pytest",
148
+ "Quickstart",
149
+ "rtype",
150
+ "SIMD",
151
+ "simsimd",
152
+ "SLOC",
153
+ "Sonatype",
154
+ "sorensen",
155
+ "Struct",
156
+ "tanimoto",
157
+ "tqdm",
158
+ "uninitialize",
159
+ "unumusearch",
160
+ "usearch",
161
+ "usecases",
162
+ "Vardanian",
163
+ "vectorize",
164
+ "Xunit"
165
+ ],
166
+ "autoDocstring.docstringFormat": "sphinx",
167
+ "java.configuration.updateBuildConfiguration": "interactive",
168
+ "python.testing.pytestArgs": ["python"],
169
+ "python.analysis.diagnosticSeverityOverrides": {
170
+ "reportMissingImports": "none"
171
+ },
172
+ "python.testing.unittestEnabled": false,
173
+ "python.testing.pytestEnabled": true,
174
+ "[go]": {
175
+ "editor.insertSpaces": true,
176
+ "editor.formatOnSave": true,
177
+ "editor.defaultFormatter": "golang.go"
178
+ },
179
+ "dotnet.defaultSolution": "csharp/Cloud.Unum.USearch.sln"
180
+ }
package/CITATION.cff CHANGED
@@ -5,7 +5,7 @@ authors:
5
5
  given-names: "Ash"
6
6
  orcid: "https://orcid.org/0000-0002-4882-1815"
7
7
  title: "USearch by Unum Cloud"
8
- version: 2.8.4
8
+ version: 2.8.6
9
9
  doi: 10.5281/zenodo.7949416
10
10
  date-released: 2023-10-22
11
11
  url: "https://github.com/unum-cloud/usearch"
package/CONTRIBUTING.md CHANGED
@@ -194,9 +194,19 @@ cd golang && go test -v ; cd ..
194
194
 
195
195
  ## Java
196
196
 
197
- USearch provides Java bindings available from the [GitHub Maven registry](https://github.com/unum-cloud/usearch/packages/1867475).
197
+ USearch provides Java bindings available from the [GitHub Maven registry](https://github.com/unum-cloud/usearch/packages/1867475) and the [Sonatype Maven Central Repository](https://central.sonatype.com/artifact/cloud.unum/usearch).
198
198
  The compilation settings are controlled by the `build.gradle` and are independent from CMake used for C/C++ builds.
199
199
 
200
+ To setup the Gradle environment:
201
+
202
+ ```sh
203
+ sudo apt get install zip unzip
204
+ curl -s "https://get.sdkman.io" | bash
205
+ sdk install java gradle
206
+ ```
207
+
208
+ Afterwards, in a new terminal:
209
+
200
210
  ```sh
201
211
  gradle clean build
202
212
  java -cp . -Djava.library.path="$(pwd)/build/libs/usearch/shared" java/cloud/unum/usearch/Index.java
package/Cargo.toml CHANGED
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "usearch"
3
- version = "2.8.4"
3
+ version = "2.8.6"
4
4
  authors = ["Ash Vardanian <1983160+ashvardanian@users.noreply.github.com>"]
5
5
  description = "Smaller & Faster Single-File Vector Search Engine from Unum"
6
6
  edition = "2021"
package/README.md CHANGED
@@ -36,12 +36,13 @@ Linux • MacOS • Windows • iOS • WebAssembly
36
36
  </p>
37
37
 
38
38
  <div align="center">
39
- <a href="https://pypi.org/project/usearch/"> <img alt="PyPI - Downloads" src="https://img.shields.io/pypi/dm/usearch?label=pypi%20downloads"> </a>
40
- <a href="https://www.npmjs.com/package/usearch"> <img alt="npm" src="https://img.shields.io/npm/dy/usearch?label=npm%20dowloads"> </a>
41
- <a href="https://crates.io/crates/usearch"> <img alt="Crates.io" src="https://img.shields.io/crates/d/usearch?label=crate%20downloads"> </a>
42
- <a href="https://www.nuget.org/packages/Cloud.Unum.USearch"> <img alt="Nuget" src="https://img.shields.io/nuget/dt/Cloud.Unum.USearch?label=NuGet"> </a>
43
- <a href="https://hub.docker.com/r/unum/usearch"> <img alt="Docker Pulls" src="https://img.shields.io/docker/pulls/unum/usearch?label=Docker"> </a>
44
- <img alt="GitHub code size in bytes" src="https://img.shields.io/github/languages/code-size/unum-cloud/usearch">
39
+ <a href="https://pypi.org/project/usearch/"> <img alt="PyPI" src="https://img.shields.io/pypi/dm/usearch?label=PyPi%20pulls"> </a>
40
+ <a href="https://www.npmjs.com/package/usearch"> <img alt="NPM" src="https://img.shields.io/npm/dy/usearch?label=NPM%20pulls"> </a>
41
+ <a href="https://crates.io/crates/usearch"> <img alt="Crate" src="https://img.shields.io/crates/d/usearch?label=Crate%20pulls"> </a>
42
+ <a href="https://www.nuget.org/packages/Cloud.Unum.USearch"> <img alt="NuGet" src="https://img.shields.io/nuget/dt/Cloud.Unum.USearch?label=NuGet%20pulls"> </a>
43
+ <a href="https://central.sonatype.com/artifact/cloud.unum/usearch/overview"> <img alt="Maven" src="https://img.shields.io/nexus/r/cloud.unum/usearch?server=https%3A%2F%2Fs01.oss.sonatype.org%2F&label=Maven%20version"> </a>
44
+ <a href="https://hub.docker.com/r/unum/usearch"> <img alt="Docker" src="https://img.shields.io/docker/pulls/unum/usearch?label=Docker%20pulls"> </a>
45
+ <img alt="GitHub code size in bytes" src="https://img.shields.io/github/languages/code-size/unum-cloud/usearch?label=Repo%20size">
45
46
  </div>
46
47
 
47
48
  ---
@@ -396,7 +397,7 @@ doi = {10.5281/zenodo.7949416},
396
397
  author = {Vardanian, Ash},
397
398
  title = {{USearch by Unum Cloud}},
398
399
  url = {https://github.com/unum-cloud/usearch},
399
- version = {2.8.4},
400
+ version = {2.8.6},
400
401
  year = {2023},
401
402
  month = oct,
402
403
  }
package/build.gradle CHANGED
@@ -109,11 +109,11 @@ jar {
109
109
  }
110
110
  }
111
111
 
112
- if (project.hasProperty('signArtifacts') && signArtifacts.toBoolean()) {
113
- signing {
114
- useGpgCmd()
115
- sign publishing.publications
116
- }
112
+ signing {
113
+ def signingKey = findProperty("signingKey")
114
+ def signingPassword = findProperty("signingPassword")
115
+ useInMemoryPgpKeys(signingKey, signingPassword)
116
+ sign publishing.publications
117
117
  }
118
118
 
119
119
  publishing {
@@ -124,10 +124,8 @@ publishing {
124
124
  artifact sourcesJar
125
125
  artifact javadocJar
126
126
 
127
- if (project.hasProperty('signArtifacts') && signArtifacts.toBoolean()) {
128
- signing {
129
- sign publishing.publications.library
130
- }
127
+ signing {
128
+ sign publishing.publications.library
131
129
  }
132
130
 
133
131
  pom {
package/conanfile.py CHANGED
@@ -7,7 +7,7 @@ required_conan_version = ">=1.53.0"
7
7
  class USearchConan(ConanFile):
8
8
 
9
9
  name = "usearch"
10
- version = '2.8.4'
10
+ version = '2.8.6'
11
11
  license = "Apache-2.0"
12
12
  description = "Smaller & Faster Single-File Vector Search Engine from Unum"
13
13
  homepage = "https://github.com/unum-cloud/usearch"
@@ -1,7 +1,7 @@
1
1
  <?xml version="1.0" encoding="utf-8"?>
2
2
  <Project>
3
3
  <PropertyGroup>
4
- <Version Condition="'$(Version)' == ''">2.8.4</Version>
4
+ <Version Condition="'$(Version)' == ''">2.8.6</Version>
5
5
 
6
6
  <Authors>Unum</Authors>
7
7
  <Company>Unum</Company>
@@ -11,7 +11,7 @@
11
11
 
12
12
  #define USEARCH_VERSION_MAJOR 2
13
13
  #define USEARCH_VERSION_MINOR 8
14
- #define USEARCH_VERSION_PATCH 4
14
+ #define USEARCH_VERSION_PATCH 6
15
15
 
16
16
  // Inferring C++ version
17
17
  // https://stackoverflow.com/a/61552074
@@ -1,17 +1,17 @@
1
1
  package cloud.unum.usearch;
2
2
 
3
- import java.io.File;
4
- import java.io.InputStream;
5
- import java.nio.file.Files;
6
- import java.nio.file.StandardCopyOption;
7
-
8
3
  /**
9
4
  * Java bindings for Unum USearch.
10
5
  * <p>
11
- * Provides interface to interact with USearch library and perform various operations related to indexing and searching.
6
+ * Provides interface to interact with USearch library and perform various
7
+ * operations related to indexing and searching.
12
8
  *
13
- * @see <a href="https://nachtimwald.com/2017/06/06/wrapping-a-c-library-in-java/">Wrapping a C library in Java</a>
14
- * @see <a href="https://www3.ntu.edu.sg/home/ehchua/programming/java/javanativeinterface.html">Java Native Interface tutorial</a>
9
+ * @see <a href=
10
+ * "https://nachtimwald.com/2017/06/06/wrapping-a-c-library-in-java/">Wrapping
11
+ * a C library in Java</a>
12
+ * @see <a href=
13
+ * "https://www3.ntu.edu.sg/home/ehchua/programming/java/javanativeinterface.html">Java
14
+ * Native Interface tutorial</a>
15
15
  */
16
16
  public class Index {
17
17
 
@@ -20,33 +20,34 @@ public class Index {
20
20
  /**
21
21
  * Creates a new instance of Index with specified parameters.
22
22
  *
23
- * @param metric the metric type for distance calculation between vectors
24
- * @param quantization the scalar type for quantization of vector data
25
- * @param dimensions the number of dimensions in the vectors
26
- * @param capacity the initial capacity of the index
27
- * @param connectivity the connectivity parameter that limits connections-per-node in graph
28
- * @param expansion_add the expansion factor used for index construction when adding vectors
29
- * @param expansion_search the expansion factor used for index construction during search operations
23
+ * @param metric the metric type for distance calculation between
24
+ * vectors
25
+ * @param quantization the scalar type for quantization of vector data
26
+ * @param dimensions the number of dimensions in the vectors
27
+ * @param capacity the initial capacity of the index
28
+ * @param connectivity the connectivity parameter that limits
29
+ * connections-per-node in graph
30
+ * @param expansion_add the expansion factor used for index construction when
31
+ * adding vectors
32
+ * @param expansion_search the expansion factor used for index construction
33
+ * during search operations
30
34
  */
31
35
  public Index(
32
- String metric,
33
- String quantization, //
34
- long dimensions,
35
- long capacity,
36
- long connectivity, //
37
- long expansion_add,
38
- long expansion_search
39
- ) {
40
- c_ptr =
41
- c_create(
36
+ String metric,
37
+ String quantization,
38
+ long dimensions,
39
+ long capacity,
40
+ long connectivity,
41
+ long expansion_add,
42
+ long expansion_search) {
43
+ c_ptr = c_create(
42
44
  metric,
43
45
  quantization,
44
46
  dimensions,
45
47
  capacity,
46
48
  connectivity,
47
49
  expansion_add,
48
- expansion_search
49
- );
50
+ expansion_search);
50
51
  }
51
52
 
52
53
  /**
@@ -97,8 +98,8 @@ public class Index {
97
98
  /**
98
99
  * Adds a vector with a specified key to the index.
99
100
  *
100
- * @param key the key associated with the vector
101
- * @param vector the vector data
101
+ * @param key the key associated with the vector
102
+ * @param vector the vector data
102
103
  */
103
104
  public void add(int key, float vector[]) {
104
105
  c_add(c_ptr, key, vector);
@@ -107,9 +108,9 @@ public class Index {
107
108
  /**
108
109
  * Searches for closest vectors to the specified query vector.
109
110
  *
110
- * @param vector the query vector data
111
- * @param count the number of nearest neighbors to search
112
- * @return an array of keys of the nearest neighbors
111
+ * @param vector the query vector data
112
+ * @param count the number of nearest neighbors to search
113
+ * @return an array of keys of the nearest neighbors
113
114
  */
114
115
  public int[] search(float vector[], long count) {
115
116
  return c_search(c_ptr, vector, count);
@@ -146,7 +147,8 @@ public class Index {
146
147
  * Removes the vector associated with the given key from the index.
147
148
  *
148
149
  * @param key the key of the vector to be removed.
149
- * @return {@code true} if the vector was successfully removed, {@code false} otherwise.
150
+ * @return {@code true} if the vector was successfully removed, {@code false}
151
+ * otherwise.
150
152
  */
151
153
  public boolean remove(int key) {
152
154
  return c_remove(c_ptr, key);
@@ -156,13 +158,21 @@ public class Index {
156
158
  * Renames the vector to map to a different key.
157
159
  *
158
160
  * @param from the key of the vector to be renamed.
159
- * @param to the new key for the vector.
160
- * @return {@code true} if the vector was successfully renamed, {@code false} otherwise.
161
+ * @param to the new key for the vector.
162
+ * @return {@code true} if the vector was successfully renamed, {@code false}
163
+ * otherwise.
161
164
  */
162
165
  public boolean rename(int from, int to) {
163
166
  return c_rename(c_ptr, from, to);
164
167
  }
165
168
 
169
+ /**
170
+ * Configuration class for building an Index instance.
171
+ * <p>
172
+ * This class provides a builder pattern to set various configurations for an
173
+ * Index. Once all configurations
174
+ * are set, calling {@link #build()} will produce an instance of {@link Index}.
175
+ */
166
176
  public static class Config {
167
177
 
168
178
  private String _metric = "ip";
@@ -173,50 +183,102 @@ public class Index {
173
183
  private long _expansion_add = 0;
174
184
  private long _expansion_search = 0;
175
185
 
176
- public Config() {}
186
+ /**
187
+ * Default constructor for the Config class.
188
+ */
189
+ public Config() {
190
+ }
177
191
 
192
+ /**
193
+ * Constructs an Index instance based on the current configuration settings.
194
+ *
195
+ * @return a newly constructed Index instance.
196
+ */
178
197
  public Index build() {
179
198
  return new Index(
180
- _metric,
181
- _quantization,
182
- _dimensions,
183
- _capacity,
184
- _connectivity,
185
- _expansion_add,
186
- _expansion_search
187
- );
199
+ _metric,
200
+ _quantization,
201
+ _dimensions,
202
+ _capacity,
203
+ _connectivity,
204
+ _expansion_add,
205
+ _expansion_search);
188
206
  }
189
207
 
208
+ /**
209
+ * Sets the metric for distance calculation between vectors.
210
+ *
211
+ * @param _metric the metric type
212
+ * @return this configuration instance
213
+ */
190
214
  public Config metric(String _metric) {
191
215
  this._metric = _metric;
192
216
  return this;
193
217
  }
194
218
 
219
+ /**
220
+ * Sets the scalar type for quantization of vector data.
221
+ *
222
+ * @param _quantization the quantization type
223
+ * @return this configuration instance
224
+ */
195
225
  public Config quantization(String _quantization) {
196
226
  this._quantization = _quantization;
197
227
  return this;
198
228
  }
199
229
 
230
+ /**
231
+ * Sets the number of dimensions in the vectors.
232
+ *
233
+ * @param _dimensions the number of dimensions
234
+ * @return this configuration instance
235
+ */
200
236
  public Config dimensions(long _dimensions) {
201
237
  this._dimensions = _dimensions;
202
238
  return this;
203
239
  }
204
240
 
241
+ /**
242
+ * Sets the initial capacity of the index.
243
+ *
244
+ * @param _capacity the index capacity
245
+ * @return this configuration instance
246
+ */
205
247
  public Config capacity(long _capacity) {
206
248
  this._capacity = _capacity;
207
249
  return this;
208
250
  }
209
251
 
252
+ /**
253
+ * Sets the connectivity parameter that limits connections-per-node in the
254
+ * graph.
255
+ *
256
+ * @param _connectivity the connectivity value
257
+ * @return this configuration instance
258
+ */
210
259
  public Config connectivity(long _connectivity) {
211
260
  this._connectivity = _connectivity;
212
261
  return this;
213
262
  }
214
263
 
264
+ /**
265
+ * Sets the expansion factor used for index construction when adding vectors.
266
+ *
267
+ * @param _expansion_add the expansion factor for adding vectors
268
+ * @return this configuration instance
269
+ */
215
270
  public Config expansion_add(long _expansion_add) {
216
271
  this._expansion_add = _expansion_add;
217
272
  return this;
218
273
  }
219
274
 
275
+ /**
276
+ * Sets the expansion factor used for index construction during search
277
+ * operations.
278
+ *
279
+ * @param _expansion_search the expansion factor for search
280
+ * @return this configuration instance
281
+ */
220
282
  public Config expansion_search(long _expansion_search) {
221
283
  this._expansion_search = _expansion_search;
222
284
  return this;
@@ -227,21 +289,25 @@ public class Index {
227
289
  System.loadLibrary("usearch");
228
290
  }
229
291
 
292
+ /**
293
+ * A simple main method to test the Index functionalities.
294
+ *
295
+ * @param args command line arguments (not used in this case)
296
+ */
230
297
  public static void main(String[] args) {
231
298
  Index index = new Index.Config().metric("cos").dimensions(100).build();
232
299
  index.size();
233
300
  System.out.println("Java tests passed!");
234
301
  }
235
302
 
236
- private static native long c_create( //
237
- String metric,
238
- String quantization, //
239
- long dimensions,
240
- long capacity,
241
- long connectivity, //
242
- long expansion_add,
243
- long expansion_search
244
- );
303
+ private static native long c_create(
304
+ String metric,
305
+ String quantization,
306
+ long dimensions,
307
+ long capacity,
308
+ long connectivity,
309
+ long expansion_add,
310
+ long expansion_search);
245
311
 
246
312
  private static native void c_destroy(long ptr);
247
313
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "usearch",
3
- "version": "2.8.4",
3
+ "version": "2.8.6",
4
4
  "description": "Smaller & Faster Single-File Vector Search Engine from Unum",
5
5
  "author": "Ash Vardanian (https://ashvardanian.com/)",
6
6
  "license": "Apache 2.0",
package/wasmer.toml CHANGED
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name="unum/usearch"
3
- version="2.8.4"
3
+ version="2.8.6"
4
4
  description="Smaller & Faster Single-File Vector Search Engine from Unum"
5
5
  license="Apache-2.0"
6
6
  readme="README.md"