Hi Daniel,

that's quite strange. I tried to reproduce the issue, but was unable to do so. Is there anything unusual in the log files that might explain why the queries fail?

you can also re-index the content and see if the query works afterwards:

- stop jackrabbit
- delete the directory <repo-home>/workspaces/default/index
- start jackrabbit
- execute the query

regards
 marcel

Daniel Mitterdorfer wrote:
Hi,

XPath does not seem to work as expected for me. This is a dump of my repository contents (node name, followed by the primary node type in parenthesis):

(rep:root)
Prop: jcr:primaryType = rep:root
 jcr:system (rep:system)
 Prop: jcr:primaryType = rep:system
 <<large subtree here - irrelevant to the problem>>
 interedu (nt:unstructured)
 Prop: jcr:primaryType = nt:unstructured
   someTitle (nt:file)
   Prop: jcr:uuid = 2e311056-b5a6-4279-9c04-430db01ad56b
   Prop: jcr:mixinTypes = mix:referenceable
   Prop: jcr:created = 2007-11-19T12:32:58.290+01:00
   Prop: jcr:primaryType = nt:file
     jcr:content (nt:resource)
     Prop: jcr:predecessors =
     Prop: jcr:uuid = b6b9f064-cb12-49e6-9c32-ae28657825b6
     Prop: jcr:mixinTypes = mix:versionable
     Prop: jcr:data = Test
     Prop: jcr:versionHistory = 8eb37332-2550-4486-9f49-6406f2b5ede2
     Prop: jcr:mimeType = text/plain
     Prop: jcr:lastModified = 2007-11-19T12:32:58.290+01:00
     Prop: jcr:baseVersion = 941d13f5-deb3-40e5-9cab-4d2609f1bf0a
     Prop: jcr:primaryType = nt:resource
     Prop: jcr:isCheckedOut = false
where "interedu" is the root node of my application. If I query for all nodes using the XPath query '//*', I get all nodes in the repository. So far, so good. However, if i want to query only for the 'interedu' subtree using the XPath query '//interedu/*' i get no results although 'interedu' has child nodes. I have already tried quite a few things but got no sufficient results (including a research on the Jackrabbit mailing lists). Can anybody see my error(s) or give me some pointers? Thanks!

Additional information:

* I have deleted all repository files before running my sample application.
* I use Jackrabbit version 1.3.3 which I integrat into my application using Spring Modules 0.8.
* My query code:

final QueryManager queryManager = session.getWorkspace().getQueryManager();
final Query query = queryManager.createQuery(queryString, Query.XPATH); //here I insert my query string (see above)
final QueryResult result = query.execute();
final NodeIterator it = result.getNodes();

System.err.println("================= Results =============");
while (it.hasNext()) {
 Node n = it.nextNode();
System.err.println(n.getPath() + " (" + n.getPrimaryNodeType().getName() + ")");
}

* My Jackrabbit config file is defined as follows:

<?xml version="1.0" encoding="ISO-8859-1"?>
<Repository>
   <FileSystem
       class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
       <param name="path" value="${rep.home}"/>
   </FileSystem>
   <Security appName="Jackrabbit">
       <AccessManager
class="org.apache.jackrabbit.core.security.SimpleAccessManager" />
   </Security>
   <Workspaces rootPath="${rep.home}/workspaces"
       defaultWorkspace="default" />
   <Workspace name="${wsp.name}">
       <FileSystem
           class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
           <param name="path" value="${wsp.home}"/>
       </FileSystem>
       <PersistenceManager
class="org.apache.jackrabbit.core.persistence.xml.XMLPersistenceManager"/>
       <SearchIndex
           class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
           <param name="path" value="${wsp.home}/index" />
           <param name="useCompoundFile" value="true" />
           <param name="minMergeDocs" value="100" />
           <param name="volatileIdleTime" value="3" />
           <param name="maxMergeDocs" value="100000" />
           <param name="mergeFactor" value="10" />
           <param name="maxFieldLength" value="10000" />
           <param name="bufferSize" value="10" />
           <param name="cacheSize" value="1000" />
           <param name="forceConsistencyCheck" value="false" />
           <param name="autoRepair" value="true" />
           <param name="analyzer"
value="org.apache.lucene.analysis.standard.StandardAnalyzer" />
           <param name="queryClass"
               value="org.apache.jackrabbit.core.query.QueryImpl" />
           <param name="respectDocumentOrder" value="true" />
           <param name="resultFetchSize" value="2147483647" />
           <param name="extractorPoolSize" value="0" />
           <param name="extractorTimeout" value="100" />
           <param name="extractorBackLogSize" value="100" />
           <param name="textFilterClasses"
value=" org.apache.jackrabbit.extractor.XMLTextExtractor,org.apache.jackrabbit.extractor.PlainTextExtractor,org.apache.jackrabbit.extractor.PdfTextExtractor,org.apache.jackrabbit.extractor.OpenOfficeTextExtractor,org.apache.jackrabbit.extractor.MsWordTextExtractor,org.apache.jackrabbit.extractor.MsPowerPointTextExtractor,org.apache.jackrabbit.extractor.MsExcelTextExtractor,org.apache.jackrabbit.extractor.HTMLTextExtractor" />
       </SearchIndex>
   </Workspace>

   <SearchIndex
       class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
       <param name="path" value="${rep.home}/repository/index" />
   </SearchIndex>

   <Versioning rootPath="${rep.home}/versions">
       <FileSystem
           class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
           <param name="path" value="${rep.home}"/>
       </FileSystem>
       <PersistenceManager
class="org.apache.jackrabbit.core.persistence.xml.XMLPersistenceManager"/>
   </Versioning>
</Repository>

Bye,

Daniel



Reply via email to