As far as I understand, / is a special character and needs to be escaped.
Maybe "foo\/bar" should work?

I found this when I looked at the code of ClientUtils.escapeQueryChars:

// These characters are part of the query syntax and must be escaped
      if (c == '\\' || c == '+' || c == '-' || c == '!'  || c == '(' || c == 
')' || c == ':'
        || c == '^' || c == '[' || c == ']' || c == '\"' || c == '{' || c == 
'}' || c == '~'
        || c == '*' || c == '?' || c == '|' || c == '&'  || c == ';' || c == '/'
        || Character.isWhitespace(c)) {
        sb.append('\\');


-----Original Message-----
From: Alexandre Rafalovitch [mailto:arafa...@gmail.com] 
Sent: Thursday, September 06, 2012 4:35 PM
To: solr-user@lucene.apache.org
Subject: Solr 4.0alpha: edismax complaints on certain characters

Hello,

I was under the impression that edismax was supposed to be crash proof and just 
ignore bad syntax. But I am either misconfiguring it or hit a weird bug. I 
basically searched for text containing '/' and got this:

{
  'responseHeader'=>{
    'status'=>400,
    'QTime'=>9,
    'params'=>{
      'qf'=>'TitleEN DescEN',
      'indent'=>'true',
      'wt'=>'ruby',
      'q'=>'foo/bar',
      'defType'=>'edismax'}},
  'error'=>{
    'msg'=>'org.apache.lucene.queryparser.classic.ParseException:
Cannot parse \'foo/bar \': Lexical error at line 1, column 9.
Encountered: <EOF> after : "/bar "',
    'code'=>400}}

Is that normal? If it is, is there a known list of characters I need to escape 
or do I just have to catch the exception and tell user to not do this again?

Regards,
   Alex.

Personal blog: http://blog.outerthoughts.com/
LinkedIn: http://www.linkedin.com/in/alexandrerafalovitch
- Time is the quality of nature that keeps events from happening all at once. 
Lately, it doesn't seem to be working.  (Anonymous  - via GTD
book)

Reply via email to