Return-Path: Delivered-To: apmail-jackrabbit-dev-archive@www.apache.org Received: (qmail 85962 invoked from network); 1 Dec 2009 11:53:45 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 1 Dec 2009 11:53:45 -0000 Received: (qmail 30401 invoked by uid 500); 1 Dec 2009 11:53:44 -0000 Delivered-To: apmail-jackrabbit-dev-archive@jackrabbit.apache.org Received: (qmail 30342 invoked by uid 500); 1 Dec 2009 11:53:44 -0000 Mailing-List: contact dev-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@jackrabbit.apache.org Delivered-To: mailing list dev@jackrabbit.apache.org Received: (qmail 30269 invoked by uid 99); 1 Dec 2009 11:53:44 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 01 Dec 2009 11:53:44 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 01 Dec 2009 11:53:42 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id E4D48234C4AA for ; Tue, 1 Dec 2009 03:53:20 -0800 (PST) Message-ID: <694296178.1259668400936.JavaMail.jira@brutus> Date: Tue, 1 Dec 2009 11:53:20 +0000 (UTC) From: "Oleg Varaksin (JIRA)" To: dev@jackrabbit.apache.org Subject: [jira] Created: (JCR-2416) Text.escapeIllegalXpathSearchChars doesn't work correct - Full text search failed MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org Text.escapeIllegalXpathSearchChars doesn't work correct - Full text search failed --------------------------------------------------------------------------------- Key: JCR-2416 URL: https://issues.apache.org/jira/browse/JCR-2416 Project: Jackrabbit Content Repository Issue Type: Bug Components: jackrabbit-jcr-commons Affects Versions: 1.6.0 Environment: Don't matter Reporter: Oleg Varaksin Priority: Minor Hello, I use instructions from http://wiki.apache.org/jackrabbit/EncodingAndEscaping to escape values in queries for full text search, but the method Text.escapeIllegalXpathSearchChars does something strange replacements. If I want to search a whole phrase I surround the text with double quotes. This is described in JCR 170 (section 6.6.5.2 jcr:contains Function) A term may be either a single word or a phrase delimited by double quotes ("). Well. I write now a String "\"Have much fun\"", pass it through Text.escapeIllegalXpathSearchChars and let execute then query. An exception is thrown: javax.jcr.RepositoryException: Exception building query: org.apache.lucene.queryParser.ParseException: Cannot parse '"Have much fun\"': Lexical error at line 1, column 17. Encountered: after : "\"Have much fun\\\"" I think, Text.escapeIllegalXpathSearchChars doesn't work correct if the whole phrase is surrounded by \" (double quotes within String) and the sign \" is the last sign. Query statement: //element(*, cssns:file)[jcr:contains(jcr:content, '"Have much fun"')] Executing: QueryManager.createQuery(statement, Query.XPATH).execute(); I use as dependency Apache Lucene Core 2.4.1. As workaround I call now simple userValue.replaceAll("'", "''"); instead of Text.escapeIllegalXpathSearchChars(userValue).replaceAll("'", "''") and it works fine! Best regards. Oleg. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.