Creating a ConstantScoreQuery from a FixedBitSet feels wrong since queries are supposed to be independent from an index, while the FixedBitSet needs to depend on a particular index (eg. I assume that the length of the bit set is your reader's maxDoc). Maybe you need to write a query that ends up builing a _scorer_ from a bit set, with something like "new ConstantScoreScorer(weight, boost, new BitSetIterator(myFixedBitSet, myFixedBitSet.approximateCardinality()))"
Le lun. 23 avr. 2018 à 15:34, Yonghui Zhao <zhaoyong...@gmail.com> a écrit : > In my project I implement a NullFieldFilter, which will filter the docs > index some field regardless the value. > > The implementation is traverse the index field use TermsEnum and > PostingsEnum, or using DocValues advance function to traverse the docs > which have this field. In this way I get FixedBitSet and cache it. btw: I > am not sure if there is any simpler way to get this FixedBitSet. > > In lucene 7 there is no filter any longer, so I need convert this > FixedBitSet to a ConstantScoreQuery and then construct a FILTER Clause with > this ConstantScoreQuery. > > So how to construct a ConstantScoreQuery with FixedBitSet? >