lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris <chrislin0...@gmail.com>
Subject Re: Question about Boolean Operators
Date Wed, 02 Jan 2008 06:27:07 GMT
Dear CowBoyX .

    if you use lucene query function with boolean query . You can try to use
the BooleanQuery to create the logic with yourself.

    Like the codeļ¼š
   BooleanQuery query = new BooleanQuery();
   query.add(new TermQuery() , BooleanClause.Occur.MUST);  // for +

    or
    query.add(new TermQuery(), BooleanClause.Occur.MUST_NOT); // for -

you can find the information with lucene javadoc
http://lucene.zones.apache.org:8080/hudson/job/Lucene-Nightly/javadoc/

Classes with BooleanQuery  and BooleanClause.Occur

above


Chris.

  Search Team in PCHOME co. in Taiwan.



2008/1/2, CowboyX <frank.hampshire@ruleburst.com>:
>
>
> Hi,
>
> Ive search to see if anyone has asked this before, and i couldn't find
> anything. Apologies if this is a stupid question.
>
> What's the difference between the "AND" and the "+" boolean operators.
> Also
> the "NOT" and "-" boolean operators? Are each of these pair of operators
> functionally equivalent?
>
> From the examples provided in the Query Syntax documentation at:
>
> http://lucene.apache.org/java/docs/queryparsersyntax.html#Boolean%20operators
> it looks as if these are the same.
>
> Any comments would be welcome on this.
> --
> View this message in context:
> http://www.nabble.com/Question-about-Boolean-Operators-tp14573890p14573890.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
>
>


-- 
Chris Lin
chrislin0426@gmail.com
Taipei , Taiwan.
-----------------------------------------------------------
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message