lucenenet-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Chesser - Katalyst <aches...@katalystadvantage.com>
Subject [lucenenet] How do you handle an unmatched quote?
Date Fri, 05 May 2017 19:58:24 GMT
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