Characters that cause query to Fail


(Brandon Hilkert) #1

We're doing some sample queries and found that a query with "!" causes the
search to fail.

A couple questions:

  • Is this expected?
  • If so, are there other characters we should remove before querying?

(Praveen Kariyanahalli) #2

Did you try escaping it ? I also have the same issue with ":" and "/". But
I am not sure the issue is with indexing or searching ?

Try escaping the character and run the query("!"), see if that helps.

-pk


(Brandon Hilkert) #3

Ah....gotcha. Cool. That fixed it!

On Thursday, July 26, 2012 3:50:59 PM UTC-4, Praveen Kariyanahalli wrote:

Did you try escaping it ? I also have the same issue with ":" and "/". But

I am not sure the issue is with indexing or searching ?

Try escaping the character and run the query("!"), see if that helps.

-pk


(Chris Male) #4

Hi Brandon,

  • If so, are there other characters we should remove before querying?

There are a number of special characters to watch out for. See the list at
the bottom of http://lucene.apache.org/core/3_6_0/queryparsersyntax.html


(simonw-2) #5

Brandon,

if you don't need query parser support ie. you don't expose operators like
AND, OR, NOT or phrases "foo bar" you can simply use a text query which
only goes through and analyzer without going through a QueryParser so you
don't need to worry about characters and escaping. this has also benefits
in security since nobody can issue very slow searches like fuzzy query like
foo~2 or wildcards like a*

here is a
link: http://www.elasticsearch.org/guide/reference/query-dsl/text-query.html

simon

On Friday, July 27, 2012 9:11:10 AM UTC+2, Chris Male wrote:

Hi Brandon,

  • If so, are there other characters we should remove before querying?

There are a number of special characters to watch out for. See the list
at the bottom of
http://lucene.apache.org/core/3_6_0/queryparsersyntax.html


(system) #6