lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gabriel Landais <>
Subject Security filtering from external DB
Date Fri, 22 Feb 2008 09:24:30 GMT
 we have chosen to use Lucene as the metadata database for a project. 
Everything works great, from indexing to multi-threading search.
 Also, we have chosen to split storage and security. It works great, 
except when we come to filtering.
 I have understood that Filter should set bits on documents that are ok, 
but it is not the way we want to do it.

 What our security service can give, is a Collection<String> 
corresponding to a Document field, let's say "uuid". This collection 
handles all documents user can read.
 So, is there a way to set an event on "this document match the query, 
does the filter keep this one in the list?". This way, we have not to 
get all "uuid" of all Lucene docs in our filter, that is really costy.

 We can filter Hits returned by search, but there should be a smarter 
way to do it, no?

 As summarizing this problem, got an idea :
 How to create a Filter for a field in Collection<String>?
 First, split Collection in Collection<Collection> with 
BooleanQuery.maxClauseCount items maximum in each collection.
 For each collection :
  create a BooleanQuery with a TermQuery for each String.
  perform a search with a HitCollector filling a BitSet
 Now we have BitSet of each Collection, perform a BitSet.or to get a 
final BitSet
 Build a Filter based on that BitSet, and use that Filter as parameter 
of each search

Of course, a cache system should be added, managed by security telling 
if Collection as changed, to rebuild the user Filter.

Is it a good idea?


Gabriel <>
tel : 02 40 50 29 28 / fax : 09 59 92 29 28

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message