From fe5a4c73f70cc451f461bc007d1ce7d32481edb2 Mon Sep 17 00:00:00 2001 From: Geir Storli Date: Tue, 12 May 2020 15:52:15 +0000 Subject: Support specifying a distance metric for nearest neighbor search when not having a hnsw index. This also changes the syntax in the sd file to specifying the distance metric in the attribute tag. --- .../java/com/yahoo/searchdefinition/Index.java | 17 +------------- .../searchdefinition/derived/AttributeFields.java | 1 + .../yahoo/searchdefinition/document/Attribute.java | 7 +++--- .../fieldoperation/AttributeOperation.java | 10 ++++++++ .../fieldoperation/IndexOperation.java | 8 ------- .../processing/TensorFieldProcessor.java | 1 - config-model/src/main/javacc/SDParser.jj | 3 ++- .../src/test/derived/advanced/attributes.cfg | 1 + .../array_of_struct_attribute/attributes.cfg | 2 ++ .../test/derived/attributeprefetch/attributes.cfg | 18 +++++++++++++++ .../src/test/derived/attributes/attributes.cfg | 18 +++++++++++++++ .../src/test/derived/complex/attributes.cfg | 9 ++++++++ .../src/test/derived/hnsw_index/attributes.cfg | 27 ++++++++++++++++++++++ .../src/test/derived/hnsw_index/ilscripts.cfg | 2 ++ config-model/src/test/derived/hnsw_index/test.sd | 10 +++++++- .../derived/imported_position_field/attributes.cfg | 2 ++ .../derived/imported_struct_fields/attributes.cfg | 8 +++++++ .../src/test/derived/importedfields/attributes.cfg | 8 +++++++ .../src/test/derived/inheritance/attributes.cfg | 3 +++ .../test/derived/inheritfromparent/attributes.cfg | 1 + .../src/test/derived/map_attribute/attributes.cfg | 3 +++ .../derived/map_of_struct_attribute/attributes.cfg | 5 ++++ config-model/src/test/derived/music/attributes.cfg | 11 +++++++++ .../src/test/derived/newrank/attributes.cfg | 10 ++++++++ .../derived/predicate_attribute/attributes.cfg | 1 + .../derived/prefixexactattribute/attributes.cfg | 2 ++ .../test/derived/reference_fields/attributes.cfg | 3 +++ .../src/test/derived/sorting/attributes.cfg | 3 +++ .../src/test/derived/tensor/attributes.cfg | 5 ++++ config-model/src/test/derived/types/attributes.cfg | 13 +++++++++++ .../search/AttributeChangeValidatorTest.java | 12 ++++++++-- 31 files changed, 192 insertions(+), 32 deletions(-) (limited to 'config-model') diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/Index.java b/config-model/src/main/java/com/yahoo/searchdefinition/Index.java index aba6cf9a233..577639ead7a 100644 --- a/config-model/src/main/java/com/yahoo/searchdefinition/Index.java +++ b/config-model/src/main/java/com/yahoo/searchdefinition/Index.java @@ -24,8 +24,6 @@ import java.util.Set; */ public class Index implements Cloneable, Serializable { - public static enum DistanceMetric { EUCLIDEAN, ANGULAR, GEODEGREES } - public enum Type { VESPA("vespa"); @@ -65,8 +63,6 @@ public class Index implements Cloneable, Serializable { private Optional hnswIndexParams = Optional.empty(); - private Optional distanceMetric = Optional.empty(); - /** Whether the posting lists of this index field should have interleaved features (num occs, field length) in document id stream. */ private boolean interleavedFeatures = false; @@ -138,13 +134,12 @@ public class Index implements Cloneable, Serializable { stemming == index.stemming && type == index.type && Objects.equals(boolIndex, index.boolIndex) && - Objects.equals(distanceMetric, index.distanceMetric) && Objects.equals(hnswIndexParams, index.hnswIndexParams); } @Override public int hashCode() { - return Objects.hash(name, rankType, prefix, aliases, stemming, normalized, type, boolIndex, distanceMetric, hnswIndexParams, interleavedFeatures); + return Objects.hash(name, rankType, prefix, aliases, stemming, normalized, type, boolIndex, hnswIndexParams, interleavedFeatures); } public String toString() { @@ -192,16 +187,6 @@ public class Index implements Cloneable, Serializable { boolIndex = def; } - public Optional getDistanceMetric() { - return distanceMetric; - } - - public void setDistanceMetric(String value) { - String upper = value.toUpperCase(Locale.ENGLISH); - DistanceMetric dm = DistanceMetric.valueOf(upper); - distanceMetric = Optional.of(dm); - } - public Optional getHnswIndexParams() { return hnswIndexParams; } diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/derived/AttributeFields.java b/config-model/src/main/java/com/yahoo/searchdefinition/derived/AttributeFields.java index 8b5f7658475..004e44a7659 100644 --- a/config-model/src/main/java/com/yahoo/searchdefinition/derived/AttributeFields.java +++ b/config-model/src/main/java/com/yahoo/searchdefinition/derived/AttributeFields.java @@ -241,6 +241,7 @@ public class AttributeFields extends Derived implements AttributesConfig.Produce } aaB.imported(imported); var dma = attribute.distanceMetric(); + aaB.distancemetric(AttributesConfig.Attribute.Distancemetric.Enum.valueOf(dma.toString())); if (attribute.hnswIndexParams().isPresent()) { var ib = new AttributesConfig.Attribute.Index.Builder(); var params = attribute.hnswIndexParams().get(); diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/document/Attribute.java b/config-model/src/main/java/com/yahoo/searchdefinition/document/Attribute.java index 1661a80f238..49d396327bf 100644 --- a/config-model/src/main/java/com/yahoo/searchdefinition/document/Attribute.java +++ b/config-model/src/main/java/com/yahoo/searchdefinition/document/Attribute.java @@ -24,7 +24,6 @@ import com.yahoo.document.datatypes.Float16FieldValue; import com.yahoo.document.datatypes.StringFieldValue; import com.yahoo.document.datatypes.TensorFieldValue; import com.yahoo.tensor.TensorType; -import static com.yahoo.searchdefinition.Index.DistanceMetric; import java.io.Serializable; import java.util.LinkedHashSet; @@ -40,6 +39,8 @@ import java.util.Set; */ public final class Attribute implements Cloneable, Serializable { + public enum DistanceMetric { EUCLIDEAN, ANGULAR, GEODEGREES } + // Remember to change hashCode and equals when you add new fields private String name; @@ -228,7 +229,7 @@ public final class Attribute implements Cloneable, Serializable { public void setUpperBound(long upperBound) { this.upperBound = upperBound; } public void setDensePostingListThreshold(double threshold) { this.densePostingListThreshold = threshold; } public void setTensorType(TensorType tensorType) { this.tensorType = Optional.of(tensorType); } - public void setDistanceMetric(Optional dm) { this.distanceMetric = dm; } + public void setDistanceMetric(DistanceMetric metric) { this.distanceMetric = Optional.of(metric); } public void setHnswIndexParams(HnswIndexParams params) { this.hnswIndexParams = Optional.of(params); } public String getName() { return name; } @@ -348,7 +349,7 @@ public final class Attribute implements Cloneable, Serializable { public int hashCode() { return Objects.hash( name, type, collectionType, sorting, isPrefetch(), fastAccess, removeIfZero, createIfNonExistent, - isPosition, huge, enableBitVectors, enableOnlyBitVector, tensorType, referenceDocumentType, hnswIndexParams); + isPosition, huge, enableBitVectors, enableOnlyBitVector, tensorType, referenceDocumentType, distanceMetric, hnswIndexParams); } @Override diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/fieldoperation/AttributeOperation.java b/config-model/src/main/java/com/yahoo/searchdefinition/fieldoperation/AttributeOperation.java index 861a9f530d4..b638932a4a8 100644 --- a/config-model/src/main/java/com/yahoo/searchdefinition/fieldoperation/AttributeOperation.java +++ b/config-model/src/main/java/com/yahoo/searchdefinition/fieldoperation/AttributeOperation.java @@ -5,6 +5,7 @@ import com.yahoo.searchdefinition.document.Attribute; import com.yahoo.searchdefinition.document.SDField; import com.yahoo.tensor.TensorType; +import java.util.Locale; import java.util.Optional; /** @@ -24,6 +25,7 @@ public class AttributeOperation implements FieldOperation, FieldOperationContain private String alias; private String aliasedName; private Optional tensorType = Optional.empty(); + private Optional distanceMetric = Optional.empty(); public AttributeOperation(String name) { this.name = name; @@ -116,6 +118,10 @@ public class AttributeOperation implements FieldOperation, FieldOperationContain this.tensorType = Optional.of(tensorType); } + public void setDistanceMetric(String value) { + this.distanceMetric = Optional.of(value); + } + public void apply(SDField field) { Attribute attribute = null; if (attributeIsSuffixOfStructField(field.getName())) { @@ -153,6 +159,10 @@ public class AttributeOperation implements FieldOperation, FieldOperationContain if (tensorType.isPresent()) { attribute.setTensorType(tensorType.get()); } + if (distanceMetric.isPresent()) { + String upper = distanceMetric.get().toUpperCase(Locale.ENGLISH); + attribute.setDistanceMetric(Attribute.DistanceMetric.valueOf(upper)); + } } private boolean attributeIsSuffixOfStructField(String fieldName) { diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/fieldoperation/IndexOperation.java b/config-model/src/main/java/com/yahoo/searchdefinition/fieldoperation/IndexOperation.java index 0c1f443dee3..7f9da28b9ca 100644 --- a/config-model/src/main/java/com/yahoo/searchdefinition/fieldoperation/IndexOperation.java +++ b/config-model/src/main/java/com/yahoo/searchdefinition/fieldoperation/IndexOperation.java @@ -32,7 +32,6 @@ public class IndexOperation implements FieldOperation { private OptionalDouble densePostingListThreshold = OptionalDouble.empty(); private Optional enableBm25 = Optional.empty(); - private Optional distanceMetric = Optional.empty(); private Optional hnswIndexParams = Optional.empty(); public String getIndexName() { @@ -95,9 +94,6 @@ public class IndexOperation implements FieldOperation { if (enableBm25.isPresent()) { index.setInterleavedFeatures(enableBm25.get()); } - if (distanceMetric.isPresent()) { - index.setDistanceMetric(distanceMetric.get()); - } if (hnswIndexParams.isPresent()) { index.setHnswIndexParams(hnswIndexParams.get().build()); } @@ -131,10 +127,6 @@ public class IndexOperation implements FieldOperation { enableBm25 = Optional.of(value); } - public void setDistanceMetric(String value) { - this.distanceMetric = Optional.of(value); - } - public void setHnswIndexParams(HnswIndexParams.Builder params) { this.hnswIndexParams = Optional.of(params); } diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/processing/TensorFieldProcessor.java b/config-model/src/main/java/com/yahoo/searchdefinition/processing/TensorFieldProcessor.java index c97ee2bd935..8010be5043e 100644 --- a/config-model/src/main/java/com/yahoo/searchdefinition/processing/TensorFieldProcessor.java +++ b/config-model/src/main/java/com/yahoo/searchdefinition/processing/TensorFieldProcessor.java @@ -83,7 +83,6 @@ public class TensorFieldProcessor extends Processor { var params = new HnswIndexParams(); if (index != null) { params = params.overrideFrom(index.getHnswIndexParams()); - field.getAttribute().setDistanceMetric(index.getDistanceMetric()); } field.getAttribute().setHnswIndexParams(params); } diff --git a/config-model/src/main/javacc/SDParser.jj b/config-model/src/main/javacc/SDParser.jj index 3560cf2cd84..043599dedbf 100644 --- a/config-model/src/main/javacc/SDParser.jj +++ b/config-model/src/main/javacc/SDParser.jj @@ -1212,6 +1212,7 @@ Object sortingSetting(SortingOperation sorting, String attributeName) : */ Object attributeSetting(FieldOperationContainer field, AttributeOperation attribute, String attributeName) : { + String str; } { ( @@ -1228,6 +1229,7 @@ Object attributeSetting(FieldOperationContainer field, AttributeOperation attrib attribute.setAliasedName(aliasedName); } | attributeTensorType(attribute) + | str = identifierWithDash() { attribute.setDistanceMetric(str); } ) { return null; } } @@ -1816,7 +1818,6 @@ Object indexBody(IndexOperation index) : | num = consumeLong() { index.setUpperBound(num); } | threshold = consumeFloat() { index.setDensePostingListThreshold(threshold); } | { index.setEnableBm25(true); } - | str = identifierWithDash() { index.setDistanceMetric(str); } | hnswIndex(index) { } ) { return null; } diff --git a/config-model/src/test/derived/advanced/attributes.cfg b/config-model/src/test/derived/advanced/attributes.cfg index 0a76e44c4ac..0217d957432 100644 --- a/config-model/src/test/derived/advanced/attributes.cfg +++ b/config-model/src/test/derived/advanced/attributes.cfg @@ -19,6 +19,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN diff --git a/config-model/src/test/derived/array_of_struct_attribute/attributes.cfg b/config-model/src/test/derived/array_of_struct_attribute/attributes.cfg index 006400c09d4..8391a8a9bdd 100644 --- a/config-model/src/test/derived/array_of_struct_attribute/attributes.cfg +++ b/config-model/src/test/derived/array_of_struct_attribute/attributes.cfg @@ -19,6 +19,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -44,6 +45,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN diff --git a/config-model/src/test/derived/attributeprefetch/attributes.cfg b/config-model/src/test/derived/attributeprefetch/attributes.cfg index cd91c15700b..448f9a82d36 100644 --- a/config-model/src/test/derived/attributeprefetch/attributes.cfg +++ b/config-model/src/test/derived/attributeprefetch/attributes.cfg @@ -19,6 +19,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -44,6 +45,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -69,6 +71,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -94,6 +97,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -119,6 +123,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -144,6 +149,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -169,6 +175,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -194,6 +201,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -219,6 +227,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -244,6 +253,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -269,6 +279,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -294,6 +305,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -319,6 +331,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -344,6 +357,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -369,6 +383,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -394,6 +409,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -419,6 +435,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -444,6 +461,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN diff --git a/config-model/src/test/derived/attributes/attributes.cfg b/config-model/src/test/derived/attributes/attributes.cfg index 29e4c209ef2..d88c6b8b70a 100644 --- a/config-model/src/test/derived/attributes/attributes.cfg +++ b/config-model/src/test/derived/attributes/attributes.cfg @@ -19,6 +19,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -44,6 +45,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -69,6 +71,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -94,6 +97,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -119,6 +123,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -144,6 +149,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -169,6 +175,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -194,6 +201,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -219,6 +227,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -244,6 +253,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -269,6 +279,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -294,6 +305,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -319,6 +331,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -344,6 +357,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -369,6 +383,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -394,6 +409,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -419,6 +435,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -444,6 +461,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN diff --git a/config-model/src/test/derived/complex/attributes.cfg b/config-model/src/test/derived/complex/attributes.cfg index 5606e5ea730..337b736471d 100644 --- a/config-model/src/test/derived/complex/attributes.cfg +++ b/config-model/src/test/derived/complex/attributes.cfg @@ -19,6 +19,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -44,6 +45,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -69,6 +71,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -94,6 +97,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -119,6 +123,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -144,6 +149,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -169,6 +175,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -194,6 +201,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -219,6 +227,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN diff --git a/config-model/src/test/derived/hnsw_index/attributes.cfg b/config-model/src/test/derived/hnsw_index/attributes.cfg index b61fd7e2ee5..087a116f4cd 100644 --- a/config-model/src/test/derived/hnsw_index/attributes.cfg +++ b/config-model/src/test/derived/hnsw_index/attributes.cfg @@ -19,7 +19,34 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "tensor(x[128])" attribute[].imported false +attribute[].distancemetric ANGULAR attribute[].index.hnsw.enabled true attribute[].index.hnsw.maxlinkspernode 32 attribute[].index.hnsw.distancemetric ANGULAR attribute[].index.hnsw.neighborstoexploreatinsert 300 +attribute[].name "t2" +attribute[].datatype TENSOR +attribute[].collectiontype SINGLE +attribute[].removeifzero false +attribute[].createifnonexistent false +attribute[].fastsearch false +attribute[].huge false +attribute[].ismutable false +attribute[].sortascending true +attribute[].sortfunction UCA +attribute[].sortstrength PRIMARY +attribute[].sortlocale "" +attribute[].enablebitvectors false +attribute[].enableonlybitvector false +attribute[].fastaccess false +attribute[].arity 8 +attribute[].lowerbound -9223372036854775808 +attribute[].upperbound 9223372036854775807 +attribute[].densepostinglistthreshold 0.4 +attribute[].tensortype "tensor(x[2])" +attribute[].imported false +attribute[].distancemetric GEODEGREES +attribute[].index.hnsw.enabled false +attribute[].index.hnsw.maxlinkspernode 16 +attribute[].index.hnsw.distancemetric EUCLIDEAN +attribute[].index.hnsw.neighborstoexploreatinsert 200 diff --git a/config-model/src/test/derived/hnsw_index/ilscripts.cfg b/config-model/src/test/derived/hnsw_index/ilscripts.cfg index e9fc265ca67..0c8266336b1 100644 --- a/config-model/src/test/derived/hnsw_index/ilscripts.cfg +++ b/config-model/src/test/derived/hnsw_index/ilscripts.cfg @@ -2,4 +2,6 @@ maxtermoccurrences 100 fieldmatchmaxlength 1000000 ilscript[].doctype "test" ilscript[].docfield[] "t1" +ilscript[].docfield[] "t2" ilscript[].content[] "clear_state | guard { input t1 | attribute t1 | index t1; }" +ilscript[].content[] "clear_state | guard { input t2 | attribute t2; }" diff --git a/config-model/src/test/derived/hnsw_index/test.sd b/config-model/src/test/derived/hnsw_index/test.sd index 207ed764a87..82291be9747 100644 --- a/config-model/src/test/derived/hnsw_index/test.sd +++ b/config-model/src/test/derived/hnsw_index/test.sd @@ -2,13 +2,21 @@ search test { document test { field t1 type tensor(x[128]) { indexing: attribute | index - index { + attribute { distance-metric: angular + } + index { hnsw { max-links-per-node: 32 neighbors-to-explore-at-insert: 300 } } } + field t2 type tensor(x[2]) { + indexing: attribute + attribute { + distance-metric: geodegrees + } + } } } diff --git a/config-model/src/test/derived/imported_position_field/attributes.cfg b/config-model/src/test/derived/imported_position_field/attributes.cfg index 8f68068c8e7..685f708768a 100644 --- a/config-model/src/test/derived/imported_position_field/attributes.cfg +++ b/config-model/src/test/derived/imported_position_field/attributes.cfg @@ -19,6 +19,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -44,6 +45,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported true +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN diff --git a/config-model/src/test/derived/imported_struct_fields/attributes.cfg b/config-model/src/test/derived/imported_struct_fields/attributes.cfg index eb87c6cf53e..e8b7a7b6235 100644 --- a/config-model/src/test/derived/imported_struct_fields/attributes.cfg +++ b/config-model/src/test/derived/imported_struct_fields/attributes.cfg @@ -19,6 +19,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -44,6 +45,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported true +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -69,6 +71,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported true +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -94,6 +97,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported true +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -119,6 +123,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported true +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -144,6 +149,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported true +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -169,6 +175,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported true +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -194,6 +201,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported true +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN diff --git a/config-model/src/test/derived/importedfields/attributes.cfg b/config-model/src/test/derived/importedfields/attributes.cfg index d3a51523e05..6f3514102b4 100644 --- a/config-model/src/test/derived/importedfields/attributes.cfg +++ b/config-model/src/test/derived/importedfields/attributes.cfg @@ -19,6 +19,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -44,6 +45,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -69,6 +71,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -94,6 +97,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported true +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -119,6 +123,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported true +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -144,6 +149,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported true +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -169,6 +175,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported true +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -194,6 +201,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported true +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN diff --git a/config-model/src/test/derived/inheritance/attributes.cfg b/config-model/src/test/derived/inheritance/attributes.cfg index 397d8878792..541092622ff 100644 --- a/config-model/src/test/derived/inheritance/attributes.cfg +++ b/config-model/src/test/derived/inheritance/attributes.cfg @@ -19,6 +19,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -44,6 +45,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -69,6 +71,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN diff --git a/config-model/src/test/derived/inheritfromparent/attributes.cfg b/config-model/src/test/derived/inheritfromparent/attributes.cfg index 3b30af10a8f..dda86f765be 100644 --- a/config-model/src/test/derived/inheritfromparent/attributes.cfg +++ b/config-model/src/test/derived/inheritfromparent/attributes.cfg @@ -19,6 +19,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN diff --git a/config-model/src/test/derived/map_attribute/attributes.cfg b/config-model/src/test/derived/map_attribute/attributes.cfg index 4de78c52efd..702e065d15a 100644 --- a/config-model/src/test/derived/map_attribute/attributes.cfg +++ b/config-model/src/test/derived/map_attribute/attributes.cfg @@ -19,6 +19,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -44,6 +45,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -69,6 +71,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN diff --git a/config-model/src/test/derived/map_of_struct_attribute/attributes.cfg b/config-model/src/test/derived/map_of_struct_attribute/attributes.cfg index 72e60b857a2..3eca0d5bbf8 100644 --- a/config-model/src/test/derived/map_of_struct_attribute/attributes.cfg +++ b/config-model/src/test/derived/map_of_struct_attribute/attributes.cfg @@ -19,6 +19,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -44,6 +45,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -69,6 +71,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -94,6 +97,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -119,6 +123,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN diff --git a/config-model/src/test/derived/music/attributes.cfg b/config-model/src/test/derived/music/attributes.cfg index 4d19dc69b33..f75b8e06b80 100644 --- a/config-model/src/test/derived/music/attributes.cfg +++ b/config-model/src/test/derived/music/attributes.cfg @@ -19,6 +19,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -44,6 +45,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -69,6 +71,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -94,6 +97,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -119,6 +123,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -144,6 +149,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -169,6 +175,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -194,6 +201,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -219,6 +227,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -244,6 +253,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -269,6 +279,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN diff --git a/config-model/src/test/derived/newrank/attributes.cfg b/config-model/src/test/derived/newrank/attributes.cfg index 2aed2288773..303ea35223a 100644 --- a/config-model/src/test/derived/newrank/attributes.cfg +++ b/config-model/src/test/derived/newrank/attributes.cfg @@ -19,6 +19,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -44,6 +45,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -69,6 +71,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -94,6 +97,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -119,6 +123,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -144,6 +149,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -169,6 +175,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -194,6 +201,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -219,6 +227,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -244,6 +253,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN diff --git a/config-model/src/test/derived/predicate_attribute/attributes.cfg b/config-model/src/test/derived/predicate_attribute/attributes.cfg index 3a9daf7af94..d095b68752a 100644 --- a/config-model/src/test/derived/predicate_attribute/attributes.cfg +++ b/config-model/src/test/derived/predicate_attribute/attributes.cfg @@ -19,6 +19,7 @@ attribute[].upperbound 200 attribute[].densepostinglistthreshold 0.2 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN diff --git a/config-model/src/test/derived/prefixexactattribute/attributes.cfg b/config-model/src/test/derived/prefixexactattribute/attributes.cfg index 0a8cbd82186..5cae6b784ff 100644 --- a/config-model/src/test/derived/prefixexactattribute/attributes.cfg +++ b/config-model/src/test/derived/prefixexactattribute/attributes.cfg @@ -19,6 +19,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -44,6 +45,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN diff --git a/config-model/src/test/derived/reference_fields/attributes.cfg b/config-model/src/test/derived/reference_fields/attributes.cfg index e83b187a0cc..ec3ca030373 100644 --- a/config-model/src/test/derived/reference_fields/attributes.cfg +++ b/config-model/src/test/derived/reference_fields/attributes.cfg @@ -19,6 +19,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -44,6 +45,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -69,6 +71,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN diff --git a/config-model/src/test/derived/sorting/attributes.cfg b/config-model/src/test/derived/sorting/attributes.cfg index 83c310ca5ca..6e50bd625ee 100644 --- a/config-model/src/test/derived/sorting/attributes.cfg +++ b/config-model/src/test/derived/sorting/attributes.cfg @@ -19,6 +19,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -44,6 +45,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -69,6 +71,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN diff --git a/config-model/src/test/derived/tensor/attributes.cfg b/config-model/src/test/derived/tensor/attributes.cfg index 780f47ee3d5..6ed960728c2 100644 --- a/config-model/src/test/derived/tensor/attributes.cfg +++ b/config-model/src/test/derived/tensor/attributes.cfg @@ -19,6 +19,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "tensor(x[2],y[1])" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -44,6 +45,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "tensor(x{})" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -69,6 +71,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "tensor(x[10],y[10])" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -94,6 +97,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "tensor(x[10])" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -119,6 +123,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN diff --git a/config-model/src/test/derived/types/attributes.cfg b/config-model/src/test/derived/types/attributes.cfg index 82535324864..8e37a1f1c63 100644 --- a/config-model/src/test/derived/types/attributes.cfg +++ b/config-model/src/test/derived/types/attributes.cfg @@ -19,6 +19,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -44,6 +45,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -69,6 +71,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -94,6 +97,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -119,6 +123,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -144,6 +149,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -169,6 +175,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -194,6 +201,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -219,6 +227,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -244,6 +253,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -269,6 +279,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -294,6 +305,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN @@ -319,6 +331,7 @@ attribute[].upperbound 9223372036854775807 attribute[].densepostinglistthreshold 0.4 attribute[].tensortype "" attribute[].imported false +attribute[].distancemetric EUCLIDEAN attribute[].index.hnsw.enabled false attribute[].index.hnsw.maxlinkspernode 16 attribute[].index.hnsw.distancemetric EUCLIDEAN diff --git a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/AttributeChangeValidatorTest.java b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/AttributeChangeValidatorTest.java index a704938610b..e32bd09bc08 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/AttributeChangeValidatorTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/AttributeChangeValidatorTest.java @@ -167,11 +167,19 @@ public class AttributeChangeValidatorTest { "Field 'f1' changed: remove attribute 'indexing: index'")); } + @Test + public void changing_distance_metric_without_hnsw_index_enabled_is_ok() throws Exception { + new Fixture("field f1 type tensor(x[2]) { indexing: attribute }", + "field f1 type tensor(x[2]) { indexing: attribute \n attribute { " + + "distance-metric: geodegrees \n } }"). + assertValidation(); + } + @Test public void changing_distance_metric_with_hnsw_index_enabled_requires_restart() throws Exception { new Fixture("field f1 type tensor(x[2]) { indexing: attribute | index \n index { hnsw } }", - "field f1 type tensor(x[2]) { indexing: attribute | index \n index { " + - "distance-metric: geodegrees \n hnsw } }"). + "field f1 type tensor(x[2]) { indexing: attribute | index \n attribute { " + + "distance-metric: geodegrees \n } }"). assertValidation(newRestartAction("Field 'f1' changed: change property " + "'distance-metric' from 'EUCLIDEAN' to 'GEODEGREES'")); } -- cgit v1.2.3