You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Peter Kirk <pk...@alpha-solutions.dk> on 2012/08/24 12:50:03 UTC

Unmatched quotes

Hi,

If I execute the following query, with unmatched quotes, I get an error from Solr - as I haven't escaped the middle ".

But the error message appears to simply be "400 null". Is it possible to get Solr to return a more informative error message?

http://myhost/solr/myapp/select?q=title:"cycle with 24" wheels"

Thanks,
Peter


Re: Unmatched quotes

Posted by Jack Krupansky <ja...@basetechnology.com>.
1. You can look at the Solr log file and see this exception:

Caused by: org.apache.lucene.queryParser.ParseException: Cannot parse 
'title:"cycle with 24': Lexical error at line 1, column 21.  Encountered: 
<EOF> after : "\"cycle with 24"
        at 
org.apache.lucene.queryParser.QueryParser.parse(QueryParser.java:216)
        at 
org.apache.solr.search.LuceneQParser.parse(LuceneQParserPlugin.java:79)
        at org.apache.solr.search.QParser.getQuery(QParser.java:143)
        at 
org.apache.solr.handler.component.QueryComponent.prepare(QueryComponent.java:105)
        ... 22 more
Caused by: org.apache.lucene.queryParser.TokenMgrError: Lexical error at 
line 1, column 21.  Encountered: <EOF> after : "\"cycle with 24"

2. Upgrade to Solr 4.0-BETA and Solr will give you this response:

<response>
<lst name="responseHeader">...</lst>
<lst name="error">
<str name="msg">
org.apache.lucene.queryparser.classic.ParseException: Cannot parse 
'title:"cycle with 24': Lexical error at line 1, column 21. Encountered: 
<EOF> after : "\"cycle with 24"
</str>
<int name="code">400</int>
</lst>
</response>

-- Jack Krupansky

-----Original Message----- 
From: Peter Kirk
Sent: Friday, August 24, 2012 6:50 AM
To: solr-user@lucene.apache.org
Subject: Unmatched quotes

Hi,

If I execute the following query, with unmatched quotes, I get an error from 
Solr - as I haven't escaped the middle ".

But the error message appears to simply be "400 null". Is it possible to get 
Solr to return a more informative error message?

http://myhost/solr/myapp/select?q=title:"cycle with 24" wheels"

Thanks,
Peter 


Re: Unmatched quotes

Posted by Ahmet Arslan <io...@yahoo.com>.
> If I execute the following query, with unmatched quotes, I
> get an error from Solr - as I haven't escaped the middle ".
> 
> But the error message appears to simply be "400 null". Is it
> possible to get Solr to return a more informative error
> message?
> 
> http://myhost/solr/myapp/select?q=title:"cycle with 24"
> wheels"

I don't know about the error message but (e)disxmax query parser strips unbalanced quotes.