eliaporciani commented on code in PR #1435:
URL: https://github.com/apache/solr/pull/1435#discussion_r1138495435
##########
solr/core/src/java/org/apache/solr/schema/DenseVectorField.java:
##########
@@ -165,10 +180,22 @@ public void checkSchemaField(final SchemaField field)
throws SolrException {
@Override
public List<IndexableField> createFields(SchemaField field, Object value) {
- ArrayList<IndexableField> fields = new ArrayList<>();
- float[] parsedVector;
try {
- parsedVector = parseVector(value);
+ ArrayList<IndexableField> fields = new ArrayList<>();
+ VectorValue vectorValue = new VectorValue(value);
+ if (field.indexed()) {
+ fields.add(createField(field, vectorValue));
+ }
+ if (field.stored()) {
+ if (vectorEncoding.equals(VectorEncoding.FLOAT32)) {
+ for (float vectorElement : vectorValue.getFloatVector()) {
+ fields.add(getStoredField(field, vectorElement));
+ }
+ } else {
+ fields.add(new StoredField(field.getName(),
vectorValue.getByteVector()));
+ }
Review Comment:
Changed with switch
--
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]