An alternative is to use a filtered query.

Filter fx = new CachingWrapperFilter(
        new AccessFilter( document-id-list ) );

FilteredQuery fq = new FilteredQuery( userQuery, fx);

Hits h = Search( fq );


where the AccessFilter is a class you write which derives from 
Lucene.Net.Search.Filter. Its constructor would use your list of document IDs 
and provide a BitArray for use by Lucene's FilteredQuery of those documents 
that are allowed to be found.


-- Neal


-----Original Message-----
From: Digy [mailto:[email protected]]
Sent: Wednesday, April 01, 2009 1:42 PM
To: [email protected]
Subject: RE: Filtering queries

> Let's make the problem easier for a moment.  If I add a "DatabaseID"
> field to every document, and I have a list of database IDs, can I tell
lucene to only return documents in that list?  The list could be in the
magnitude of thousands.

Think DatabaseID as my AccessRights. You can search like
"other-part-of-query +(DatabaseID:id1 DatabaseID:id2)".
But If you have many( how many?) terms in your query, your search will be
slower.

Many values in DatabaseID field is not a problem for lucene. Only, you will
get a big index.

DIGY.




-----Original Message-----
From: Brian Victor [mailto:[email protected]]
Sent: Wednesday, April 01, 2009 9:08 PM
To: [email protected]
Subject: Re: Filtering queries

On Wed, Apr 01, 2009 at 09:00:19PM +0300, Digy wrote:
>2- Search results should be filtered (in a loop while reading the docs from
>index?) before returning to user, utilizing the field "AccessRights".

I don't think this is so.  Search results should be filtered, yes, but I
don't think "AccessRights" is the way to do it.  I already know what
documents a user can see; I'm just trying to figure out how to make
lucene filter to those documents.

Let's make the problem easier for a moment.  If I add a "DatabaseID"
field to every document, and I have a list of database IDs, can I tell
lucene to only return documents in that list?  The list could be in the
magnitude of thousands.

--
Brian

Reply via email to