lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mark harwood <markharw...@yahoo.co.uk>
Subject Re: TermsFilter and MUST
Date Fri, 12 Sep 2008 14:03:04 GMT
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 <injecteer@yahoo.com>
To: java-user@lucene.apache.org
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: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


      

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message