Thx for your help.
I think i found an additional solution:
QueryBitSetProducer bsp = new QueryBitSetProducer(myquery);
@Override
public Bits getLiveDocs() {
return bsp.getBitSet(this.getContext());
}
but the link from Uwe seems quite promising as it also solves the
numDocs() problem.
On Mon, Dec 5, 2016 at 6:18 PM, Uwe Schindler <[email protected]> wrote:
> 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: [email protected]
>
>> -----Original Message-----
>> From: Adrien Grand [mailto:[email protected]]
>> Sent: Monday, December 5, 2016 3:35 PM
>> To: [email protected]
>> 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 <[email protected]> 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: [email protected]
> For additional commands, e-mail: [email protected]
>
--
Hendrik Saly (salyh, hendrikdev22)
@hendrikdev22
PGP: 0x22D7F6EC
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]