jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeroen Reijn <j.re...@onehippo.com>
Subject Re: Resultless XPath Queries
Date Thu, 22 Aug 2013 13:16:47 GMT
Hi,

as of Jackrabbit 2 you will need an order by clause to get a valid result
out of the size. Also see
http://jackrabbit.apache.org/frequently-asked-questions.html at the bottom
of the page.

Jeroen


On Wed, Jul 17, 2013 at 3:40 PM, Sebastian Lindstaedt <
Sebastian.Lindstaedt@vaberlin.de> wrote:

> Hi Julian,
>
> Thank you very much, you were absolutely correct! The nodes where there.
>
> Interestingly the code that I'm dealing with has plenty of such places
> where it relies on the described behavior.
>
> <code>
> result.getNodes().getSize() >= 1
> </code>
>
> Checking the different Versions of RangeIterator (
> http://grepcode.com/file/repo1.maven.org/maven2/javax.jcr/jcr/1.0/javax/jcr/RangeIterator.java/)
> I'm wondering how that worked over the course of years. Maybe the
> Implementation of RangeIterator in the old Jackrabbit Version (1.5) did
> always knew how many nodes it contained :-)
>
>
> Best regards,
>
> Sebastian
>
> -----Urspr√ľngliche Nachricht-----
> Von: Julian Reschke [mailto:julian.reschke@gmx.de]
> Gesendet: Mittwoch, 17. Juli 2013 14:09
> An: users@jackrabbit.apache.org
> Cc: Sebastian Lindstaedt
> Betreff: Re: Resultless XPath Queries
>
> On 2013-07-17 13:47, Sebastian Lindstaedt wrote:
> > Hi,
> >
> > I'm migrating an Jackrabbit Application from JBoss EAP 5 to JBoss EAP 6
> (aka. JBoss 7.1.3.Final-redheat-4).
> > The Migration of Jackrabbit (from 1.5-jca to 2.5.3-jca) causes a bit of
> trouble with XPath Queries.
> >
> > To get jackrabbit-jca-2.5.3.rar running in the JBoss I modified it, as
> > shown here
> > (https://community.jboss.org/wiki/JackrabbitDeploymentInAS6AndAS7) and
> > here (http://www.javaworld.com/community/node/8185)
> >
> > After Deployment JBoss starts and the repository gets created.
> >
> > In my EJB Application I inject the repository as a Resource <code>
> >     Class MySessionBean ...{
> >       ...
> >      @Resource(mappedName = "java:jboss/jca/DocumentStore", type =
> javax.jcr.Repository.class, authenticationType =
> javax.annotation.Resource.AuthenticationType.CONTAINER)
> >      Repository                  repo;
> >      ...
> >      }
> > </code>
> >
> > With this injected Repository I can:
> > - create nodes:
> >      <code>
> >      Node node = rootNode.addNode("test", "nt:unstructured");
> >      </code>
> >
> > - list existing nodes:
> >      <code>
> >      session.getRootNode().getNodes();
> >      </code>
> >
> > - run JCR-SQL2 Queries, showing plenty of nodes
> >      <code>
> >      "SELECT * FROM [nt:unstructured]"
> >      </code>
> >
> > But unfortunately any XPath Query returns without any result
> > Query: "//*"  Result: queryresult.size = -1
> > Query: "//*[jcr:contains(., '*')]" Result: queryresult.size = -1
>
> Result size -1 means "unknown", not empty. You'll need to iterate through
> the result set...
>
> Best regards, Julian
>
> --
> This email was Virus checked by Astaro Security Gateway.
> http://www.astaro.com
>



-- 
Jeroen Reijn
Solution Architect
Hippo

Amsterdam - Oosteinde 11, 1017 WT Amsterdam
Boston - 101 Main Street, Cambridge, MA 02142

US +1 877 414 4776 (toll free)
Europe +31(0)20 522 4466
www.onehippo.com

http://about.me/jeroenreijn

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message