Confused by DiversifyingChildrenFloatKnnVectorQuery javadocs
Chris Hostetter <[email protected]> Mon, 21 Oct 2024 11:25:09 -0700 (MST)
| Newsgroups | gmane.comp.jakarta.lucene.user |
|---|---|
| Message-ID | <alpine.DEB.2.21.2410211100510.12426@slate> |
I believe I understand the *purpose* of the DiversifyingChildrenFloatKnnVectorQuery (and DiversifyingChildrenByteKnnVectorQuery) classes, but what I don't understand is the java code example from the javadocs... https://lucene.apache.org/core/9_12_0/join/org/apache/lucene/search/join/DiversifyingChildrenFloatKnnVectorQuery.html Query knnQuery = new DiversifyingChildrenFloatKnnVectorQuery(fieldName, queryVector, ...); // Rewrite executes kNN search and collects nearest children docIds and their scores Query rewrittenKnnQuery = searcher.rewrite(knnQuery); // Join the scored children docs with their parents and score the parents Query childrenToParents = new ToParentBlockJoinQuery(rewrittenKnnQuery, parentsFilter, ScoreMode.MAX); ...why does this example suggest that the "caller" needs to call searcher.rewrite(knnQuery) directly and then pass the result to the ToParentBlockJoinQuery constructor? Isn't that rewrite going to happen automatically when ToParentBlockJoinQuery.rewrite() is ultimately called? Also, FWIW, I can't sem to find any tests this particular method of combining DiversifyingChildrenFloatKnnVectorQuery with ToParentBlockJoinQuery produces expected results -- making me suspicios that it's not actaully neccessary for correct behavior? (Allthough, for that matter, I'm not seeing any tests that actual involve wrapping DiversifyingChildrenFloatKnnVectorQuery in a ToParentBlockJoinQuery -- only lower level "white box" style tests that assert DiversifyingChildrenFloatKnnVectorQuery returns the expected diverse matches) -Hoss http://www.lucidworks.com/