jpountz commented on code in PR #14080: URL: https://github.com/apache/lucene/pull/14080#discussion_r1890766083
########## lucene/core/src/java/org/apache/lucene/search/DenseConjunctionBulkScorer.java: ########## @@ -0,0 +1,192 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.lucene.search; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Comparator; +import java.util.List; +import org.apache.lucene.util.Bits; +import org.apache.lucene.util.FixedBitSet; + +/** + * BulkScorer implementation of {@link ConjunctionScorer} that is specialized for dense clauses. + * Whenever sensible, it intersects clauses by tran + */ +final class DenseConjunctionBulkScorer extends BulkScorer { + + // Use a small-ish window size to make sure that we can take advantage of gaps in the postings of + // clauses that are not leading iteration. + static final int WINDOW_SIZE = 4096; + // Only use bit sets to compute the intersection if more than 1/32th of the docs are expected to + // match. Experiments suggested that values that are a bit higher than this would work better, but + // we're erring on the conservative side. + static final int DENSITY_THRESHOLD_INVERSE = Long.SIZE / 2; + + private final DocIdSetIterator lead; + private final List<DocIdSetIterator> others; + + private final FixedBitSet windowMatches = new FixedBitSet(WINDOW_SIZE); + private final FixedBitSet clauseWindowMatches = new FixedBitSet(WINDOW_SIZE); + private final DocIdStreamView docIdStreamView = new DocIdStreamView(); Review Comment: Indeed, it only requires 2*WINDOW_SIZE bits = 1kB. -- 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