liangkaiwen commented on code in PR #3316:
URL: https://github.com/apache/solr/pull/3316#discussion_r2033397396
##########
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:
is the branching on type of Knn query necessary? As far as I can see, the
majority of the code blocks are equivalent and the different instance variables
of KnnByteVectorQuery/KnnFloatVectorQuery are being used like its generic
parent class
--
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]