TermsFilter has taken the relatively easy option of ORing terms and this is
inexpensive to construct.
Adding more complex features (mixes of MUST/SHOULD/NOT clauses) starts to
require the sorts of optimisations you see in BooleanQuery (MUST clauses
accelerating processing of other clauses through use of skipTo).
For this reason I would not want to reproduce that logic and instead suggest
you use some of the existing classes to acheive what you are after i.e
something like this
BooleanQuery bq=new BooleanQuery();
bq.add(new BooleanClause(new TermQuery(new
Term("gender","female")),BooleanClause.Occur.MUST));
bq.add(new BooleanClause(new TermQuery(new
Term("hair","blond")),BooleanClause.Occur.MUST));
QueryWrapperFilter qf = new QueryWrapperFilter(bq);
There is a BooleanFilter that looks from the outside to have the same semantics
as BooleanQuery (shoulds/musts etc) but this is reliant on calling each clause
independently in turn to produce a Bitset (or DocIdSet in future) then
combining them. This has none of the "skipTo" optimisations in BooleanQuery's
parallel streaming of clause output.
Cheers,
Mark
----- Original Message ----
From: Konstantyn Smirnov <[EMAIL PROTECTED]>
To: [email protected]
Sent: Friday, 12 September, 2008 11:18:17
Subject: TermsFilter and MUST
Hi gents,
is it possible to use TermsFilter with the 'MUST' occurence rule, instead of
the 'SHOULD'?
In the code:
def tf = new TermsFilter()
for( some terms ){
tf.addTerm( new Term( .... ) )
}
I want that all terms MUST limit the hit list.
Thanks in advance
--
View this message in context:
http://www.nabble.com/TermsFilter-and-MUST-tp19453184p19453184.html
Sent from the Lucene - Java Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]