[ 
https://issues.apache.org/jira/browse/SOLR-161?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12602038#action_12602038
 ] 

Mike Klaas commented on SOLR-161:
---------------------------------

> It is really a Lucene query parser bug, but it wouldn't hurt to do s/(.*)-/&/ 
> as a workaround. Assuming my ed(1) syntax is still > >fresh. Regardless, no 
> query string should ever give a stack trace

This might be hard to guarantee.  Already there are four issues details 
specific ways that dismax that barf on input.  A lot of the suggestions above 
are of the form of detecting a specific failure mode and correcting it, which 
does not guarantee that you will catch them all.

A robust way to do it is parse the query into an AST using a grammar in a way 
that matches the query as well as possible (dropping the stuff that doesn't 
fit).  Unfortunately, this is duplicative of the lucene parsing logic, and it 
would be nicer add a "relaxed" mode to lucene rather than pre-parsing the query.

(The reparse+reassemble method is what we use, btw.  It is written in python 
but it might be possible to translate to java.)

> Dangling dash causes stack trace
> --------------------------------
>
>                 Key: SOLR-161
>                 URL: https://issues.apache.org/jira/browse/SOLR-161
>             Project: Solr
>          Issue Type: Bug
>          Components: search
>    Affects Versions: 1.1.0
>         Environment: Java 1.5, Tomcat 5.5.17, Fedora Core 4, Intel
>            Reporter: Walter Underwood
>
> I'm running tests from our search logs, and we have a query that ends in a 
> dash. That caused a stack trace.
> org.apache.lucene.queryParser.ParseException: Cannot parse 'digging for the 
> truth -': Encountered "<EOF>" at line 1, column 23.
> Was expecting one of:
>     "(" ...
>     <QUOTED> ...
>     <TERM> ...
>     <PREFIXTERM> ...
>     <WILDTERM> ...
>     "[" ...
>     "{" ...
>     <NUMBER> ...
>     
>       at org.apache.lucene.queryParser.QueryParser.parse(QueryParser.java:127)
>       at 
> org.apache.solr.request.DisMaxRequestHandler.handleRequest(DisMaxRequestHandler.java:272)
>       at org.apache.solr.core.SolrCore.execute(SolrCore.java:595)
>       at org.apache.solr.servlet.SolrServlet.doGet(SolrServlet.java:92)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to