lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Antony Bowesman <...@teamware.com>
Subject Re: efficient way to filter out unwanted results
Date Fri, 15 Jun 2007 08:54:14 GMT
yu wrote:
> Thanks Sawan for the suggestion.
> I guess this will work for statically known doc ids. In my case, I know 
> only external ids that I want to exclude from the result set.for each  
> search.  Of course, I can always exclude these  docs in a post search 
> process. I am curious if there are other more efficient approach.

When you open a searcher, you could create a cached array of all your external 
Ids with their Lucene DocId.  Using a custom HitCollector, which can be created 
with the Ids you wish to exclude, you can get a document's external Id during 
the collect() method using the docid.  Then just check the external Id of the 
matched document against the exclusion list.

As long as you have your searcher open, the cache will remain valid.
Antony




> 
> Thanks again for your help.
> 
> Jay
> 
> Sawan Sharma wrote:
>> Hello Jay,
>>
>> I am not sure up to what level I understood your problem . But as far 
>> as my
>> assumption, you can try HitCollector class and its collect method. 
>> Here you
>> can get DocID for each hit and can remove while searching.
>>
>> Hope it will be useful.
>>
>> Sawan
>> (Chambal.com inc. NJ USA)
>>
>>
>>
>>
>>
>> On 6/15/07, yu <yu@ai.sri.com> wrote:
>>>
>>> Hi everyone,
>>>
>>> I am trying to remove several docs from search results each time I do
>>> query. The docs can be identified by an exteranl ids whcih are
>>> saved/indexed. I could use a Query or QueryFilter  to achieve this but
>>> not sure if it's the most efficient way to do that.
>>> Anyone has any experience or idea?
>>> Thanks!
>>>
>>> Jay
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
>>> For additional commands, e-mail: java-user-help@lucene.apache.org
>>>
>>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
> 
> 


---------------------------------------------------------------------
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