[ https://issues.apache.org/jira/browse/LUCENE-881?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12496618 ]
Yonik Seeley commented on LUCENE-881: ------------------------------------- Sorry, I don't quite understand the problem. Could someone provide an actual query string that should work but doesn't? "||" is reserved since it means OR, AFAIK. > QueryParser escaping/parsin issue with strings starting/ending with || > ---------------------------------------------------------------------- > > Key: LUCENE-881 > URL: https://issues.apache.org/jira/browse/LUCENE-881 > Project: Lucene - Java > Issue Type: Bug > Components: QueryParser > Affects Versions: 2.1, 2.2 > Environment: MAC OS X 10.4.7, J2SE 5.0 Release 4 > Reporter: Slobodan Marjanovic > Assigned To: Michael Busch > Priority: Trivial > > There is a problem with query parser when search string starts/ends with ||. > When string contains || in the middle like 'something || something' > everything runs without a problem. > Part of code: > searchText = QueryParser.escape(searchText); > QueryParser parser = null; > parser = new QueryParser(fieldName, new CustomAnalyser()); > parser.parse(searchText); > CustomAnalyser class extends Analyser. Here is the only redefined method: > @Override > public TokenStream tokenStream(String fieldName, Reader reader) { > return new PorterStemFilter( (new > StopAnalyzer()).tokenStream(fieldName, reader)); > } > I have tested this on Lucene 2.1 and latest source I have checked-out from > SVN (Revision 538867) and in both cases parsing exception was thrown. > Part of Stack Trace (Lucene - SVN checkout - Revision 538867): > Cannot parse 'someting ||': Encountered "<EOF>" at line 1, column 11. > Was expecting one of: > <NOT> ... > "+" ... > "-" ... > "(" ... > "*" ... > <QUOTED> ... > <TERM> ... > <PREFIXTERM> ... > <WILDTERM> ... > "[" ... > "{" ... > <NUMBER> ... > > org.apache.lucene.queryParser.ParseException: Cannot parse 'someting ||': > Encountered "<EOF>" at line 1, column 11. > Was expecting one of: > <NOT> ... > "+" ... > "-" ... > "(" ... > "*" ... > <QUOTED> ... > <TERM> ... > <PREFIXTERM> ... > <WILDTERM> ... > "[" ... > "{" ... > <NUMBER> ... > > at > org.apache.lucene.queryParser.QueryParser.parse(QueryParser.java:150) > Part of Stack Trace (Lucene 2.1): > Cannot parse 'something ||': Encountered "<EOF>" at line 1, column 12. > Was expecting one of: > <NOT> ... > "+" ... > "-" ... > "(" ... > "*" ... > <QUOTED> ... > <TERM> ... > <PREFIXTERM> ... > <WILDTERM> ... > "[" ... > "{" ... > <NUMBER> ... > > org.apache.lucene.queryParser.ParseException: Cannot parse 'something ||': > Encountered "<EOF>" at line 1, column 12. > Was expecting one of: > <NOT> ... > "+" ... > "-" ... > "(" ... > "*" ... > <QUOTED> ... > <TERM> ... > <PREFIXTERM> ... > <WILDTERM> ... > "[" ... > "{" ... > <NUMBER> ... > > at > org.apache.lucene.queryParser.QueryParser.parse(QueryParser.java:149) -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]