adamjq commented on code in PR #4698:
URL: https://github.com/apache/solr/pull/4698#discussion_r3898404316


##########
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:
   I've tried the suggestion, and it's possible but it loses the reason for why 
it's not supported. I could change it to `boolean supportsKnnQueryParsers()` 
and invoke it in the query parsers, but then the parsers have to throw the 
exception message without knowing why it returned false. 
   
   What do you think? For the moment, I've renamed the method slightly from 
`checkKnnQuerySupported` to `checkKnnQueryParsersSupported()`, to make it 
clearer that it's the query parsers that might not be supported, and not the 
`vectorSimilarity()` function query, and added `throws SolrException` to the 
type signature



-- 
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