Return-Path: Delivered-To: apmail-jackrabbit-users-archive@minotaur.apache.org Received: (qmail 10895 invoked from network); 28 Mar 2011 18:58:37 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 28 Mar 2011 18:58:37 -0000 Received: (qmail 24616 invoked by uid 500); 28 Mar 2011 18:58:37 -0000 Delivered-To: apmail-jackrabbit-users-archive@jackrabbit.apache.org Received: (qmail 24592 invoked by uid 500); 28 Mar 2011 18:58:37 -0000 Mailing-List: contact users-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@jackrabbit.apache.org Delivered-To: mailing list users@jackrabbit.apache.org Received: (qmail 24584 invoked by uid 99); 28 Mar 2011 18:58:37 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 28 Mar 2011 18:58:37 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of crankydillo@gmail.com designates 209.85.216.177 as permitted sender) Received: from [209.85.216.177] (HELO mail-qy0-f177.google.com) (209.85.216.177) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 28 Mar 2011 18:58:32 +0000 Received: by qyl38 with SMTP id 38so3905296qyl.1 for ; Mon, 28 Mar 2011 11:58:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type:content-transfer-encoding; bh=+yNVZ8h5UvK0G7m3cwWdNkynSRLRgXOmJUYqC/B6k5s=; b=etOlROsFqpwTzNXFrGJec68ifBvcLZRD7tQN0VE+DTFgv1w44Gn/8XjlENpEcuH5lw 2hMkPhpelff+jb47tJZafjqNsVfdKh9+ba57WUi5luGRoJZvUYky1nfazQUhY305Hg/l Ai0TbyfW/0pE8vbGC0GkDTTyPJ2C/N/jH6dGw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=H685S1NQcH5iyWY9uzb+A2Ng7ACgq+ver8BJb2GykwTXsbGWPVB/mwvRVQdALqRS58 e8fuT+Fhtjby3vLuDnouO9vNXwbtr4XZtUz4k7+MbEge19weyU+6QCjWfZ9/96ZXsd64 AV2I6H6AY9xaBZbTvmzj4N3pIkBO4saxZU+pk= MIME-Version: 1.0 Received: by 10.224.183.204 with SMTP id ch12mr3566380qab.341.1301338690336; Mon, 28 Mar 2011 11:58:10 -0700 (PDT) Received: by 10.229.191.139 with HTTP; Mon, 28 Mar 2011 11:58:10 -0700 (PDT) In-Reply-To: References: Date: Mon, 28 Mar 2011 13:58:10 -0500 Message-ID: Subject: Re: jcr:like on long string properties (Jackrabbit 1.6.1) From: Samuel Cox To: users@jackrabbit.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable First, I just tried with Jackrabbit and got the same result. Basically, using jcr:like as part of a xpath query is not working for long string properties. I have the following Scala app written for testing. I can port to Java if necessary.. import javax.jcr._ import org.apache.jackrabbit.core.TransientRepository object Searcher { def main(args: Array[String]): Unit =3D { val repo =3D new TransientRepository(); val session =3D repo.login(new SimpleCredentials("f", Array('p'))); try { val root =3D session.getRootNode; val node =3D root.addNode("anode"); node.setProperty("ls", ("a" * 10000) + "bcd"); node.setProperty("ss", "aaabcd"); session.save(); val searcher =3D new Searcher(session); // Expect this to return sequence with 1 element. val res =3D searcher.xpath(".[jcr:like(@ss, \"%bc%\")]"); println(res.size) // and it does // Expect this to return sequence with 1 element. val res2 =3D searcher.xpath(".[jcr:like(@ls, \"%bc%\")]"); println(res2.size) // but it does not } finally { session.logout(); } } } import javax.jcr.{Node, NodeIterator, Session} import javax.jcr.version.Version import javax.jcr.query.Query.XPATH; /** * A facade for querying Jackrabbit. * * @author scox */ class Searcher(session: Session) { implicit def nodeIter2Iter( i: NodeIterator ) =3D new Iterator[Node] { def next =3D i.nextNode; def hasNext =3D i.hasNext; def remove =3D i.remove; } lazy val queryMgr =3D session.getWorkspace.getQueryManager def xpath(xpath: String): Seq[Node] =3D { val query =3D queryMgr.createQuery(xpath, XPATH); val result =3D query.execute; val iter =3D result.getNodes; iter.toSeq } } On Mon, Mar 28, 2011 at 1:21 PM, Jeroen Reijn wrote: > Hi Samuel, > > could you describe what is not working? As far as I know this should work > for any string, but it might have to do with the query or the stored valu= es. > > Regards, > > Jeroen > > On Wed, Feb 23, 2011 at 4:40 PM, Samuel Cox wrote= : > >> Hi, >> >> I have been operating under the assumption that I could use jcr:like >> to in effect do a substring search across string properties. =A0This >> worked well for all my test cases. =A0The problem is that the real data >> has strings that are much longer than my test data (bad test data:). >> Anyhow, should this not work for any length string? =A0I realize the >> performance is bad, but we don't anticipate this search crossing >> thousands and thousands of nodes. >> >> Here is a sample xpath: >> >> >> jcr:system/jcr:versionStorage/_x0036_c/_x0038_6/cb/_x0036_c86cb58-74a9-4= 955-b4a5-6b19eb6469f2/_x0031_.14//pvsw:artifact[jcr:like(pvsw:data/@pvsw:co= ntents, >> '%EDI%')] >> >> I'm going to try upgrading to 1.6.4 now. >> >> Any help is greatly appreciated. >> >