Skip to content

Commit

Permalink
HSEARCH-5021 Remove the array check from a vector DefaultInitiator
Browse files Browse the repository at this point in the history
  • Loading branch information
marko-bekhta committed Dec 11, 2023
1 parent e5a206e commit 9c8b8b0
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -346,13 +346,7 @@ class IndexedEntity {
.typeContext( IndexedEntity.class.getName() )
.pathContext( ".notVector" )
.failure(
"Unable to apply property mapping: this property mapping must target an index field of vector type",
"but the resolved field type is non-vector",
"This generally means you need to use a different field annotation"
+ " or to convert property values using a custom ValueBridge or ValueBinder",
"If you are already using a custom ValueBridge or ValueBinder, check its field type",
"encountered type DSL step '",
"expected interface '" + VectorFieldTypeOptionsStep.class.getName() + "'"
"Vectors of java.lang.Integer type are not supported"
) );
}

Expand All @@ -372,12 +366,7 @@ class IndexedEntity {
.typeContext( IndexedEntity.class.getName() )
.pathContext( ".bytes" )
.failure(
"Unable to apply property mapping: this property mapping must target an index field of vector type, but the resolved field type is non-vector",
"This generally means you need to use a different field annotation"
+ " or to convert property values using a custom ValueBridge or ValueBinder",
"If you are already using a custom ValueBridge or ValueBinder, check its field type",
"encountered type DSL step '",
"expected interface '" + VectorFieldTypeOptionsStep.class.getName() + "'"
"Vectors of java.lang.Integer type are not supported"
) );
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,7 @@ public <F> IndexFieldTypeOptionsStep<?, F> initiate(IndexFieldTypeFactory factor
if ( dimension == null ) {
throw log.vectorDimensionNotSpecified();
}
// we consider arrays (byte[] and float[] in particular to be vector types, anything else will be
// treated as a non-vector field and delegated to a regular as(..) call.
if ( clazz.isArray() ) {
return factory.asVector( dimension, clazz );
}
else {
return factory.as( clazz );
}
return factory.asVector( dimension, clazz );
}
},
FieldModelContributorContext::vectorTypeOptionsStep );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ public <F> VectorFieldTypeOptionsStep<?, F> asVector(int dimension, Class<F> val
if ( float[].class.equals( valueType ) ) {
return (VectorFieldTypeOptionsStep<?, F>) asFloatVector( dimension );
}
return new StubVectorFieldTypeOptionsStep<>( dimension, valueType );
throw new IllegalArgumentException("Vectors of " + valueType.getName() + " type are not supported.");
}

@Override
Expand Down

0 comments on commit 9c8b8b0

Please sign in to comment.