Skip to content

Commit 4fc9797

Browse files
author
Jack Hung
committed
Renamed BBQ to Lucene Scalar Quantized
1 parent 28b94be commit 4fc9797

File tree

20 files changed

+138
-139
lines changed

20 files changed

+138
-139
lines changed

qa/restart-upgrade/build.gradle

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ task testAgainstOldCluster(type: StandaloneRestIntegTestTask) {
111111
}
112112

113113
// excludes: 1.any; 2.x where x < 17
114-
def invalidPrefixesForQFrameBitEncoderAndLuceneBBQBWCChecks = ['1.'] + ((0..16).collect { "2.${it}." } as Collection<String>)
115-
if (invalidPrefixesForQFrameBitEncoderAndLuceneBBQBWCChecks.any { knn_bwc_version.startsWith(it) }
114+
def invalidPrefixesForQFrameBitEncoderAndLuceneScalarQuantizedBWCChecks = ['1.'] + ((0..16).collect { "2.${it}." } as Collection<String>)
115+
if (invalidPrefixesForQFrameBitEncoderAndLuceneScalarQuantizedBWCChecks.any { knn_bwc_version.startsWith(it) }
116116
) {
117117
filter {
118118
excludeTestsMatching "org.opensearch.knn.bwc.IndexingIT.testKNNIndexLucene4xBWC"
@@ -273,8 +273,8 @@ task testRestartUpgrade(type: StandaloneRestIntegTestTask) {
273273
}
274274
}
275275

276-
def invalidPrefixesForQFrameBitEncoderAndLuceneBBQBWCChecks = ['1.'] + ((0..16).collect { "2.${it}." } as Collection<String>)
277-
if (invalidPrefixesForQFrameBitEncoderAndLuceneBBQBWCChecks.any { knn_bwc_version.startsWith(it) }) {
276+
def invalidPrefixesForQFrameBitEncoderAndLuceneScalarQuantizedBWCChecks = ['1.'] + ((0..16).collect { "2.${it}." } as Collection<String>)
277+
if (invalidPrefixesForQFrameBitEncoderAndLuceneScalarQuantizedBWCChecks.any { knn_bwc_version.startsWith(it) }) {
278278
filter {
279279
excludeTestsMatching "org.opensearch.knn.bwc.IndexingIT.testKNNIndexLucene4xBWC"
280280
excludeTestsMatching "org.opensearch.knn.bwc.IndexingIT.testKNNIndexLuceneOnDiskNoCompressionBWC"
@@ -344,10 +344,10 @@ task testRestartUpgrade(type: StandaloneRestIntegTestTask) {
344344
}
345345
}
346346

347-
def invalidPrefixesForLuceneBBQChecks = ['1.', '2.'] + ((0..5).collect { "3.${it}." } as Collection<String>)
348-
if (invalidPrefixesForLuceneBBQChecks.any { knn_bwc_version.startsWith(it) }) {
347+
def invalidPrefixesForLuceneScalarQuantizedChecks = ['1.', '2.'] + ((0..5).collect { "3.${it}." } as Collection<String>)
348+
if (invalidPrefixesForLuceneScalarQuantizedChecks.any { knn_bwc_version.startsWith(it) }) {
349349
filter {
350-
excludeTestsMatching "org.opensearch.knn.bwc.IndexingIT.testKNNIndexLuceneBBQ"
350+
excludeTestsMatching "org.opensearch.knn.bwc.IndexingIT.testKNNIndexLuceneScalarQuantized"
351351
}
352352
}
353353

qa/restart-upgrade/src/test/java/org/opensearch/knn/bwc/IndexingIT.java

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
import static org.opensearch.knn.common.KNNConstants.MODE_PARAMETER;
5252
import static org.opensearch.knn.common.KNNConstants.NAME;
5353
import static org.opensearch.knn.common.KNNConstants.PARAMETERS;
54-
import static org.opensearch.knn.common.KNNConstants.ENCODER_BBQ;
54+
import static org.opensearch.knn.common.KNNConstants.ENCODER_LUCENE_SCALAR_QUANTIZED;
5555

5656
public class IndexingIT extends AbstractRestartUpgradeTestCase {
5757
private static final String TEST_FIELD = "test-field";
@@ -204,7 +204,7 @@ public void testKNNRadialSearchAfterUpgrade() throws Exception {
204204
public void testKNNIndexLuceneQuantization() throws Exception {
205205
waitForClusterHealthGreen(NODES_BWC_CLUSTER);
206206
int k = 4;
207-
int dimension = 2;
207+
int dimension = 8;
208208

209209
if (isRunningAgainstOldCluster()) {
210210
String mapping = XContentFactory.jsonBuilder()
@@ -231,24 +231,24 @@ public void testKNNIndexLuceneQuantization() throws Exception {
231231
.toString();
232232
createKnnIndex(testIndex, getKNNDefaultIndexSettings(), mapping);
233233

234-
Float[] vector1 = { -10.6f, 25.48f };
235-
Float[] vector2 = { -10.8f, 25.48f };
236-
Float[] vector3 = { -11.0f, 25.48f };
237-
Float[] vector4 = { -11.2f, 25.48f };
234+
Float[] vector1 = { -10.6f, 25.48f, 1.2f, 3.4f, -5.6f, 7.8f, -9.0f, 11.2f };
235+
Float[] vector2 = { -10.8f, 25.48f, 1.4f, 3.6f, -5.8f, 8.0f, -9.2f, 11.4f };
236+
Float[] vector3 = { -11.0f, 25.48f, 1.6f, 3.8f, -6.0f, 8.2f, -9.4f, 11.6f };
237+
Float[] vector4 = { -11.2f, 25.48f, 1.8f, 4.0f, -6.2f, 8.4f, -9.6f, 11.8f };
238238
addKnnDoc(testIndex, "1", TEST_FIELD, vector1);
239239
addKnnDoc(testIndex, "2", TEST_FIELD, vector2);
240240
addKnnDoc(testIndex, "3", TEST_FIELD, vector3);
241241
addKnnDoc(testIndex, "4", TEST_FIELD, vector4);
242242

243-
float[] queryVector = { -10.5f, 25.48f };
243+
float[] queryVector = { -10.5f, 25.48f, 1.0f, 3.2f, -5.4f, 7.6f, -8.8f, 11.0f };
244244
Response searchResponse = searchKNNIndex(testIndex, new KNNQueryBuilder(TEST_FIELD, queryVector, k), k);
245245
List<KNNResult> results = parseSearchResponse(EntityUtils.toString(searchResponse.getEntity()), TEST_FIELD);
246246
assertEquals(k, results.size());
247247
for (int i = 0; i < k; i++) {
248248
assertEquals(k - i, Integer.parseInt(results.get(i).getDocId()));
249249
}
250250
} else {
251-
float[] queryVector = { -10.5f, 25.48f };
251+
float[] queryVector = { -10.5f, 25.48f, 1.0f, 3.2f, -5.4f, 7.6f, -8.8f, 11.0f };
252252
Response searchResponse = searchKNNIndex(testIndex, new KNNQueryBuilder(TEST_FIELD, queryVector, k), k);
253253
List<KNNResult> results = parseSearchResponse(EntityUtils.toString(searchResponse.getEntity()), TEST_FIELD);
254254
assertEquals(k, results.size());
@@ -674,7 +674,7 @@ public void testRandomRotationBWC() throws Exception {
674674
}
675675
}
676676

677-
private void testKNNAfterBBQIntegrationBWCRunner(String mapping) throws Exception {
677+
private void testKNNAfterLuceneScalarQuantizedIntegrationBWCRunner(String mapping) throws Exception {
678678
waitForClusterHealthGreen(NODES_BWC_CLUSTER);
679679
int k = 4;
680680
int dimension = 8;
@@ -730,7 +730,7 @@ public void testKNNIndexLucene4xBWC() throws Exception {
730730
.endObject()
731731
.endObject()
732732
.toString();
733-
testKNNAfterBBQIntegrationBWCRunner(mapping);
733+
testKNNAfterLuceneScalarQuantizedIntegrationBWCRunner(mapping);
734734
}
735735

736736
public void testKNNIndexLuceneOnDiskNoCompressionBWC() throws Exception {
@@ -753,20 +753,20 @@ public void testKNNIndexLuceneOnDiskNoCompressionBWC() throws Exception {
753753
.endObject()
754754
.endObject()
755755
.toString();
756-
testKNNAfterBBQIntegrationBWCRunner(mapping);
756+
testKNNAfterLuceneScalarQuantizedIntegrationBWCRunner(mapping);
757757
}
758758

759-
public void testKNNIndexLuceneBBQ() throws Exception {
759+
public void testKNNIndexLuceneScalarQuantized() throws Exception {
760760
waitForClusterHealthGreen(NODES_BWC_CLUSTER);
761761

762-
// Skip test if BBQ encoder is not supported in the old cluster version
763-
if (isBBQEncoderSupported(getBWCVersion()) == false) {
764-
logger.info("Skipping testKNNIndexLuceneBBQ as BBQ encoder is not supported in version: {}", getBWCVersion());
762+
// Skip test if LuceneScalarQuantized encoder is not supported in the old cluster version
763+
if (isLuceneScalarQuantizedEncoderSupported(getBWCVersion()) == false) {
764+
logger.info("Skipping testKNNIndexLuceneScalarQuantized as LuceneScalarQuantized encoder is not supported in version: {}", getBWCVersion());
765765
return;
766766
}
767767

768768
int k = 4;
769-
int dimension = 2;
769+
int dimension = 8;
770770

771771
if (isRunningAgainstOldCluster()) {
772772
String mapping = XContentFactory.jsonBuilder()
@@ -781,7 +781,7 @@ public void testKNNIndexLuceneBBQ() throws Exception {
781781
.field(KNN_ENGINE, LUCENE_NAME)
782782
.startObject(PARAMETERS)
783783
.startObject(METHOD_ENCODER_PARAMETER)
784-
.field(NAME, ENCODER_BBQ)
784+
.field(NAME, ENCODER_LUCENE_SCALAR_QUANTIZED)
785785
.endObject()
786786
.field(METHOD_PARAMETER_EF_CONSTRUCTION, 256)
787787
.field(METHOD_PARAMETER_M, 16)
@@ -793,24 +793,24 @@ public void testKNNIndexLuceneBBQ() throws Exception {
793793
.toString();
794794
createKnnIndex(testIndex, getKNNDefaultIndexSettings(), mapping);
795795

796-
Float[] vector1 = { -10.6f, 25.48f };
797-
Float[] vector2 = { -10.8f, 25.48f };
798-
Float[] vector3 = { -11.0f, 25.48f };
799-
Float[] vector4 = { -11.2f, 25.48f };
796+
Float[] vector1 = { -10.6f, 25.48f, 1.2f, 3.4f, -5.6f, 7.8f, -9.0f, 11.2f };
797+
Float[] vector2 = { -10.8f, 25.48f, 1.4f, 3.6f, -5.8f, 8.0f, -9.2f, 11.4f };
798+
Float[] vector3 = { -11.0f, 25.48f, 1.6f, 3.8f, -6.0f, 8.2f, -9.4f, 11.6f };
799+
Float[] vector4 = { -11.2f, 25.48f, 1.8f, 4.0f, -6.2f, 8.4f, -9.6f, 11.8f };
800800
addKnnDoc(testIndex, "1", TEST_FIELD, vector1);
801801
addKnnDoc(testIndex, "2", TEST_FIELD, vector2);
802802
addKnnDoc(testIndex, "3", TEST_FIELD, vector3);
803803
addKnnDoc(testIndex, "4", TEST_FIELD, vector4);
804804

805-
float[] queryVector = { -10.5f, 25.48f };
805+
float[] queryVector = { -10.5f, 25.48f, 1.0f, 3.2f, -5.4f, 7.6f, -8.8f, 11.0f };
806806
Response searchResponse = searchKNNIndex(testIndex, new KNNQueryBuilder(TEST_FIELD, queryVector, k), k);
807807
List<KNNResult> results = parseSearchResponse(EntityUtils.toString(searchResponse.getEntity()), TEST_FIELD);
808808
assertEquals(k, results.size());
809809
for (int i = 0; i < k; i++) {
810810
assertEquals(k - i, Integer.parseInt(results.get(i).getDocId()));
811811
}
812812
} else {
813-
float[] queryVector = { -10.5f, 25.48f };
813+
float[] queryVector = { -10.5f, 25.48f, 1.0f, 3.2f, -5.4f, 7.6f, -8.8f, 11.0f };
814814
Response searchResponse = searchKNNIndex(testIndex, new KNNQueryBuilder(TEST_FIELD, queryVector, k), k);
815815
List<KNNResult> results = parseSearchResponse(EntityUtils.toString(searchResponse.getEntity()), TEST_FIELD);
816816
assertEquals(k, results.size());

src/main/java/org/opensearch/knn/common/KNNConstants.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,9 @@ public class KNNConstants {
105105
public static final double MAXIMUM_CONFIDENCE_INTERVAL = 1.0;
106106
public static final String LUCENE_SQ_BITS = "bits";
107107
public static final int LUCENE_SQ_DEFAULT_BITS = 7;
108-
public static final String ENCODER_BBQ = "bbq";
109-
public static final int LUCENE_BBQ_DEFAULT_BITS = 1;
110-
public static final String LUCENE_BBQ_BITS = "bits";
108+
public static final String ENCODER_LUCENE_SCALAR_QUANTIZED = "bbq";
109+
public static final int LUCENE_SCALAR_QUANTIZED_DEFAULT_BITS = 1;
110+
public static final String LUCENE_SCALAR_QUANTIZED_BITS = "bits";
111111
public static final String MAX_CONNECTIONS = "max_connections";
112112
public static final String BEAM_WIDTH = "beam_width";
113113

src/main/java/org/opensearch/knn/index/codec/KNN1040Codec/KNN1040PerFieldKnnVectorsFormat.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ private static Map<LuceneVectorsFormatType, Function<KnnVectorsFormatContext, Kn
9191
p.getConfidenceInterval(),
9292
merge.v2()
9393
);
94-
}, LuceneVectorsFormatType.BBQ, ctx -> {
94+
}, LuceneVectorsFormatType.LUCENE_SCALAR_QUANTIZED, ctx -> {
9595
final KNN1040ScalarQuantizedVectorsFormatParams p = new KNN1040ScalarQuantizedVectorsFormatParams(
9696
ctx.getParams(),
9797
ctx.getDefaultMaxConnections(),

src/main/java/org/opensearch/knn/index/codec/LuceneVectorsFormatType.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ public enum LuceneVectorsFormatType {
3232
SCALAR_QUANTIZED,
3333

3434
/**
35-
* HNSW format with scalar quantization (SQ) and BBQ encoding.
35+
* HNSW format with scalar quantization (SQ) and binary quantization encoding.
3636
*/
37-
BBQ,
37+
LUCENE_SCALAR_QUANTIZED,
3838

3939
/**
4040
* Flat vector format (e.g., BBQ flat via Lucene).

src/main/java/org/opensearch/knn/index/codec/params/KNN1040ScalarQuantizedVectorsFormatParams.java

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,44 +12,43 @@
1212
import java.util.Map;
1313
import java.util.Set;
1414

15-
import static org.opensearch.knn.common.KNNConstants.ENCODER_BBQ;
16-
import static org.opensearch.knn.common.KNNConstants.LUCENE_BBQ_BITS;
17-
import static org.opensearch.knn.common.KNNConstants.LUCENE_BBQ_DEFAULT_BITS;
15+
import static org.opensearch.knn.common.KNNConstants.ENCODER_LUCENE_SCALAR_QUANTIZED;
16+
import static org.opensearch.knn.common.KNNConstants.LUCENE_SCALAR_QUANTIZED_BITS;
17+
import static org.opensearch.knn.common.KNNConstants.LUCENE_SCALAR_QUANTIZED_DEFAULT_BITS;
1818
import static org.opensearch.knn.common.KNNConstants.METHOD_ENCODER_PARAMETER;
1919

2020
/**
2121
* Class provides params for Lucene104HnswScalarQuantizedVectorsFormat
2222
*/
2323
@Getter
2424
public class KNN1040ScalarQuantizedVectorsFormatParams extends KNNVectorsFormatParams {
25-
private static final Set<String> SUPPORTED_ENCODERS = Set.of(ENCODER_BBQ);
25+
private static final Set<String> SUPPORTED_ENCODERS = Set.of(ENCODER_LUCENE_SCALAR_QUANTIZED);
2626
private String encoderName;
2727
private ScalarEncoding bitEncoding;
2828

2929
public KNN1040ScalarQuantizedVectorsFormatParams(Map<String, Object> params, int defaultMaxConnections, int defaultBeamWidth) {
3030
super(params, defaultMaxConnections, defaultBeamWidth);
31-
MethodComponentContext encoderMethodComponentContext = (MethodComponentContext) params.get(METHOD_ENCODER_PARAMETER);
32-
Map<String, Object> encoderParams = encoderMethodComponentContext.getParameters();
33-
this.encoderName = this.resolveEncoderName(params);
34-
if (this.encoderName != null) this.initBits(encoderParams);
31+
initFields(params);
3532
}
3633

37-
private String resolveEncoderName(Map<String, Object> params) {
34+
private void initFields(Map<String, Object> params) {
3835
if (params.get(METHOD_ENCODER_PARAMETER) == null) {
39-
return null;
36+
return;
4037
}
4138

4239
if ((params.get(METHOD_ENCODER_PARAMETER) instanceof MethodComponentContext) == false) {
43-
return null;
40+
return;
4441
}
4542

4643
MethodComponentContext encoderMethodComponentContext = (MethodComponentContext) params.get(METHOD_ENCODER_PARAMETER);
47-
return encoderMethodComponentContext.getName();
44+
this.encoderName = encoderMethodComponentContext.getName();
45+
Map<String, Object> encoderParams = encoderMethodComponentContext.getParameters();
46+
if (this.encoderName != null) this.initBits(encoderParams);
4847
}
4948

5049
@Override
5150
public boolean validate(final Map<String, Object> params) {
52-
return encoderName != null && SUPPORTED_ENCODERS.contains(encoderName);
51+
return this.encoderName != null && SUPPORTED_ENCODERS.contains(this.encoderName);
5352
}
5453

5554
private ScalarEncoding getOrDefaultBitsForEncoder(final Map<String, Object> params, String bitsKey, int defaultBits) {
@@ -60,6 +59,6 @@ private ScalarEncoding getOrDefaultBitsForEncoder(final Map<String, Object> para
6059
}
6160

6261
private void initBits(final Map<String, Object> params) {
63-
this.bitEncoding = getOrDefaultBitsForEncoder(params, LUCENE_BBQ_BITS, LUCENE_BBQ_DEFAULT_BITS);
62+
this.bitEncoding = getOrDefaultBitsForEncoder(params, LUCENE_SCALAR_QUANTIZED_BITS, LUCENE_SCALAR_QUANTIZED_DEFAULT_BITS);
6463
}
6564
}

src/main/java/org/opensearch/knn/index/engine/lucene/LuceneCodecFormatResolver.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -107,22 +107,22 @@ private LuceneVectorsFormatType determineFormatType(
107107
);
108108
return LuceneVectorsFormatType.SCALAR_QUANTIZED;
109109
} else {
110-
// Temporary route for BBQ - eventually this should be used for SQ as well
111-
KNN1040ScalarQuantizedVectorsFormatParams sqBBQParams = new KNN1040ScalarQuantizedVectorsFormatParams(
110+
// Temporary route for LuceneScalarQuantized - eventually this should be used for SQ as well
111+
KNN1040ScalarQuantizedVectorsFormatParams luceneScalarQuantizedParams = new KNN1040ScalarQuantizedVectorsFormatParams(
112112
params,
113113
defaultMaxConnections,
114114
defaultBeamWidth
115115
);
116-
if (sqBBQParams.validate(params)) {
116+
if (luceneScalarQuantizedParams.validate(params)) {
117117
log.debug(
118118
"Initialize KNN vector format for field [{}] with scalar/binary quantization, params [{}] = \"{}\", [{}] = \"{}\"",
119119
field,
120120
MAX_CONNECTIONS,
121-
sqBBQParams.getMaxConnections(),
121+
luceneScalarQuantizedParams.getMaxConnections(),
122122
BEAM_WIDTH,
123-
sqBBQParams.getBeamWidth()
123+
luceneScalarQuantizedParams.getBeamWidth()
124124
);
125-
return LuceneVectorsFormatType.BBQ;
125+
return LuceneVectorsFormatType.LUCENE_SCALAR_QUANTIZED;
126126
}
127127
}
128128
}

src/main/java/org/opensearch/knn/index/engine/lucene/LuceneHNSWMethod.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ public class LuceneHNSWMethod extends AbstractKNNMethod {
4545
);
4646

4747
final static Encoder SQ_ENCODER = new LuceneSQEncoder();
48-
final static Encoder BBQ_ENCODER = new LuceneBBQEncoder();
49-
final static Map<String, Encoder> SUPPORTED_ENCODERS = Map.of(SQ_ENCODER.getName(), SQ_ENCODER, BBQ_ENCODER.getName(), BBQ_ENCODER);
48+
final static Encoder LUCENE_SCALAR_QUANTIZED_ENCODER = new LuceneScalarQuantizedEncoder();
49+
final static Map<String, Encoder> SUPPORTED_ENCODERS = Map.of(SQ_ENCODER.getName(), SQ_ENCODER, LUCENE_SCALAR_QUANTIZED_ENCODER.getName(), LUCENE_SCALAR_QUANTIZED_ENCODER);
5050

5151
final static MethodComponent HNSW_METHOD_COMPONENT = initMethodComponent();
5252

src/main/java/org/opensearch/knn/index/engine/lucene/LuceneHNSWMethodResolver.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,10 @@ protected void resolveEncoder(KNNMethodContext resolvedKNNMethodContext, KNNMeth
8383
String encoderName;
8484
MethodComponent encoderComponent;
8585

86-
// Use BBQ for ON_DISK by default (since compression level resolves to x32 by default for ON_DISK)
86+
// Use Lucene Scalar Quantized for ON_DISK by default (since compression level resolves to x32 by default for ON_DISK)
8787
if (knnMethodConfigContext.getVersionCreated().onOrAfter(Version.V_3_6_0) && resolvedCompressionLevel == CompressionLevel.x32) {
88-
encoderName = LuceneHNSWMethod.BBQ_ENCODER.getName();
89-
encoderComponent = LuceneHNSWMethod.BBQ_ENCODER.getMethodComponent();
88+
encoderName = LuceneHNSWMethod.LUCENE_SCALAR_QUANTIZED_ENCODER.getName();
89+
encoderComponent = LuceneHNSWMethod.LUCENE_SCALAR_QUANTIZED_ENCODER.getMethodComponent();
9090
} else {
9191
encoderName = LuceneHNSWMethod.SQ_ENCODER.getName();
9292
encoderComponent = LuceneHNSWMethod.SQ_ENCODER.getMethodComponent();
@@ -122,7 +122,7 @@ private CompressionLevel getDefaultCompressionLevel(KNNMethodConfigContext knnMe
122122
return knnMethodConfigContext.getCompressionLevel();
123123
}
124124
if (knnMethodConfigContext.getMode() == Mode.ON_DISK) {
125-
// Starting with version 3.6, supporting BBQ by default
125+
// Starting with version 3.6, supporting Lucene Scalar Quantized by default
126126
if (knnMethodConfigContext.getVersionCreated().onOrAfter(Version.V_3_6_0)) {
127127
return CompressionLevel.x32;
128128
}

src/main/java/org/opensearch/knn/index/engine/lucene/LuceneBBQEncoder.java renamed to src/main/java/org/opensearch/knn/index/engine/lucene/LuceneScalarQuantizedEncoder.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,18 @@
1616
import static org.opensearch.knn.common.KNNConstants.*;
1717

1818
/**
19-
* Lucene BBQ (Better Binary Quantization) encoder
19+
* Lucene Scalar Quantized encoder
2020
*/
21-
public class LuceneBBQEncoder implements Encoder {
21+
public class LuceneScalarQuantizedEncoder implements Encoder {
2222
private static final Set<VectorDataType> SUPPORTED_DATA_TYPES = ImmutableSet.of(VectorDataType.FLOAT);
2323

24-
private final static List<Integer> LUCENE_BBQ_BITS_SUPPORTED = List.of(1);
24+
private final static List<Integer> LUCENE_SCALAR_QUANTIZED_BITS_SUPPORTED = List.of(1);
2525

26-
private final static MethodComponent METHOD_COMPONENT = MethodComponent.Builder.builder(ENCODER_BBQ)
26+
private final static MethodComponent METHOD_COMPONENT = MethodComponent.Builder.builder(ENCODER_LUCENE_SCALAR_QUANTIZED)
2727
.addSupportedDataTypes(SUPPORTED_DATA_TYPES)
2828
.addParameter(
29-
LUCENE_BBQ_BITS,
30-
new Parameter.IntegerParameter(LUCENE_BBQ_BITS, LUCENE_BBQ_DEFAULT_BITS, (v, context) -> LUCENE_BBQ_BITS_SUPPORTED.contains(v))
29+
LUCENE_SCALAR_QUANTIZED_BITS,
30+
new Parameter.IntegerParameter(LUCENE_SCALAR_QUANTIZED_BITS, LUCENE_SCALAR_QUANTIZED_DEFAULT_BITS, (v, context) -> LUCENE_SCALAR_QUANTIZED_BITS_SUPPORTED.contains(v))
3131
)
3232
.build();
3333

0 commit comments

Comments
 (0)