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


##########
solr/core/src/java/org/apache/solr/search/join/BlockJoinParentQParser.java:
##########
@@ -78,10 +87,89 @@ protected Query noClausesQuery() throws SyntaxError {
     return new BitSetProducerQuery(getBitSetProducer(parseParentFilter()));
   }
 
-  protected Query createQuery(final Query parentList, Query query, String 
scoreMode)
+  protected Query createQuery(final Query allParents, BooleanQuery 
childrenQuery, String scoreMode)
       throws SyntaxError {
-    return new AllParentsAware(
-        query, getBitSetProducer(parentList), 
ScoreModeParser.parse(scoreMode), parentList);
+    List<BooleanClause> childrenClauses = childrenQuery.clauses();
+    if (isByteKnnQuery(childrenClauses)) {
+      BitSetProducer allParentsBitSet = getBitSetProducer(allParents);
+      BooleanQuery parentsFilter = getParentsFilter();
+
+      KnnByteVectorQuery knnChildrenQuery = (KnnByteVectorQuery) 
childrenClauses.get(0).getQuery();
+      String vectorField = knnChildrenQuery.getField();
+      byte[] queryVector = knnChildrenQuery.getTargetCopy();
+      int topK = knnChildrenQuery.getK();
+
+      Query acceptedChildren =
+          getChildrenFilter(knnChildrenQuery.getFilter(), parentsFilter, 
allParentsBitSet);
+
+      Query knnChildren =
+          new DiversifyingChildrenByteKnnVectorQuery(
+              vectorField, queryVector, acceptedChildren, topK, 
allParentsBitSet);
+      return new ToParentBlockJoinQuery(
+          knnChildren, allParentsBitSet, ScoreModeParser.parse(scoreMode));
+    } else if (isFloatKnnQuery(childrenClauses)) {

Review Comment:
   Hi @liangkaiwen, the parent class 
org.apache.lucene.search.AbstractKnnVectorQuery is not public and also when 
building the 
DiversifyingChildrenFloatKnnVectorQuery/DiversifyingChildrenByteKnnVectorQuery 
I am afraid the if branching can not be avoided?
   
   I agree there's boring repeated code, not sure we can avoid it



-- 
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-unsubscr...@solr.apache.org

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


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

Reply via email to