alessandrobenedetti commented on code in PR #4698:
URL: https://github.com/apache/solr/pull/4698#discussion_r3861385235
##########
solr/core/src/java/org/apache/solr/schema/DenseVectorField.java:
##########
@@ -499,6 +499,16 @@ public ValueSource getValueSource(SchemaField field,
QParser parser) {
SolrException.ErrorCode.BAD_REQUEST, "Vector encoding not supported
for function queries.");
}
+ /** Throws if this field type does not support KNN vector queries. */
Review Comment:
this small refactor should have been in a separate PR, now being a small
change don't worry about it, but take this into account for future PRs as a
best practice
##########
solr/core/src/java/org/apache/solr/schema/ScalarQuantizedDenseVectorField.java:
##########
@@ -123,18 +124,28 @@ public void init(IndexSchema schema, Map<String, String>
args) {
super.init(schema, args);
- if (FLAT_ALGORITHM.equals(getKnnAlgorithm())) {
+ if (VectorEncoding.BYTE.equals(getVectorEncoding())
+ && FLAT_ALGORITHM.equals(getKnnAlgorithm())) {
throw new SolrException(
SolrException.ErrorCode.BAD_REQUEST,
- "knnAlgorithm 'flat' is not supported for
ScalarQuantizedDenseVectorField");
+ "vectorEncoding 'BYTE' is not supported for
ScalarQuantizedDenseVectorField"
+ + " with knnAlgorithm 'flat'");
}
}
+ // Unlike DenseVectorField, the scalar-quantized flat format supports KNN
queries.
+ @Override
Review Comment:
maybe better to have a boolean method here, and then move the throwing
exception logic in the main code branch in case the boolean method return false?
--
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]