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

Hoss Man commented on SOLR-161:
-------------------------------

A trailing dash is never meaningful, but should it be striped, escaped, or 
treated as an error (assuming the error message is improved)

As for examples of what i'm thinking:
  * a regex that escapes '-' if it appears before a sequence of digits
     (negative number? or prohibited number?)
  * a regex that escapes '"' if it apears at the end of a sequence of digits, 
and no 
     other instance of '"' proceeds it in the string.
     (inches? or unterminated phrase query?)
  * a regex that strips (or escapes) '-' or '+' characters that are ajacent 
only to whitespace
     or the start/end tokens of the string
     (literals? garbage to be ignored? or malformed mandatory/prohibited 
modifiers?)

...basically any of the types of preprocessing i ever considered hardcoding 
into dismax, but then decided not to because i was afraid someone would say 
"that's not what i want, and there's no way to turn it off"


> 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