Skip to content

Commit 7d1edd3

Browse files
committed
Remove previous implementation versions
1 parent 222ccc1 commit 7d1edd3

File tree

7 files changed

+15
-198
lines changed

7 files changed

+15
-198
lines changed

server/src/main/java/module-info.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
* License v3.0 only", or the "Server Side Public License, v 1".
88
*/
99

10-
import org.elasticsearch.index.codec.vectors.diskbbq.ES920DiskBBQVectorsFormat;
1110
import org.elasticsearch.plugins.internal.RestExtension;
1211
import org.elasticsearch.reservedstate.ReservedStateHandlerProvider;
1312

@@ -462,9 +461,7 @@
462461
org.elasticsearch.index.codec.vectors.es816.ES816HnswBinaryQuantizedVectorsFormat,
463462
org.elasticsearch.index.codec.vectors.es818.ES818BinaryQuantizedVectorsFormat,
464463
org.elasticsearch.index.codec.vectors.es818.ES818HnswBinaryQuantizedVectorsFormat,
465-
org.elasticsearch.index.codec.vectors.es818.DirectIOES818BinaryQuantizedVectorsFormat,
466-
org.elasticsearch.index.codec.vectors.es818.DirectIOES818HnswBinaryQuantizedVectorsFormat,
467-
ES920DiskBBQVectorsFormat;
464+
org.elasticsearch.index.codec.vectors.diskbbq.ES920DiskBBQVectorsFormat;
468465

469466
provides org.apache.lucene.codecs.Codec
470467
with

server/src/main/java/org/elasticsearch/index/codec/vectors/es818/DirectIOES818BinaryQuantizedVectorsFormat.java

Lines changed: 0 additions & 24 deletions
This file was deleted.

server/src/main/java/org/elasticsearch/index/codec/vectors/es818/DirectIOES818HnswBinaryQuantizedVectorsFormat.java

Lines changed: 0 additions & 50 deletions
This file was deleted.

server/src/main/java/org/elasticsearch/index/codec/vectors/es818/ES818HnswBinaryQuantizedVectorsFormat.java

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,6 @@
3131
import java.io.IOException;
3232
import java.util.concurrent.ExecutorService;
3333

34-
import static org.apache.lucene.codecs.lucene99.Lucene99HnswVectorsFormat.DEFAULT_BEAM_WIDTH;
35-
import static org.apache.lucene.codecs.lucene99.Lucene99HnswVectorsFormat.DEFAULT_MAX_CONN;
36-
import static org.apache.lucene.codecs.lucene99.Lucene99HnswVectorsFormat.DEFAULT_NUM_MERGE_WORKER;
37-
3834
/**
3935
* Copied from Lucene, replace with Lucene's implementation sometime after Lucene 10
4036
*/
@@ -43,11 +39,11 @@ public class ES818HnswBinaryQuantizedVectorsFormat extends AbstractHnswVectorsFo
4339
public static final String NAME = "ES818HnswBinaryQuantizedVectorsFormat";
4440

4541
/** The format for storing, reading, merging vectors on disk */
46-
private final FlatVectorsFormat flatVectorsFormat;
42+
private static final FlatVectorsFormat flatVectorsFormat = new ES818BinaryQuantizedVectorsFormat();
4743

4844
/** Constructs a format using default graph construction parameters */
4945
public ES818HnswBinaryQuantizedVectorsFormat() {
50-
this(DEFAULT_MAX_CONN, DEFAULT_BEAM_WIDTH, DEFAULT_NUM_MERGE_WORKER, null);
46+
super(NAME);
5147
}
5248

5349
/**
@@ -57,7 +53,7 @@ public ES818HnswBinaryQuantizedVectorsFormat() {
5753
* @param beamWidth the size of the queue maintained during graph construction.
5854
*/
5955
public ES818HnswBinaryQuantizedVectorsFormat(int maxConn, int beamWidth) {
60-
this(maxConn, beamWidth, DEFAULT_NUM_MERGE_WORKER, null);
56+
super(NAME, maxConn, beamWidth);
6157
}
6258

6359
/**
@@ -71,19 +67,7 @@ public ES818HnswBinaryQuantizedVectorsFormat(int maxConn, int beamWidth) {
7167
* generated by this format to do the merge
7268
*/
7369
public ES818HnswBinaryQuantizedVectorsFormat(int maxConn, int beamWidth, int numMergeWorkers, ExecutorService mergeExec) {
74-
this(NAME, maxConn, beamWidth, numMergeWorkers, new ES818BinaryQuantizedVectorsFormat(), mergeExec);
75-
}
76-
77-
ES818HnswBinaryQuantizedVectorsFormat(
78-
String name,
79-
int maxConn,
80-
int beamWidth,
81-
int numMergeWorkers,
82-
FlatVectorsFormat flatVectorsFormat,
83-
ExecutorService mergeExec
84-
) {
85-
super(name, maxConn, beamWidth, numMergeWorkers, mergeExec);
86-
this.flatVectorsFormat = flatVectorsFormat;
70+
super(NAME, maxConn, beamWidth, numMergeWorkers, mergeExec);
8771
}
8872

8973
@Override

server/src/main/java/org/elasticsearch/index/mapper/vectors/DenseVectorFieldMapper.java

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@
5656
import org.elasticsearch.index.codec.vectors.ES815BitFlatVectorFormat;
5757
import org.elasticsearch.index.codec.vectors.ES815HnswBitVectorsFormat;
5858
import org.elasticsearch.index.codec.vectors.diskbbq.ES920DiskBBQVectorsFormat;
59-
import org.elasticsearch.index.codec.vectors.es818.DirectIOES818HnswBinaryQuantizedVectorsFormat;
6059
import org.elasticsearch.index.codec.vectors.es818.ES818BinaryQuantizedVectorsFormat;
6160
import org.elasticsearch.index.codec.vectors.es818.ES818HnswBinaryQuantizedVectorsFormat;
6261
import org.elasticsearch.index.fielddata.FieldDataContext;
@@ -1449,7 +1448,7 @@ public boolean supportsDimension(int dims) {
14491448
public DenseVectorIndexOptions parseIndexOptions(String fieldName, Map<String, ?> indexOptionsMap, IndexVersion indexVersion) {
14501449
Object mNode = indexOptionsMap.remove("m");
14511450
Object efConstructionNode = indexOptionsMap.remove("ef_construction");
1452-
Object disableOffheapCacheRescoringNode = indexOptionsMap.remove("disable_offheap_cache_rescoring");
1451+
Object directRawVectorReadsNode = indexOptionsMap.remove("direct_raw_vector_reads");
14531452

14541453
if (mNode == null) {
14551454
mNode = Lucene99HnswVectorsFormat.DEFAULT_MAX_CONN;
@@ -1468,10 +1467,10 @@ public DenseVectorIndexOptions parseIndexOptions(String fieldName, Map<String, ?
14681467
}
14691468
}
14701469

1471-
boolean disableOffheapCacheRescoring = XContentMapValues.nodeBooleanValue(disableOffheapCacheRescoringNode, false);
1470+
boolean directRawVectorReads = XContentMapValues.nodeBooleanValue(directRawVectorReadsNode, false);
14721471

14731472
MappingParser.checkNoRemainingFields(fieldName, indexOptionsMap);
1474-
return new BBQHnswIndexOptions(m, efConstruction, rescoreVector, disableOffheapCacheRescoring);
1473+
return new BBQHnswIndexOptions(m, efConstruction, rescoreVector, directRawVectorReads);
14751474
}
14761475

14771476
@Override
@@ -2019,21 +2018,19 @@ public String toString() {
20192018
public static class BBQHnswIndexOptions extends QuantizedIndexOptions {
20202019
private final int m;
20212020
private final int efConstruction;
2022-
private final boolean disableOffheapCacheRescoring;
2021+
private final boolean directRawVectorReads;
20232022

2024-
public BBQHnswIndexOptions(int m, int efConstruction, RescoreVector rescoreVector, boolean disableOffheapCacheRescoring) {
2023+
public BBQHnswIndexOptions(int m, int efConstruction, RescoreVector rescoreVector, boolean directRawVectorReads) {
20252024
super(VectorIndexType.BBQ_HNSW, rescoreVector);
20262025
this.m = m;
20272026
this.efConstruction = efConstruction;
2028-
this.disableOffheapCacheRescoring = disableOffheapCacheRescoring;
2027+
this.directRawVectorReads = directRawVectorReads;
20292028
}
20302029

20312030
@Override
20322031
KnnVectorsFormat getVectorsFormat(ElementType elementType) {
20332032
assert elementType == ElementType.FLOAT;
2034-
return disableOffheapCacheRescoring
2035-
? new DirectIOES818HnswBinaryQuantizedVectorsFormat(m, efConstruction)
2036-
: new ES818HnswBinaryQuantizedVectorsFormat(m, efConstruction);
2033+
return new ES818HnswBinaryQuantizedVectorsFormat(m, efConstruction);
20372034
}
20382035

20392036
@Override
@@ -2048,12 +2045,12 @@ boolean doEquals(DenseVectorIndexOptions other) {
20482045
return m == that.m
20492046
&& efConstruction == that.efConstruction
20502047
&& Objects.equals(rescoreVector, that.rescoreVector)
2051-
&& disableOffheapCacheRescoring == that.disableOffheapCacheRescoring;
2048+
&& directRawVectorReads == that.directRawVectorReads;
20522049
}
20532050

20542051
@Override
20552052
int doHashCode() {
2056-
return Objects.hash(m, efConstruction, rescoreVector, disableOffheapCacheRescoring);
2053+
return Objects.hash(m, efConstruction, rescoreVector, directRawVectorReads);
20572054
}
20582055

20592056
@Override
@@ -2067,7 +2064,7 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
20672064
builder.field("type", type);
20682065
builder.field("m", m);
20692066
builder.field("ef_construction", efConstruction);
2070-
if (disableOffheapCacheRescoring) {
2067+
if (directRawVectorReads) {
20712068
builder.field("disable_offheap_cache_rescoring", true);
20722069
}
20732070
if (rescoreVector != null) {

server/src/main/resources/META-INF/services/org.apache.lucene.codecs.KnnVectorsFormat

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,4 @@ org.elasticsearch.index.codec.vectors.es816.ES816BinaryQuantizedVectorsFormat
77
org.elasticsearch.index.codec.vectors.es816.ES816HnswBinaryQuantizedVectorsFormat
88
org.elasticsearch.index.codec.vectors.es818.ES818BinaryQuantizedVectorsFormat
99
org.elasticsearch.index.codec.vectors.es818.ES818HnswBinaryQuantizedVectorsFormat
10-
org.elasticsearch.index.codec.vectors.es818.DirectIOES818BinaryQuantizedVectorsFormat
11-
org.elasticsearch.index.codec.vectors.es818.DirectIOES818HnswBinaryQuantizedVectorsFormat
1210
org.elasticsearch.index.codec.vectors.diskbbq.ES920DiskBBQVectorsFormat

server/src/test/java/org/elasticsearch/index/codec/vectors/es818/DirectIOES818BinaryQuantizedVectorsFormatTests.java

Lines changed: 0 additions & 85 deletions
This file was deleted.

0 commit comments

Comments
 (0)