lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hendrik Dev <hendrikde...@gmail.com>
Subject Re: Apply Lucene Query on Bits
Date Tue, 06 Dec 2016 15:53:12 GMT
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 <uwe@thetaphi.de> 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: uwe@thetaphi.de
>
>> -----Original Message-----
>> From: Adrien Grand [mailto:jpountz@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 <hendrikdev22@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-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>



-- 
Hendrik Saly (salyh, hendrikdev22)
@hendrikdev22
PGP: 0x22D7F6EC

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message