lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hostetter <hossman_luc...@fucit.org>
Subject Re: Getting a Better Understanding of Lucene's Search Operators
Date Wed, 10 Jan 2007 23:40:05 GMT

: This is now my generalized understanding of the parser's operators.  Am I
: closer?

I'm guessing there is suppose to be some sort of table structure to the
mail you send ... it doesn't work in plain text mail readers so i'm not
sure whta ou were trying to say.

In a nut shell...

 1) Lucene's QueryParser class does not parse boolean expressions -- it
    might look like it, but it does not.
 2) Lucene's BooleanQuery clause does not model Boolean Queries ... it
    models aggregate queries.
 3) the most native way to represent the options available in a lucene
    "BooleanQuery" as a string is with the +/- prefixes, where...
     +foo ... means foo is a required clause and docs must match it
     -foo ... means foo is prohibited clause and docs must not match it
      foo ... means foo is an optional clause and docs that match it will
              get score benefits for doing so.
 4) in an attempt to make things easier for people who have
    simple needs, QueryParser "fakes" that it parses boolean expressions
    by interpreting "A AND B" as "+A +B"; "A OR B" as "A B" and "NOT A" as
    "-A"
 5) if you change the default operator on QueryParser to be AND then
    things get more complicated, mainly because then QueryParser treats
    "A B" the same as "+A +B"
 6) you should avoid thinking in terms of AND, OR, and NOT ... think in
    terms of OPTIONAL, REQUIRED, and PROHIBITED ... your life will be much
    easier: documentation will make more sense, conversations on the email
    list will be more synergistastic, wine will be sweeter, and food will
    taste better.

:
:
: *Document*
:
: A OR B
:
: A B
:
: +A B
:
: A
:
: NOT B
:
: -B
:
: A AND NOT B
:
: A ?B
:
: *No Matching Terms*
:
: 0
:
: 0
:
: 0
:
: 0
:
: 1
:
: 0
:
: 0
:
: 0
:
: A
:
: 1
:
: 1
:
: 1
:
: 1
:
: 1
:
: 0
:
: 1
:
: 1
:
: B
:
: 1
:
: 1
:
: 0
:
: 0
:
: 0
:
: 0
:
: 0
:
: *0*
:
: A B
:
: 1
:
: 2
:
: 2
:
: 1
:
: 0
:
: 0
:
: 0
:
: 1* 0*
:   Non-zero results are returned to the user.               *Walt Stoneburner
: <wls@wwco.com>   10-Jan-2007   v1.0*
:
: -wls
:



-Hoss


---------------------------------------------------------------------
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