Hi, you may also have a look at the implementation of the PKIndexSplitter, doing exactly what you want (applying a FilterReader / FilterCodecReader that hides documents matched by a query): https://github.com/apache/lucene-solr/blob/master/lucene/misc/src/java/org/apache/lucene/index/PKIndexSplitter.java#L127-L170
Uwe ----- Uwe Schindler Achterdiek 19, D-28357 Bremen http://www.thetaphi.de eMail: u...@thetaphi.de > -----Original Message----- > From: Adrien Grand [mailto:jpou...@gmail.com] > Sent: Monday, December 5, 2016 3:35 PM > To: java-user@lucene.apache.org > Subject: Re: Apply Lucene Query on Bits > > Do I get it right that you have a query that defines a set of visible > documents, and you want to make sure that your FilterReader only sees > those > documents? > > If this is the case, then you could use FixedBitSet.or to load the > Scorer.iterator() into a FixedBitSet, and then maintain two caches: > - one from the core cache key to the bit set of visible documents, > - one from the core and deletes cache key to the number of documents in > the index, this numDocs could be recomputed by iterating the bit set of > visible documents, and counting how many of them are not deleted. > > Le dim. 4 déc. 2016 à 10:04, Hendrik Dev <hendrikde...@gmail.com> a écrit > : > > > how to apply a org.apache.lucene.search.Query on a given > > org.apache.lucene.util.Bits object? > > > > Background: I have a subclass of > > org.apache.lucene.index.FilterLeafReader where i want to filter the > > livedocs by applying a query on the "Bits". > > > > According to javadoc i need also to override numDocs() if i override > > getLiveDocs(). So the question extends also to how to filter the > > number of documents based on a query (within a FilterLeafReader) > > --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org