You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@solr.apache.org by "eliaporciani (via GitHub)" <gi...@apache.org> on 2023/03/16 11:19:21 UTC

[GitHub] [solr] eliaporciani commented on a diff in pull request #1435: SOLR-16674: Introduce dense vector byte encoding

eliaporciani commented on code in PR #1435:
URL: https://github.com/apache/solr/pull/1435#discussion_r1138494823


##########
solr/core/src/java/org/apache/solr/schema/DenseVectorField.java:
##########
@@ -46,19 +50,17 @@
  */
 public class DenseVectorField extends FloatPointField {
   public static final String HNSW_ALGORITHM = "hnsw";
-
   public static final String DEFAULT_KNN_ALGORITHM = HNSW_ALGORITHM;
   static final String KNN_VECTOR_DIMENSION = "vectorDimension";
   static final String KNN_SIMILARITY_FUNCTION = "similarityFunction";
-
   static final String KNN_ALGORITHM = "knnAlgorithm";
   static final String HNSW_MAX_CONNECTIONS = "hnswMaxConnections";
   static final String HNSW_BEAM_WIDTH = "hnswBeamWidth";
-
+  static final String VECTOR_ENCODING = "vectorEncoding";
+  private final VectorEncoding DEFAULT_VECTOR_ENCODING = VectorEncoding.FLOAT32;
+  private final VectorSimilarityFunction DEFAULT_SIMILARITY = VectorSimilarityFunction.EUCLIDEAN;

Review Comment:
   fixed



##########
solr/core/src/java/org/apache/solr/schema/DenseVectorField.java:
##########
@@ -106,19 +114,22 @@ public void init(IndexSchema schema, Map<String, String> args) {
     args.remove(KNN_SIMILARITY_FUNCTION);
 
     this.knnAlgorithm = args.getOrDefault(KNN_ALGORITHM, DEFAULT_KNN_ALGORITHM);
-
     args.remove(KNN_ALGORITHM);
 
+    this.vectorEncoding =
+        ofNullable(args.get(VECTOR_ENCODING))
+            .map(value -> VectorEncoding.valueOf(value.toUpperCase(Locale.ROOT)))
+            .orElse(DEFAULT_VECTOR_ENCODING);
+    ;
+
+    args.remove(VECTOR_ENCODING);

Review Comment:
   fixed



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org