Skip to content

Commit 2ea07f0

Browse files
Merge branch 'main' into Add-Hugging-Face-Rerank-support
2 parents f74e9e5 + 3b0ef09 commit 2ea07f0

File tree

35 files changed

+2607
-20
lines changed

35 files changed

+2607
-20
lines changed

TESTING.asciidoc

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,8 @@ run it using Gradle:
4646
==== Launching and debugging from an IDE
4747

4848
If you want to run and debug Elasticsearch from your IDE, the `./gradlew run` task
49-
supports a remote debugging option. Run the following from your terminal:
50-
51-
---------------------------------------------------------------------------
52-
./gradlew run --debug-jvm
53-
---------------------------------------------------------------------------
54-
55-
Next start the "Debug Elasticsearch" run configuration in IntelliJ. This will enable the IDE to connect to the process and allow debug functionality.
56-
49+
supports a remote debugging option. Start the "Debug Elasticsearch" run configuration in IntelliJ. This will enable the
50+
IDE to connect to the process and allow debug functionality.
5751

5852
As such the IDE needs to be instructed to listen for connections on the debug port.
5953
Since we might run multiple JVMs as part of configuring and starting the cluster it's
@@ -64,6 +58,12 @@ NOTE: If you have imported the project into IntelliJ according to the instructio
6458
link:/CONTRIBUTING.md#importing-the-project-into-intellij-idea[CONTRIBUTING.md] then a debug run configuration
6559
named "Debug Elasticsearch" will be created for you and configured appropriately.
6660

61+
Next run the following from your terminal:
62+
63+
---------------------------------------------------------------------------
64+
./gradlew run --debug-jvm
65+
---------------------------------------------------------------------------
66+
6767
===== Debugging the CLI launcher
6868

6969
The gradle task does not start the Elasticsearch server process directly; like in the Elasticsearch distribution,

benchmarks/src/main/java/org/elasticsearch/benchmark/vector/OSQScorerBenchmark.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import org.apache.lucene.util.VectorUtil;
1818
import org.apache.lucene.util.quantization.OptimizedScalarQuantizer;
1919
import org.elasticsearch.common.logging.LogConfigurator;
20-
import org.elasticsearch.simdvec.internal.vectorization.ES91OSQVectorsScorer;
20+
import org.elasticsearch.simdvec.ES91OSQVectorsScorer;
2121
import org.elasticsearch.simdvec.internal.vectorization.ESVectorizationProvider;
2222
import org.openjdk.jmh.annotations.Benchmark;
2323
import org.openjdk.jmh.annotations.BenchmarkMode;

build-conventions/settings.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*/
99

1010
plugins {
11-
id "com.gradle.develocity" version "3.19.2"
11+
id "com.gradle.develocity" version "4.0.1"
1212
}
1313

1414
rootProject.name = 'build-conventions'

build-tools-internal/settings.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ pluginManagement {
99
}
1010

1111
plugins {
12-
id "com.gradle.develocity" version "3.19.2"
12+
id "com.gradle.develocity" version "4.0.1"
1313
}
1414

1515
dependencyResolutionManagement {

build-tools/settings.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pluginManagement {
1010
includeBuild "../build-conventions"
1111
}
1212
plugins {
13-
id "com.gradle.develocity" version "3.19.2"
13+
id "com.gradle.develocity" version "4.0.1"
1414
}
1515
include 'reaper'
1616

docs/changelog/128047.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
pr: 128047
2+
summary: Add missing entitlement to `repository-azure`
3+
area: Snapshot/Restore
4+
type: bug
5+
issues:
6+
- 128046

gradle/build.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ checkstyle = "com.puppycrawl.tools:checkstyle:10.3"
1616
commmons-io = "commons-io:commons-io:2.2"
1717
docker-compose = "com.avast.gradle:gradle-docker-compose-plugin:0.17.5"
1818
forbiddenApis = "de.thetaphi:forbiddenapis:3.8"
19-
gradle-enterprise = "com.gradle:develocity-gradle-plugin:3.19.2"
19+
gradle-enterprise = "com.gradle:develocity-gradle-plugin:4.0.1"
2020
hamcrest = "org.hamcrest:hamcrest:3.0"
2121
httpcore5 = "org.apache.httpcomponents.core5:httpcore5:5.3.3"
2222
httpclient5 = "org.apache.httpcomponents.client5:httpclient5:5.4.2"

gradle/verification-metadata.xml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -866,9 +866,11 @@
866866
<sha256 value="48234cd74e35d91a31a683820a35b5b6d11b55527f32a5b162c6757408b95d7a" origin="Generated by Gradle"/>
867867
</artifact>
868868
</component>
869-
<component group="com.gradle" name="develocity-gradle-plugin" version="3.19.2">
870-
<artifact name="develocity-gradle-plugin-3.19.2.jar">
871-
<sha256 value="fc611e8858a901619831ea1d9efd289db7fea28a0ca3d091abdd363365d9512b" origin="Generated by Gradle"/>
869+
<component group="com.gradle" name="develocity-gradle-plugin" version="4.0.1">
870+
<artifact name="develocity-gradle-plugin-4.0.1.jar">
871+
<sha256 value="fc611e8858a901619831ea1d9efd289db7fea28a0ca3d091abdd363365d9512b" origin="Generated by Gradle">
872+
<also-trust value="62a98a9df9fbf8c16772787aa5a0009cedcf45c366a0969274bc3b3644c1de25"/>
873+
</sha256>
872874
</artifact>
873875
</component>
874876
<component group="com.gradleup.shadow" name="shadow-gradle-plugin" version="8.3.5">
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* your election, the "Elastic License 2.0", the "GNU Affero General Public
77
* License v3.0 only", or the "Server Side Public License, v 1".
88
*/
9-
package org.elasticsearch.simdvec.internal.vectorization;
9+
package org.elasticsearch.simdvec;
1010

1111
import org.apache.lucene.index.VectorSimilarityFunction;
1212
import org.apache.lucene.store.IndexInput;

libs/simdvec/src/main/java/org/elasticsearch/simdvec/ESVectorUtil.java

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,13 @@
99

1010
package org.elasticsearch.simdvec;
1111

12+
import org.apache.lucene.store.IndexInput;
1213
import org.apache.lucene.util.BitUtil;
1314
import org.apache.lucene.util.Constants;
1415
import org.elasticsearch.simdvec.internal.vectorization.ESVectorUtilSupport;
1516
import org.elasticsearch.simdvec.internal.vectorization.ESVectorizationProvider;
1617

18+
import java.io.IOException;
1719
import java.lang.invoke.MethodHandle;
1820
import java.lang.invoke.MethodHandles;
1921
import java.lang.invoke.MethodType;
@@ -41,6 +43,10 @@ public class ESVectorUtil {
4143

4244
private static final ESVectorUtilSupport IMPL = ESVectorizationProvider.getInstance().getVectorUtilSupport();
4345

46+
public static ES91OSQVectorsScorer getES91OSQVectorsScorer(IndexInput input, int dimension) throws IOException {
47+
return ESVectorizationProvider.getInstance().newES91OSQVectorsScorer(input, dimension);
48+
}
49+
4450
public static long ipByteBinByte(byte[] q, byte[] d) {
4551
if (q.length != d.length * B_QUERY) {
4652
throw new IllegalArgumentException("vector dimensions incompatible: " + q.length + "!= " + B_QUERY + " x " + d.length);
@@ -211,4 +217,40 @@ public static void centerAndCalculateOSQStatsDp(float[] target, float[] centroid
211217
assert stats.length == 6;
212218
IMPL.centerAndCalculateOSQStatsDp(target, centroid, centered, stats);
213219
}
220+
221+
/**
222+
* Calculates the difference between two vectors and stores the result in a third vector.
223+
* @param v1 the first vector
224+
* @param v2 the second vector
225+
* @param result the result vector, must be the same length as the input vectors
226+
*/
227+
public static void subtract(float[] v1, float[] v2, float[] result) {
228+
if (v1.length != v2.length) {
229+
throw new IllegalArgumentException("vector dimensions differ: " + v1.length + "!=" + v2.length);
230+
}
231+
if (result.length != v1.length) {
232+
throw new IllegalArgumentException("vector dimensions differ: " + result.length + "!=" + v1.length);
233+
}
234+
for (int i = 0; i < v1.length; i++) {
235+
result[i] = v1[i] - v2[i];
236+
}
237+
}
238+
239+
/**
240+
* calculates the spill-over score for a vector and a centroid, given its residual with
241+
* its actually nearest centroid
242+
* @param v1 the vector
243+
* @param centroid the centroid
244+
* @param originalResidual the residual with the actually nearest centroid
245+
* @return the spill-over score (soar)
246+
*/
247+
public static float soarResidual(float[] v1, float[] centroid, float[] originalResidual) {
248+
if (v1.length != centroid.length) {
249+
throw new IllegalArgumentException("vector dimensions differ: " + v1.length + "!=" + centroid.length);
250+
}
251+
if (originalResidual.length != v1.length) {
252+
throw new IllegalArgumentException("vector dimensions differ: " + originalResidual.length + "!=" + v1.length);
253+
}
254+
return IMPL.soarResidual(v1, centroid, originalResidual);
255+
}
214256
}

0 commit comments

Comments
 (0)