kaivalnp commented on code in PR #932:
URL: https://github.com/apache/lucene/pull/932#discussion_r887687260


##########
lucene/core/src/java/org/apache/lucene/search/KnnVectorQuery.java:
##########
@@ -225,6 +225,11 @@ public BitSetIterator getIterator(int contextOrd) {
       return new BitSetIterator(bitSets[contextOrd], cost[contextOrd]);
     }
 
+    public void setBitSet(BitSet bitSet, int cost) {
+      bitSets[ord] = bitSet;

Review Comment:
   > Could we create a new `Query` type backed by a `BitSet`? For example we 
have a `BitSetQuery` in `TestScorerPerf`, maybe we could pull this out as a 
test class or just duplicate it. That way we wouldn't have to modify 
`KnnVectorQuery` just for these test purposes.
   
   The current SelectiveQuery class is in essence a Query backed by 
FixedBitSet. The problem arises during hit collection, which happens doc by doc 
(so we have to iterate over the entire BitSet, and call collect on set bits), 
which adds a large arbitrary time. To prevent this copying of our BitSet into 
BitSetCollector's internal one (bit by bit), I have overloaded the BulkScorer 
to directly update it's underlying reference
   
   An alternative to adding these modifiers could be using the Reflection 
package to manually update the variables. This way we won't need to change 
defined classes for tests (but it might make the test somewhat hacky?)



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

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


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

Reply via email to