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


##########
solr/core/src/java/org/apache/solr/schema/DenseVectorField.java:
##########
@@ -179,24 +206,37 @@ public List<IndexableField> createFields(SchemaField 
field, Object value) {
               + "', expected format:'[f1, f2, f3...fn]' e.g. [1.0, 3.4, 5.6]",
           e);
     }
+  }
 
-    if (field.indexed()) {
-      fields.add(createField(field, parsedVector));
-    }
-    if (field.stored()) {
-      fields.ensureCapacity(parsedVector.length + 1);
-      for (float vectorElement : parsedVector) {
-        fields.add(getStoredField(field, vectorElement));
-      }
+  @Override
+  public IndexableField createField(SchemaField field, Object vectorValue) {
+    if (vectorValue == null) return null;
+    VectorValue typedVectorValue = (VectorValue) vectorValue;
+    if (vectorEncoding.equals(VectorEncoding.BYTE)) {
+      return new KnnVectorField(
+          field.getName(), typedVectorValue.getByteVector(), 
similarityFunction);
+    } else {
+      return new KnnVectorField(
+          field.getName(), typedVectorValue.getFloatVector(), 
similarityFunction);

Review Comment:
   I changed the if with a switch. However, there are only two possibilities 
here and if another value is provided, it fails in the enum parsing.



##########
solr/core/src/java/org/apache/solr/schema/DenseVectorField.java:
##########
@@ -179,24 +206,37 @@ public List<IndexableField> createFields(SchemaField 
field, Object value) {
               + "', expected format:'[f1, f2, f3...fn]' e.g. [1.0, 3.4, 5.6]",

Review Comment:
   Changed



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to