Gabriel Landais a écrit :
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
It works perfectly. It is implemented in a GPL project, aka
"simexplorer-is", in class LuceneDatabase (createFilter) :
<https://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/trunk/simexplorer-is/simexplorer-is-storage/src/java/fr/cemagref/simexplorer/is/storage/database/lucene/?root=simexplorer-si>
I think that this class is a good sample of what is possible to do with
Lucene as a metadata database.
Hope it will help.
Regards,
--
Gabriel <[EMAIL PROTECTED]>
http://www.codelutin.com
tel : 02 40 50 29 28 / fax : 09 59 92 29 28
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]