views:

110

answers:

2

I need to return just the documents that a user has access to from a Lucene search. I can get a list of IDs from a database that make up the 'allowed' subset. How can I pass these to Lucene? The articles I've found on the web suggest I need to use a BitSet and FieldCache (am I right?), but I'm having trouble finding good examples. Does anyone have any?

I'm using C#, but any language would be great. Thanks.

A: 

A simple way would be to build a MultiPhraseQuery with an array of all the matching IDs, via MultiPhraseQuery.add(Term[] terms). You can build one of these things with thousands of terms, and Lucene (as always) performs extremely well.

RichieHindle
A: 

Once I knew I needed to use a custom filter, asking this question got the right answer.

Nick