lucenenet-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Currens <currens.ch...@gmail.com>
Subject Re: [Lucene.Net] escaping single quotes when using query parser
Date Fri, 08 Apr 2011 16:15:46 GMT
I'm not sure you're issue is related to single quotes.  The only characters
that need to be escaped for the QueryParser are + - ! ( ) { } [ ] ^ " ~ * ?
: \  You can do that using QueryParser.Escape(string).  It's possible you it
might be related to the analyzer that you're using.  In my experience,
sometimes using a different analyzer to index than you use to search can
*sometimes* cause unexpected behavior like this.  Since I haven't myself run
into this exact problem to the best of my knowledge, it's tough for me to
give a more specific answer without your code/test data.

Thanks,
Christopher

On Thu, Apr 7, 2011 at 2:01 AM, Ben Foster <ben@planetcloud.co.uk> wrote:

> Hi,
>
>
>
> How should we escape single quotes when working with the query parser?
>
>
>
> Currently we have a description field that may contain single quotes.
>
>
>
> Whilst this field is correctly indexed when we search the description no
> results are returned. I'm assuming it's because we need to replace the
> single quote in the search term with an escaped version.
>
>
>
> Many thanks,
>
>
>
> Ben Foster
>
>
>
> planetcloud
> The Elms, Hawton
> Newark-on-Trent
> Nottinghamshire
> NG24 3RL
>
>
>
>  <http://www.planetcloud.co.uk/> www.planetcloud.co.uk
>
>
>
>

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