Hi David, If you check out the JCR spec in section 6.6.4.3 (Context Node) it says that every Xpath query must start with the pseudo-root context node named "jcr:root". To quote:
<< The context node of an XPath query is the XML node relative to which the query expression is evaluated. A relative XPath statement (one that does not have a leading /) will be interpreted relative to the root node of the workspace, which, in the XML document view is the top-most XML element, <jcr:root>. This means that one should not include jcr:root as the first segment in a relative XPath statement, since that element is already the default context node. An absolute XPath (one with a leading /), in contrast, will be interpreted relative to a position one level above <jcr:root>. This means that an absolute XPath must either begin with // or with /jcr:root in order to match anything at all. >> Hope that helps, -- Mike > -----Original Message----- > From: David Kennedy [mailto:[EMAIL PROTECTED] > Sent: Thursday, April 27, 2006 3:11 PM > To: dev@jackrabbit.apache.org > Subject: Simple queries failing > > I am trying to execute very simple queries using the default > repository setup and the queries are failing: > > Here is how I'm getting the QueryManager and executing the query > > String statement = "/Perf"; > QueryManager queryManager = > (QueryManager)workspace.getQueryManager(); > Query query = queryManager.createQuery(statement, Query.XPATH); > QueryResult qResult = query.execute(); > NodeIterator iter = qResult.getNodes(); > System.out.println("Query = " + statement + " #hits = " + > iter.getSize()); > > The iterator size is always 0. My hierarchy starts with > /Perf and there > are many nodes below Perf. I have a repository explorer > that displays the hierarchy and confirms the nodes are there. > Is there something I'm missing? Where would you begin to > debug this? I've traced it to the LuceneQueryBuilder, but > haven't gone much further. How can I determine what's in the indices? > > David > -------------------------------------------------------- NOTICE: If received in error, please destroy and notify sender. Sender does not waive confidentiality or privilege, and use is prohibited.