Return-Path: Delivered-To: apmail-lucene-java-dev-archive@www.apache.org Received: (qmail 29509 invoked from network); 18 May 2007 17:35:39 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 18 May 2007 17:35:39 -0000 Received: (qmail 33656 invoked by uid 500); 18 May 2007 17:35:45 -0000 Delivered-To: apmail-lucene-java-dev-archive@lucene.apache.org Received: (qmail 33147 invoked by uid 500); 18 May 2007 17:35:43 -0000 Mailing-List: contact java-dev-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: java-dev@lucene.apache.org Delivered-To: mailing list java-dev@lucene.apache.org Received: (qmail 33135 invoked by uid 99); 18 May 2007 17:35:43 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 18 May 2007 10:35:43 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 18 May 2007 10:35:36 -0700 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 6E04A71406F for ; Fri, 18 May 2007 10:35:16 -0700 (PDT) Message-ID: <4610938.1179509716448.JavaMail.jira@brutus> Date: Fri, 18 May 2007 10:35:16 -0700 (PDT) From: "Michael Busch (JIRA)" To: java-dev@lucene.apache.org Subject: [jira] Updated: (LUCENE-881) QueryParser escaping/parsin issue with strings starting/ending with || In-Reply-To: <3032850.1179400876135.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/LUCENE-881?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Michael Busch updated LUCENE-881: --------------------------------- Attachment: lucene-881.patch Patch with additional unit tests. All tests pass. > 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 > Attachments: lucene-881.patch > > > 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 "" at line 1, column 11. > Was expecting one of: > ... > "+" ... > "-" ... > "(" ... > "*" ... > ... > ... > ... > ... > "[" ... > "{" ... > ... > > org.apache.lucene.queryParser.ParseException: Cannot parse 'someting ||': Encountered "" at line 1, column 11. > Was expecting one of: > ... > "+" ... > "-" ... > "(" ... > "*" ... > ... > ... > ... > ... > "[" ... > "{" ... > ... > > at org.apache.lucene.queryParser.QueryParser.parse(QueryParser.java:150) > Part of Stack Trace (Lucene 2.1): > Cannot parse 'something ||': Encountered "" at line 1, column 12. > Was expecting one of: > ... > "+" ... > "-" ... > "(" ... > "*" ... > ... > ... > ... > ... > "[" ... > "{" ... > ... > > org.apache.lucene.queryParser.ParseException: Cannot parse 'something ||': Encountered "" at line 1, column 12. > Was expecting one of: > ... > "+" ... > "-" ... > "(" ... > "*" ... > ... > ... > ... > ... > "[" ... > "{" ... > ... > > 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: java-dev-unsubscribe@lucene.apache.org For additional commands, e-mail: java-dev-help@lucene.apache.org