You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@solr.apache.org by GitBox <gi...@apache.org> on 2022/07/04 14:35:55 UTC

[GitHub] [solr] alessandrobenedetti commented on a diff in pull request #910: SOLR-16245: make DenseVectorField codec agnostic

alessandrobenedetti commented on code in PR #910:
URL: https://github.com/apache/solr/pull/910#discussion_r913064070


##########
solr/core/src/java/org/apache/solr/core/SchemaCodecFactory.java:
##########
@@ -124,20 +123,16 @@ public KnnVectorsFormat getKnnVectorsFormatForField(String field) {
             FieldType fieldType = (schemaField == null ? null : schemaField.getType());
             if (fieldType instanceof DenseVectorField) {
               DenseVectorField vectorType = (DenseVectorField) fieldType;
-              String knnVectorFormatName = vectorType.getCodecFormat();
-              if (knnVectorFormatName != null) {
-                if (knnVectorFormatName.equals(Lucene91HnswVectorsFormat.class.getSimpleName())) {
+              String knnAlgorithm = vectorType.getAlgorithm();
+              if (knnAlgorithm != null) {
+                if (knnAlgorithm.equals(DenseVectorField.HNSW_ALGORITHM)) {
                   int maxConn = vectorType.getHnswMaxConn();
                   int beamWidth = vectorType.getHnswBeamWidth();
                   return new Lucene91HnswVectorsFormat(maxConn, beamWidth);
-                } else if (knnVectorFormatName.equals(
-                    Lucene90HnswVectorsFormat.class.getSimpleName())) {
-                  int maxConn = vectorType.getHnswMaxConn();
-                  int beamWidth = vectorType.getHnswBeamWidth();
-                  return new Lucene90HnswVectorsFormat(maxConn, beamWidth);
-                } else {
-                  return KnnVectorsFormat.forName(knnVectorFormatName);
                 }
+              } else {
+                throw new SolrException(
+                    ErrorCode.SERVER_ERROR, "the KNN algorithm provided is not supported");

Review Comment:
   can we add here the name of the algorithm specified?
   knnAlgorithm + " KNN algorithm is not supported"



-- 
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: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org