How to properly escape special characters?


(Shane Witbeck) #1

I'm using 0.18.7. How do I properly escape and search on special characters
in a query_string query?


(Clinton Gormley) #2

On Thu, 2012-02-23 at 10:36 -0800, Shane Witbeck wrote:

I'm using 0.18.7. How do I properly escape and search on special
characters in a query_string query?

http://lucene.apache.org/core/old_versioned_docs/versions/3_4_0/queryparsersyntax.html#Escaping%20Special%20Characters


(Shane Witbeck) #3

Thanks. I was aware of this doc but apparently you can't escape just a
single character for the query which is what I was trying. For example, if
the index has docs with the string [b] and you search on [ no results are
returned. However if you search [b] results are returned. Not sure if
this is expected?

On Friday, February 24, 2012 3:55:16 AM UTC-5, Clinton Gormley wrote:

On Thu, 2012-02-23 at 10:36 -0800, Shane Witbeck wrote:

I'm using 0.18.7. How do I properly escape and search on special
characters in a query_string query?

http://lucene.apache.org/core/old_versioned_docs/versions/3_4_0/queryparsersyntax.html#Escaping%20Special%20Characters

On Friday, February 24, 2012 3:55:16 AM UTC-5, Clinton Gormley wrote:

On Thu, 2012-02-23 at 10:36 -0800, Shane Witbeck wrote:

I'm using 0.18.7. How do I properly escape and search on special
characters in a query_string query?

http://lucene.apache.org/core/old_versioned_docs/versions/3_4_0/queryparsersyntax.html#Escaping%20Special%20Characters

On Friday, February 24, 2012 3:55:16 AM UTC-5, Clinton Gormley wrote:

On Thu, 2012-02-23 at 10:36 -0800, Shane Witbeck wrote:

I'm using 0.18.7. How do I properly escape and search on special
characters in a query_string query?

http://lucene.apache.org/core/old_versioned_docs/versions/3_4_0/queryparsersyntax.html#Escaping%20Special%20Characters


(Clinton Gormley) #4

On Sat, 2012-02-25 at 06:03 -0800, Shane Witbeck wrote:

Thanks. I was aware of this doc but apparently you can't escape just a
single character for the query which is what I was trying. For
example, if the index has docs with the string [b] and you search on
[ no results are returned. However if you search [b] results are
returned. Not sure if this is expected?

] is also a reserved character, so both the [ and ] need to be escaped.
This is nothing to do with ES. It is how the Lucene query parser works

clint

On Friday, February 24, 2012 3:55:16 AM UTC-5, Clinton Gormley wrote:
On Thu, 2012-02-23 at 10:36 -0800, Shane Witbeck wrote:
> I'm using 0.18.7. How do I properly escape and search on
special
> characters in a query_string query?

    http://lucene.apache.org/core/old_versioned_docs/versions/3_4_0/queryparsersyntax.html#Escaping%20Special%20Characters

On Friday, February 24, 2012 3:55:16 AM UTC-5, Clinton Gormley wrote:
On Thu, 2012-02-23 at 10:36 -0800, Shane Witbeck wrote:
> I'm using 0.18.7. How do I properly escape and search on
special
> characters in a query_string query?

    http://lucene.apache.org/core/old_versioned_docs/versions/3_4_0/queryparsersyntax.html#Escaping%20Special%20Characters

On Friday, February 24, 2012 3:55:16 AM UTC-5, Clinton Gormley wrote:
On Thu, 2012-02-23 at 10:36 -0800, Shane Witbeck wrote:
> I'm using 0.18.7. How do I properly escape and search on
special
> characters in a query_string query?

    http://lucene.apache.org/core/old_versioned_docs/versions/3_4_0/queryparsersyntax.html#Escaping%20Special%20Characters

(system) #5