lucenenet-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Itamar Syn-Hershko <ita...@code972.com>
Subject Re: [lucenenet] How do you handle an unmatched quote?
Date Fri, 12 May 2017 12:44:19 GMT
Take a look at the SimpleQueryParser (
https://github.com/apache/lucenenet/blob/master/src/Lucene.Net.QueryParser/Simple/SimpleQueryParser.cs)
from the QueryParser package. It handles syntax errors gracefully.

--

Itamar Syn-Hershko
Freelance Developer & Consultant
Elasticsearch Partner
Microsoft MVP | Lucene.NET PMC
http://code972.com | @synhershko <https://twitter.com/synhershko>
http://BigDataBoutique.co.il/

On Fri, May 5, 2017 at 10:58 PM, Alex Chesser - Katalyst <
achesser@katalystadvantage.com> wrote:

> Hi mailing list folks!
>
> I was wondering how other members of the list have solved the problem of
> unmatched special characters?
>
> As an example, I have a lucene.net search with the following results:
>
>
>    - term1 term2  - returns a search based on any occurrences of term1 &
>    term2
>    - "term1 term2" - returns a search based on the exact phrase "term1
>    term2"
>    - "term1 term2 - throws an exception "Lexical error" - <EOF> after :
>    "\"term1 term2
>
> now in searching for an answer, I saw online that there is one option which
> is to add a call to ESCAPE on the query parser
>
> Query query = parser.Parse(QueryParser.Escape(request.Phrase));
>
>
>
>
> but in this case, I'm seeing the results appear as:
>
>    - term1 term2  - returns a search based on any occurrences of term1 &
>    term2
>    - "term1 term2" - same as above
>    - "term1 term2 - same as above
>
> however, to in my opinion, the results should probably behave as:
>
>    - term1 term2  - returns a search based on any occurrences of term1 &
>    term2
>    - "term1 term2" - returns a search based on the exact phrase "term1
>    term2"
>    - "term1 term2 - same as the results of term1 term2
>
> I wonder if anyone else has encountered this or has come up with a
> different solution?
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message