FAQ
Does a special character lika a "-" prohibitor operator require no-space after it in order to work as a prohibitor?

Typically on the web, e.g. Google and others, the "-" operator works as a boolean prohibitor only when not followed by a space. Otherwise it is treated as just a dash query term.

But in our Lucene implementation the the "-" seem to be acting as a prohibitor even if there is space after it. For example. in a query: Sales + service , the 'service' term is excluded by Lucene. (Same for the "+" operator.)

Is this space-treatment a bug or a standard Lucene query parser behavior?

Thank you,
Felix

Search Discussions

  • Yonik Seeley at Jan 23, 2007 at 6:05 pm

    On 1/23/07, Felix Litman wrote:
    Does a special character lika a "-" prohibitor operator require no-space after it in order to work as a prohibitor?

    Typically on the web, e.g. Google and others, the "-" operator works as a boolean prohibitor only when not followed by a space. Otherwise it is treated as just a dash query term.

    But in our Lucene implementation the the "-" seem to be acting as a prohibitor even if there is space after it. For example. in a query: Sales + service , the 'service' term is excluded by Lucene. (Same for the "+" operator.)

    Is this space-treatment a bug or a standard Lucene query parser behavior?
    I think this is expected, and changing it would be more confusing. Consider:
    If "-" is expected to find a dash, surely "-x" should find a dash
    followed by an x?

    If you want literals, put quotes around your terms...
    "Sales + service"

    -Yonik

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
  • Chris Hostetter at Jan 23, 2007 at 7:25 pm
    : If you want literals, put quotes around your terms...
    : "Sales + service"

    or if you don't want a full phrase, you just want "-" to be treated as
    a term match you can escape it, or quote it by itself...

    Sales \- service
    Sales "-" service



    -Hoss


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
  • Felix Litman at Jan 23, 2007 at 10:21 pm
    Thank you. Lucene documentation is vague on this subject.

    On the LIA-book -earch powered by Lucene it seems the "-" operator works as a prohibitor regardless of the number of spaces after the "-". Still can't tell if this is a bug or by design.

    A Nutch parser, however, seems to have changed that. I checked two Nutch/Lucene implementations the web - Indeed.com and at Oregon State. Their parsers provide a more "standard" public web search behavior. I.e. the "-" is treated as a minus only if no space between it and the search term. Otherwise the "-"becomes just another search term in the query.

    -Felix

    Yonik Seeley wrote: On 1/23/07, Felix Litman wrote:
    Does a special character lika a "-" prohibitor operator require no-space after it in order to work as a prohibitor?

    Typically on the web, e.g. Google and others, the "-" operator works as a boolean prohibitor only when not followed by a space. Otherwise it is treated as just a dash query term.

    But in our Lucene implementation the the "-" seem to be acting as a prohibitor even if there is space after it. For example. in a query: Sales + service , the 'service' term is excluded by Lucene. (Same for the "+" operator.)

    Is this space-treatment a bug or a standard Lucene query parser behavior?
    I think this is expected, and changing it would be more confusing. Consider:
    If "-" is expected to find a dash, surely "-x" should find a dash
    followed by an x?

    If you want literals, put quotes around your terms...
    "Sales + service"

    -Yonik

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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupjava-user @
categorieslucene
postedJan 23, '07 at 5:36p
activeJan 23, '07 at 10:21p
posts4
users3
websitelucene.apache.org

People

Translate

site design / logo © 2022 Grokbase