Simply escape it with a backslash or enclose the term in quotes.

Sure, it would be nice to be able to configure various operators to be disabled, but that's not fesible with query parser designed around static grammars and infleexible tools such as JFlex.

-- Jack Krupansky
-----Original Message----- From: Lanke,Aniruddha
Sent: Monday, October 13, 2014 11:03 AM
To: solr-user@lucene.apache.org
Subject: Re: eDisMax parser and special characters

Can the default behavior of "-" as a pre-fix operator be changed so it can be searched as a string?

Thanks,

On Oct 9, 2014, at 8:34 AM, Lanke,Aniruddha <aniruddha.la...@cerner.com> wrote:

Is there a way to override this default behavior?

— Lanke

On Oct 8, 2014, at 4:55 PM, Jack Krupansky <j...@basetechnology.com> wrote:

Hyphen is a "prefix operator" and is normally followed by a term to indicate that the term "must not" be present. So, your query has a syntax error. The two query parsers differ in how they handle various errors. In the case of edismax, it quotes operators and then tries again, so the hyphen gets quoted, and then analyzed to nothing for text fields but is still a string for string fields.

-- Jack Krupansky

-----Original Message----- From: Lanke,Aniruddha
Sent: Wednesday, October 8, 2014 4:38 PM
To: solr-user@lucene.apache.org
Subject: Re: eDisMax parser and special characters

Sorry for a delayed reply here is more information -

Schema that we are using - http://pastebin.com/WQAJCCph
Request Handler in config - http://pastebin.com/Y0kP40WF

Some analysis -

Search term: red -
Parser eDismax
No results show up
<str name="parsedquery">(+((DisjunctionMaxQuery((name_starts_with:red^9.0 | name_parts_starts_with:red^6.0 | s_detail:red | name:red^12.0 | s_detail_starts_with:red^3.0 | s_detail_parts_starts_with:red^2.0)) DisjunctionMaxQuery((name_starts_with:-^9.0 | s_detail_starts_with:-^3.0)))~2))/no_coord</str>

Search term: red -
Parser dismax
Results are returned
<str name="parsedquery">(+DisjunctionMaxQuery((name_starts_with:red^9.0 | name_parts_starts_with:red^6.0 | s_detail:red | name:red^12.0 | s_detail_starts_with:red^3.0 | s_detail_parts_starts_with:red^2.0)) ())/no_coord</str>

Why do we see the variation in the results between dismax and eDismax?


On Oct 8, 2014, at 8:59 AM, Erick Erickson <erickerick...@gmail.com<mailto:erickerick...@gmail.com>> wrote:

There's not much information here.
What's the doc look like?
What is the analyzer chain for it?
What is the output when you add &debug=query?

Details matter. A lot ;)

Best,
Erick

On Wed, Oct 8, 2014 at 6:26 AM, Michael Joyner <mich...@newsrx.com<mailto:mich...@newsrx.com>> wrote:
Try escaping special chars with a "\"


On 10/08/2014 01:39 AM, Lanke,Aniruddha wrote:

We are using a eDisMax parser in our configuration. When we search using
the query term that has a ‘-‘ we don’t get any results back.

Search term: red - yellow
This doesn’t return any data back but




CONFIDENTIALITY NOTICE This message and any included attachments are from Cerner Corporation and are intended only for the addressee. The information contained in this message is confidential and may constitute inside or non-public information under international, federal, or state securities laws. Unauthorized forwarding, printing, copying, distribution, or use of such information is strictly prohibited and may be unlawful. If you are not the addressee, please promptly delete this message and notify the sender of the delivery error by e-mail or you may call Cerner's corporate offices in Kansas City, Missouri, U.S.A at (+1) (816)221-1024.

Reply via email to