You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Dominik Bruhn <do...@dbruhn.de> on 2007/12/30 01:59:57 UTC

Simple Filter-Question

Hy,
I got a Integerfield for each of my documents which tells me out of
which area of my documentbase this document is. So 1 is "Research Theme
1", 2 is "Research Theme 2", 3 is "Documentation Projekt 21" and so on.

Uppon searching I want to have only documents from areas the user is
allowed to look at in the resultset. Currently I'm doing this using a
second (internal constructed) Query which limits the area and combining
this to the user-query using a Boolean-Query.

I know this is the wrong approach and that the right solution should be
a Filter. But I dont know which filter to use and how. I saw a example
of a RangeFilter which seems quite simple but a range is not enough! I
dont need to check against a range but against a list of allowed ids.

Can anybody help me an give me a hint how I can accomplish this? 

Thanks
-- 
Dominik Bruhn
mailto: dominik@dbruhn.de

Re: Simple Filter-Question

Posted by Daniel Naber <lu...@danielnaber.de>.
On Sonntag, 30. Dezember 2007, Dominik Bruhn wrote:

> I know this is the wrong approach and that the right solution should be
> a Filter. But I dont know which filter to use and how.

The simplest approach is probably to wrap your limiting query with this 
class: 
http://lucene.apache.org/java/2_2_0/api/org/apache/lucene/search/QueryWrapperFilter.html

Then use that filter by calling an IndexSearcher.search() method that also 
takes a filter.

Regards
 Daniel

-- 
http://www.danielnaber.de

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