risdenk commented on code in PR #1184:
URL: https://github.com/apache/solr/pull/1184#discussion_r1026840803


##########
solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java:
##########
@@ -1211,17 +1211,28 @@ public ProcessedFilter getProcessedFilter(DocSet 
setFilter, List<Query> queries)
     }
 
     // Are all of our normal cached filters negative?
-    if (end > 0 && answer == null) {
-      answer = getLiveDocSet();
-    }
+    if (end > 0) {
+      if (answer == null) {
+        answer = getLiveDocSet();
+      }
 
-    // do negative queries first to shrink set size
-    for (int i = 0; i < end; i++) {
-      if (neg[i]) answer = answer.andNot(sets[i]);
-    }
+      // This optimizes for the case where we have more than 2 filters and 
instead
+      // of copying the bitsets we make one mutable bitset. We only need to do 
this
+      // for BitDocSet since it clones the backing bitset for andNot and 
intersection.
+      if (end > 1 && answer instanceof BitDocSet) {
+        FixedBitSet fixedBitSet =
+            FixedBitSet.ensureCapacity(answer.getFixedBitSetClone(), maxDoc());
+        answer = new MutableBitDocSet(fixedBitSet);

Review Comment:
   Addressed in bdf47db



-- 
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]

Reply via email to