I have a custom query object that extends ContstantScoreQuery. I give it a key which pulls some documents out of a cache. Thinking to make it more efficient, I used DocSet, backed by OpenBitSet or OpenHashSet. However, I need to set the BitSet object for the Lucene filter. Any idea on how to best do this from DocSet? It seems like this is a problem that people have encountered before.
I could iterate through each item in the DocSet and do that, but that seems rather inefficient. public class MyQuery extends ConstantScoreQuery { private static class ResellerSupplierFilter extends Filter { private final BitSet bitset; public MyFilter(String reseller, String supplier) { DocSet docset = (DocSet)context.get().searcher.getCache("my-filter").get(new CompositeKey(reseller, supplier)); } public @Override BitSet bits(IndexReader reader) { //return docset.getBits(). } public @Override int hashCode() { return new HashCodeBuilder().append(reseller).append(supplier).toHashCode(); } } public ResellerSupplierQuery(String reseller, String supplier) { super(new ResellerSupplierFilter(reseller, supplier)); } }