You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Daniel Mitterdorfer <da...@salzburgresearch.at> on 2007/11/19 12:36:17 UTC

XPath query returns no results

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

Re: excerpts - need help pls

Posted by Marcel Reutegger <ma...@gmx.net>.
alex marina wrote:
> If i don't specificy the supportHighlight in the repo.xml the SimpleExcerptProvider class gives the excerpt?

yes, that's correct.

regards
  marcel

excerpts - need help pls

Posted by alex marina <al...@yahoo.com>.
Hi,

If i don't specificy the supportHighlight in the repo.xml the SimpleExcerptProvider class gives the excerpt?

Tanks in advance
Alex

       
---------------------------------
Never miss a thing.   Make Yahoo your homepage.

Re: XPath query returns no results

Posted by Daniel Mitterdorfer <da...@salzburgresearch.at>.
Hi Marcel,

Marcel Reutegger wrote:
> 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?
>
I just noticed one strange thing though. If I execute the query 
"/jcr:root/*" I only get: "/jcr:system (rep:system)". However, as you 
can see in the dump in my first message I would have expected that my 
"interedu" node is the sibling node of "jcr:system" and thus included in 
the result (I have copied the relevant part of the dump below).

(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
[...]

So my #save() method makes me suspicious (see below a slightly 
simplified version):

private static final String APPLICATION_ROOT_NODE = "interedu";
//...
public void save(final InputStream data, final String originalName) {
  final JcrConstants constants = new JcrConstants(session);
  final Node root = session.getRootNode();
  Node applicationRoot = null;
  // create the application root node if necessary
  if (root.hasNode(APPLICATION_ROOT_NODE)) {
    applicationRoot = root.getNode(APPLICATION_ROOT_NODE);
  } else {
    applicationRoot = root.addNode(APPLICATION_ROOT_NODE);
  }
  final Node assetNode = applicationRoot.addNode(fileName, 
constants.getNT_FILE());

  // the assetNode is the 'entry point' for an asset.
  assetNode.addMixin(constants.getMIX_REFERENCEABLE());

  Node contentNode = assetNode.addNode(constants.getJCR_CONTENT(), 
constants.getNT_RESOURCE());
  // only the content node is versionable, not its parent!
  contentNode.addMixin(constants.getMIX_VERSIONABLE());
  try {
    final JcrConstants constants = new JcrConstants(session);
    contentNode.setProperty(constants.getJCR_DATA(), data);
    contentNode.setProperty(constants.getJCR_MIMETYPE(), 
MimeTypeDetector.getMimetype(originalName));
    contentNode.setProperty(constants.getJCR_LASTMODIFIED(), 
Calendar.getInstance().getTimeInMillis());
    session.save();
    contentNode.checkin();
  } finally {
    IOUtils.closeQuietly(data);
  }
}

bye,

Daniel

Re: XPath query returns no results

Posted by Daniel Mitterdorfer <da...@salzburgresearch.at>.
Hi Marcel,

I just verified your assumption: You were absolutely right. I was not 
aware that the XPath queries only run against committed results. Because 
my #dump() returned all expected nodes right before I issued the XPath 
query I thought it would also take these nodes into account. Thanks a 
lot to all for your help, especially to you, Marcel!

Bye,

Daniel

Marcel Reutegger wrote:
> Hi Daniel,
>
> ah, now I'm starting to realize what happens. You are using spring 
> modules, which probably wraps a transaction around your code. because 
> queries are only run against *committed* content it may happen that 
> you won't see results even though you saved (but not yet committed) 
> changes. this is somewhat counter intuitive and has been debated on 
> this list a while ago. JSR 283 will be more flexible in this respect.
>
> can you please make sure you commit the transaction before you execute 
> the query? that will probably solve your issue.
>
> regards
>  marcel
>


Re: XPath query returns no results

Posted by Marcel Reutegger <ma...@gmx.net>.
Hi Daniel,

ah, now I'm starting to realize what happens. You are using spring modules, 
which probably wraps a transaction around your code. because queries are only 
run against *committed* content it may happen that you won't see results even 
though you saved (but not yet committed) changes. this is somewhat counter 
intuitive and has been debated on this list a while ago. JSR 283 will be more 
flexible in this respect.

can you please make sure you commit the transaction before you execute the 
query? that will probably solve your issue.

regards
  marcel

Daniel Mitterdorfer wrote:
> Hi Marcel,
> 
> Marcel Reutegger wrote:
>> 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
> 
> I have embedded Jackrabbit into my application, therefore there is no 
> need to stop Jackrabbit.
> 
> Here is what I did:
> 
> 1. Deleted all directories below <repo-home>.
> 2. Started my test case (saving an item to the repository and executing 
> the query "/jcr:root/interedu/*"). I do not see anything unusal in the 
> logs below (full debug logging enabled, I have shortened the log a bit)
> 
> 2007-11-19 14:33:12,595 DEBUG 
> [org.apache.jackrabbit.core.TransientRepository] - <Initializing 
> transient repository>
> 2007-11-19 14:33:12,626 INFO [org.apache.jackrabbit.core.RepositoryImpl] 
> - <Starting repository...>
> 2007-11-19 14:33:12,658 INFO 
> [org.apache.jackrabbit.core.fs.local.LocalFileSystem] - <LocalFileSystem 
> initialized at path 
> D:\projects\interedu\workspace\AssetStore\target\test-classes\jcr-repository> 
> 
> 2007-11-19 14:33:12,798 INFO 
> [org.apache.jackrabbit.core.nodetype.NodeTypeRegistry] - <no custom node 
> type definitions found>
> 2007-11-19 14:33:12,814 INFO 
> [org.apache.jackrabbit.core.fs.local.LocalFileSystem] - <LocalFileSystem 
> initialized at path 
> D:\projects\interedu\workspace\AssetStore\target\test-classes\jcr-repository> 
> 
> 2007-11-19 14:33:12,845 INFO 
> [org.apache.jackrabbit.core.fs.local.LocalFileSystem] - <LocalFileSystem 
> initialized at path 
> D:\projects\interedu\workspace\AssetStore\target\test-classes\jcr-repository\versions\blobs> 
> 
> 2007-11-19 14:33:12,923 DEBUG 
> [org.apache.jackrabbit.core.state.MLRUItemStateCache] - 
> <org.apache.jackrabbit.core.state.MLRUItemStateCache@1e903d5 size=1, 
> 664/4194304>
> 2007-11-19 14:33:12,923 DEBUG 
> [org.apache.jackrabbit.core.state.MLRUItemStateCache] - 
> <org.apache.jackrabbit.core.state.MLRUItemStateCache@1490eb5 size=1, 
> 664/4194304>
> 2007-11-19 14:33:12,923 INFO [org.apache.jackrabbit.core.RepositoryImpl] 
> - <initializing workspace 'default'...>
> 2007-11-19 14:33:12,923 INFO 
> [org.apache.jackrabbit.core.fs.local.LocalFileSystem] - <LocalFileSystem 
> initialized at path 
> D:\projects\interedu\workspace\AssetStore\target\test-classes\jcr-repository\workspaces\default> 
> 
> 2007-11-19 14:33:12,923 INFO 
> [org.apache.jackrabbit.core.fs.local.LocalFileSystem] - <LocalFileSystem 
> initialized at path 
> D:\projects\interedu\workspace\AssetStore\target\test-classes\jcr-repository\workspaces\default\blobs> 
> 
> 2007-11-19 14:33:12,939 DEBUG 
> [org.apache.jackrabbit.core.state.MLRUItemStateCache] - 
> <org.apache.jackrabbit.core.state.MLRUItemStateCache@eaf40c size=1, 
> 964/4194304>
> 2007-11-19 14:33:12,954 DEBUG 
> [org.apache.jackrabbit.core.virtual.AbstractVISProvider] - <item added 
> to cache. size=1>
> 2007-11-19 14:33:12,954 DEBUG 
> [org.apache.jackrabbit.core.virtual.AbstractVISProvider] - <item added 
> to cache. size=2>
> [...]
> 2007-11-19 14:33:13,017 DEBUG 
> [org.apache.jackrabbit.core.virtual.AbstractVISProvider] - <item added 
> to cache. size=92>
> 2007-11-19 14:33:13,017 DEBUG 
> [org.apache.jackrabbit.core.virtual.AbstractVISProvider] - <item added 
> to cache. size=93>
> 2007-11-19 14:33:13,033 INFO [org.apache.jackrabbit.core.RepositoryImpl] 
> - <workspace 'default' initialized>
> 2007-11-19 14:33:13,173 DEBUG 
> [org.apache.jackrabbit.core.query.lucene.JackrabbitTextExtractor] - 
> <JackrabbitTextExtractor(org.apache.jackrabbit.extractor.DefaultTextExtractor)> 
> 
> 2007-11-19 14:33:13,204 INFO 
> [org.apache.jackrabbit.core.fs.local.LocalFileSystem] - <LocalFileSystem 
> initialized at path 
> D:\projects\interedu\workspace\AssetStore\target\test-classes\jcr-repository\repository\index> 
> 
> 2007-11-19 14:33:13,220 DEBUG 
> [org.apache.jackrabbit.core.query.lucene.Recovery] - <RedoLog is empty, 
> no recovery needed.>
> 2007-11-19 14:33:13,220 DEBUG 
> [org.apache.jackrabbit.core.state.MLRUItemStateCache] - 
> <org.apache.jackrabbit.core.state.MLRUItemStateCache@1551b0 size=1, 
> 1264/4194304>
> 2007-11-19 14:33:13,642 INFO 
> [org.apache.jackrabbit.core.state.CacheManager] - <resizeAll size=4>
> 2007-11-19 14:33:13,642 DEBUG 
> [org.apache.jackrabbit.core.state.CacheManager] - 
> <org.apache.jackrabbit.core.state.MLRUItemStateCache@1551b0 now:4194304 
> used:476790 access:1397 new:476790>
> 2007-11-19 14:33:13,642 DEBUG 
> [org.apache.jackrabbit.core.state.CacheManager] - 
> <org.apache.jackrabbit.core.state.MLRUItemStateCache@1490eb5 now:4194304 
> used:664 access:2 new:131072>
> 2007-11-19 14:33:13,642 DEBUG 
> [org.apache.jackrabbit.core.state.CacheManager] - 
> <org.apache.jackrabbit.core.state.MLRUItemStateCache@1e903d5 now:4194304 
> used:1178 access:5 new:131072>
> 2007-11-19 14:33:13,642 DEBUG 
> [org.apache.jackrabbit.core.state.CacheManager] - 
> <org.apache.jackrabbit.core.state.MLRUItemStateCache@eaf40c now:4194304 
> used:3256 access:7 new:131072>
> 2007-11-19 14:33:13,829 INFO 
> [org.apache.jackrabbit.core.query.lucene.SearchIndex] - <Index 
> initialized: 
> D:\projects\interedu\workspace\AssetStore\target\test-classes\jcr-repository/repository/index> 
> 
> 2007-11-19 14:33:13,829 DEBUG 
> [org.apache.jackrabbit.core.query.lucene.JackrabbitTextExtractor] - 
> <JackrabbitTextExtractor( 
> 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)> 
> 
> 2007-11-19 14:33:13,861 INFO 
> [org.apache.jackrabbit.core.fs.local.LocalFileSystem] - <LocalFileSystem 
> initialized at path 
> D:\projects\interedu\workspace\AssetStore\target\test-classes\jcr-repository\workspaces\default\index> 
> 
> 2007-11-19 14:33:13,861 DEBUG 
> [org.apache.jackrabbit.core.query.lucene.Recovery] - <RedoLog is empty, 
> no recovery needed.>
> 2007-11-19 14:33:13,861 INFO 
> [org.apache.jackrabbit.core.query.lucene.SearchIndex] - <Index 
> initialized: 
> D:\projects\interedu\workspace\AssetStore\target\test-classes\jcr-repository\workspaces\default/index> 
> 
> 2007-11-19 14:33:13,861 INFO [org.apache.jackrabbit.core.RepositoryImpl] 
> - <Repository started>
> 2007-11-19 14:33:13,861 INFO 
> [org.apache.jackrabbit.core.TransientRepository] - <Transient repository 
> initialized>
> 2007-11-19 14:33:13,861 DEBUG 
> [org.apache.jackrabbit.core.TransientRepository] - <Opening a new session>
> 2007-11-19 14:33:13,892 DEBUG 
> [org.apache.jackrabbit.core.state.MLRUItemStateCache] - 
> <org.apache.jackrabbit.core.state.MLRUItemStateCache@578073 size=1, 
> 664/4194304>
> 2007-11-19 14:33:13,892 INFO 
> [org.apache.jackrabbit.core.TransientRepository] - <Session opened>
> 2007-11-19 14:33:13,908 DEBUG 
> [org.springmodules.jcr.jackrabbit.LocalTransactionManager] - <Opened new 
> session [org.apache.jackrabbit.core.XASessionImpl@1415056] for JCR 
> transaction>
> 2007-11-19 14:33:13,923 DEBUG 
> [org.springmodules.jcr.jackrabbit.LocalTransactionManager] - <Found 
> thread-bound session [org.apache.jackrabbit.core.XASessionImpl@1415056] 
> for JCR transaction>
> 2007-11-19 14:33:13,923 DEBUG 
> [org.springmodules.jcr.jackrabbit.LocalTransactionManager] - <Using 
> transaction object 
> [org.springmodules.jcr.jackrabbit.LocalTransactionManager$JcrTransactionObject@4845aa]> 
> 
> 2007-11-19 14:33:13,923 DEBUG 
> [org.springmodules.jcr.jackrabbit.LocalTransactionManager] - 
> <Participating in existing transaction>
> 2007-11-19 14:33:13,923 DEBUG [org.springmodules.jcr.JcrTemplate] - 
> <Found thread-bound Session for JcrTemplate>
> 2007-11-19 14:33:13,939 DEBUG 
> [org.apache.jackrabbit.core.state.MLRUItemStateCache] - 
> <org.apache.jackrabbit.core.state.MLRUItemStateCache@14a75bb size=1, 
> 964/4194304>
> 2007-11-19 14:33:13,970 DEBUG [org.apache.jackrabbit.core.ItemManager] - 
> <created item cafebabe-cafe-babe-cafe-babecafebabe>
> 2007-11-19 14:33:13,970 DEBUG [org.apache.jackrabbit.core.ItemManager] - 
> <caching item cafebabe-cafe-babe-cafe-babecafebabe>
> [...]
> 2007-11-19 14:33:14,001 DEBUG [org.apache.jackrabbit.core.ItemManager] - 
> <caching item 
> f39def9f-4dde-4b31-9de5-8f804f493bbd/{http://www.jcp.org/jcr/1.0}predecessors> 
> 
> 2007-11-19 14:33:14,017 DEBUG 
> [org.apache.jackrabbit.core.HierarchyManagerImpl] - <failed to build 
> path of f39def9f-4dde-4b31-9de5-8f804f493bbd>
> 2007-11-19 14:33:14,017 DEBUG [org.apache.jackrabbit.core.ItemManager] - 
> <created item ebdad629-ac0b-44fe-8438-f0479403c4fb>
> 2007-11-19 14:33:14,017 DEBUG [org.apache.jackrabbit.core.ItemManager] - 
> <caching item ebdad629-ac0b-44fe-8438-f0479403c4fb>
> 2007-11-19 14:33:14,017 DEBUG [org.springmodules.jcr.JcrTemplate] - <Not 
> closing pre-bound Jcr Session after JcrTemplate>
> 2007-11-19 14:33:14,017 DEBUG 
> [org.springmodules.jcr.jackrabbit.LocalTransactionManager] - <Found 
> thread-bound session [org.apache.jackrabbit.core.XASessionImpl@1415056] 
> for JCR transaction>
> 2007-11-19 14:33:14,017 DEBUG 
> [org.springmodules.jcr.jackrabbit.LocalTransactionManager] - <Using 
> transaction object 
> [org.springmodules.jcr.jackrabbit.LocalTransactionManager$JcrTransactionObject@650892]> 
> 
> 2007-11-19 14:33:14,017 DEBUG 
> [org.springmodules.jcr.jackrabbit.LocalTransactionManager] - 
> <Participating in existing transaction>
> 2007-11-19 14:33:14,017 DEBUG [org.springmodules.jcr.JcrTemplate] - 
> <Found thread-bound Session for JcrTemplate>
> 2007-11-19 14:33:14,017 DEBUG [org.springmodules.jcr.JcrTemplate] - <Not 
> closing pre-bound Jcr Session after JcrTemplate>
> 2007-11-19 14:33:14,017 DEBUG 
> [org.springmodules.jcr.jackrabbit.LocalTransactionManager] - <Found 
> thread-bound session [org.apache.jackrabbit.core.XASessionImpl@1415056] 
> for JCR transaction>
> 2007-11-19 14:33:14,017 DEBUG 
> [org.springmodules.jcr.jackrabbit.LocalTransactionManager] - <Using 
> transaction object 
> [org.springmodules.jcr.jackrabbit.LocalTransactionManager$JcrTransactionObject@13e15f7]> 
> 
> 2007-11-19 14:33:14,017 DEBUG 
> [org.springmodules.jcr.jackrabbit.LocalTransactionManager] - 
> <Participating in existing transaction>
> 2007-11-19 14:33:14,017 DEBUG [org.springmodules.jcr.JcrTemplate] - 
> <Found thread-bound Session for JcrTemplate>
> 2007-11-19 14:33:14,173 DEBUG 
> [org.apache.jackrabbit.core.query.lucene.QueryImpl] - <Executing query:
> + Root node
> + Select properties: *
>  + PathQueryNode
>    + LocationStepQueryNode:  NodeTest={} Descendants=false Index=NONE
>    + LocationStepQueryNode:  NodeTest={}interedu Descendants=false 
> Index=NONE
>    + LocationStepQueryNode:  NodeTest=* Descendants=false Index=NONE
>  >
> 2007-11-19 14:33:14,189 DEBUG 
> [org.apache.jackrabbit.core.query.lucene.QueryResultImpl] - 
> <getResults(2147483647)>
> 2007-11-19 14:33:14,267 DEBUG 
> [org.apache.jackrabbit.core.query.lucene.AbstractIndex] - <merging 
> segments _0 (1 docs) _1 (1 docs) _2 (1 docs) _3 (1 docs) _4 (1 docs) _5 
> (1 docs) _6 (1 docs) _7 (1 docs) _8 (1 docs) _9 (1 docs) _a (1 docs) _b 
> (1 docs) _c (1 docs) _d (1 docs) _e (1 docs) _f (1 docs) _g (1 docs) _h 
> (1 docs) _i (1 docs) _j (1 docs) _k (1 docs) _l (1 docs) _m (1 docs) _n 
> (1 docs) _o (1 docs) _p (1 docs) _q (1 docs) _r (1 docs) _s (1 docs) _t 
> (1 docs) _u (1 docs) _v (1 docs) _w (1 docs) _x (1 docs) _y (1 docs) _z 
> (1 docs) _10 (1 docs) _11 (1 docs) _12 (1 docs) _13 (1 docs) _14 (1 
> docs) _15 (1 docs) _16 (1 docs) _17 (1 docs) _18 (1 docs) _19 (1 docs) 
> _1a (1 docs) _1b (1 docs) _1c (1 docs) _1d (1 docs) _1e (1 docs) _1f (1 
> docs) _1g (1 docs) _1h (1 docs) _1i (1 docs) _1j (1 docs) _1k (1 docs) 
> _1l (1 docs) _1m (1 docs) _1n (1 docs) _1o (1 docs) _1p (1 docs) _1q (1 
> docs) _1r (1 docs) _1s (1 docs) _1t (1 docs) _1u (1 docs) _1v (1 docs) 
> _1w (1 docs) _1x (1 docs) _1y (1 docs) _1z (1 docs) _20 (1 docs) _21 (1 
> docs) _22 (1 docs) _23 (1 docs) _24 (1 docs) _25 (1 docs) _26 (1 docs) 
> _27 (1 docs) _28 (1 docs) _29 (1 docs) _2a (1 docs) _2b (1 docs) _2c (1 
> docs) _2d (1 docs) _2e (1 docs) _2f (1 docs) _2g (1 docs) _2h (1 docs) 
> _2i (1 docs) _2j (1 docs) _2k (1 docs) _2l (1 docs) _2m (1 docs) _2n (1 
> docs) into _2o (96 docs)>
> 2007-11-19 14:33:14,283 DEBUG 
> [org.apache.jackrabbit.core.query.lucene.AbstractIndex] - <closing 
> IndexWriter.>
> 2007-11-19 14:33:14,298 DEBUG 
> [org.apache.jackrabbit.core.query.lucene.AbstractIndex] - <merging 
> segments _0 (1 docs) into _1 (1 docs)>
> 2007-11-19 14:33:14,298 DEBUG 
> [org.apache.jackrabbit.core.query.lucene.AbstractIndex] - <closing 
> IndexWriter.>
> 2007-11-19 14:33:14,329 DEBUG 
> [org.apache.jackrabbit.core.query.QueryImpl] - <executed in 0,16 s. 
> (/jcr:root/interedu/*)>
> 2007-11-19 14:33:14,329 DEBUG 
> [org.apache.jackrabbit.core.query.lucene.DocOrderNodeIteratorImpl] - <0 
> node(s) ordered in 0 ms>
> 2007-11-19 14:33:14,329 DEBUG [org.springmodules.jcr.JcrTemplate] - <Not 
> closing pre-bound Jcr Session after JcrTemplate>
> 2007-11-19 14:33:14,329 DEBUG 
> [org.springmodules.jcr.jackrabbit.LocalTransactionManager] - <Triggering 
> beforeCompletion synchronization>
> 2007-11-19 14:33:14,345 DEBUG 
> [org.springmodules.jcr.jackrabbit.LocalTransactionManager] - <Initiating 
> transaction rollback>
> 2007-11-19 14:33:14,345 DEBUG 
> [org.springmodules.jcr.jackrabbit.LocalTransactionManager] - <Rolling 
> back JCR transaction on session 
> [org.apache.jackrabbit.core.XASessionImpl@1415056]>
> 2007-11-19 14:33:14,345 DEBUG 
> [org.springmodules.jcr.jackrabbit.LocalTransactionManager] - <Triggering 
> afterCompletion synchronization>
> 2007-11-19 14:33:14,345 DEBUG 
> [org.springmodules.jcr.jackrabbit.LocalTransactionManager] - <Closing 
> JCR session [org.apache.jackrabbit.core.XASessionImpl@1415056] after 
> transaction>
> 2007-11-19 14:33:14,345 DEBUG 
> [org.springmodules.jcr.SessionFactoryUtils] - <Closing JCR Session>
> 2007-11-19 14:33:14,345 INFO 
> [org.apache.jackrabbit.core.TransientRepository] - <Session closed>
> 2007-11-19 14:33:14,345 DEBUG 
> [org.apache.jackrabbit.core.TransientRepository] - <Shutting down 
> transient repository>
> [...]
> 2007-11-19 14:33:14,408 INFO 
> [org.apache.jackrabbit.core.TransientRepository] - <Transient repository 
> shut down>
> 
> Bye,
> 
> Daniel
> 
> 


Re: XPath query returns no results

Posted by Daniel Mitterdorfer <da...@salzburgresearch.at>.
Hi Marcel,

Marcel Reutegger wrote:
> 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

I have embedded Jackrabbit into my application, therefore there is no 
need to stop Jackrabbit.

Here is what I did:

1. Deleted all directories below <repo-home>.
2. Started my test case (saving an item to the repository and executing 
the query "/jcr:root/interedu/*"). I do not see anything unusal in the 
logs below (full debug logging enabled, I have shortened the log a bit)

2007-11-19 14:33:12,595 DEBUG 
[org.apache.jackrabbit.core.TransientRepository] - <Initializing 
transient repository>
2007-11-19 14:33:12,626 INFO [org.apache.jackrabbit.core.RepositoryImpl] 
- <Starting repository...>
2007-11-19 14:33:12,658 INFO 
[org.apache.jackrabbit.core.fs.local.LocalFileSystem] - <LocalFileSystem 
initialized at path 
D:\projects\interedu\workspace\AssetStore\target\test-classes\jcr-repository>
2007-11-19 14:33:12,798 INFO 
[org.apache.jackrabbit.core.nodetype.NodeTypeRegistry] - <no custom node 
type definitions found>
2007-11-19 14:33:12,814 INFO 
[org.apache.jackrabbit.core.fs.local.LocalFileSystem] - <LocalFileSystem 
initialized at path 
D:\projects\interedu\workspace\AssetStore\target\test-classes\jcr-repository>
2007-11-19 14:33:12,845 INFO 
[org.apache.jackrabbit.core.fs.local.LocalFileSystem] - <LocalFileSystem 
initialized at path 
D:\projects\interedu\workspace\AssetStore\target\test-classes\jcr-repository\versions\blobs>
2007-11-19 14:33:12,923 DEBUG 
[org.apache.jackrabbit.core.state.MLRUItemStateCache] - 
<org.apache.jackrabbit.core.state.MLRUItemStateCache@1e903d5 size=1, 
664/4194304>
2007-11-19 14:33:12,923 DEBUG 
[org.apache.jackrabbit.core.state.MLRUItemStateCache] - 
<org.apache.jackrabbit.core.state.MLRUItemStateCache@1490eb5 size=1, 
664/4194304>
2007-11-19 14:33:12,923 INFO [org.apache.jackrabbit.core.RepositoryImpl] 
- <initializing workspace 'default'...>
2007-11-19 14:33:12,923 INFO 
[org.apache.jackrabbit.core.fs.local.LocalFileSystem] - <LocalFileSystem 
initialized at path 
D:\projects\interedu\workspace\AssetStore\target\test-classes\jcr-repository\workspaces\default>
2007-11-19 14:33:12,923 INFO 
[org.apache.jackrabbit.core.fs.local.LocalFileSystem] - <LocalFileSystem 
initialized at path 
D:\projects\interedu\workspace\AssetStore\target\test-classes\jcr-repository\workspaces\default\blobs>
2007-11-19 14:33:12,939 DEBUG 
[org.apache.jackrabbit.core.state.MLRUItemStateCache] - 
<org.apache.jackrabbit.core.state.MLRUItemStateCache@eaf40c size=1, 
964/4194304>
2007-11-19 14:33:12,954 DEBUG 
[org.apache.jackrabbit.core.virtual.AbstractVISProvider] - <item added 
to cache. size=1>
2007-11-19 14:33:12,954 DEBUG 
[org.apache.jackrabbit.core.virtual.AbstractVISProvider] - <item added 
to cache. size=2>
[...]
2007-11-19 14:33:13,017 DEBUG 
[org.apache.jackrabbit.core.virtual.AbstractVISProvider] - <item added 
to cache. size=92>
2007-11-19 14:33:13,017 DEBUG 
[org.apache.jackrabbit.core.virtual.AbstractVISProvider] - <item added 
to cache. size=93>
2007-11-19 14:33:13,033 INFO [org.apache.jackrabbit.core.RepositoryImpl] 
- <workspace 'default' initialized>
2007-11-19 14:33:13,173 DEBUG 
[org.apache.jackrabbit.core.query.lucene.JackrabbitTextExtractor] - 
<JackrabbitTextExtractor(org.apache.jackrabbit.extractor.DefaultTextExtractor)>
2007-11-19 14:33:13,204 INFO 
[org.apache.jackrabbit.core.fs.local.LocalFileSystem] - <LocalFileSystem 
initialized at path 
D:\projects\interedu\workspace\AssetStore\target\test-classes\jcr-repository\repository\index>
2007-11-19 14:33:13,220 DEBUG 
[org.apache.jackrabbit.core.query.lucene.Recovery] - <RedoLog is empty, 
no recovery needed.>
2007-11-19 14:33:13,220 DEBUG 
[org.apache.jackrabbit.core.state.MLRUItemStateCache] - 
<org.apache.jackrabbit.core.state.MLRUItemStateCache@1551b0 size=1, 
1264/4194304>
2007-11-19 14:33:13,642 INFO 
[org.apache.jackrabbit.core.state.CacheManager] - <resizeAll size=4>
2007-11-19 14:33:13,642 DEBUG 
[org.apache.jackrabbit.core.state.CacheManager] - 
<org.apache.jackrabbit.core.state.MLRUItemStateCache@1551b0 now:4194304 
used:476790 access:1397 new:476790>
2007-11-19 14:33:13,642 DEBUG 
[org.apache.jackrabbit.core.state.CacheManager] - 
<org.apache.jackrabbit.core.state.MLRUItemStateCache@1490eb5 now:4194304 
used:664 access:2 new:131072>
2007-11-19 14:33:13,642 DEBUG 
[org.apache.jackrabbit.core.state.CacheManager] - 
<org.apache.jackrabbit.core.state.MLRUItemStateCache@1e903d5 now:4194304 
used:1178 access:5 new:131072>
2007-11-19 14:33:13,642 DEBUG 
[org.apache.jackrabbit.core.state.CacheManager] - 
<org.apache.jackrabbit.core.state.MLRUItemStateCache@eaf40c now:4194304 
used:3256 access:7 new:131072>
2007-11-19 14:33:13,829 INFO 
[org.apache.jackrabbit.core.query.lucene.SearchIndex] - <Index 
initialized: 
D:\projects\interedu\workspace\AssetStore\target\test-classes\jcr-repository/repository/index>
2007-11-19 14:33:13,829 DEBUG 
[org.apache.jackrabbit.core.query.lucene.JackrabbitTextExtractor] - 
<JackrabbitTextExtractor( 
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)>
2007-11-19 14:33:13,861 INFO 
[org.apache.jackrabbit.core.fs.local.LocalFileSystem] - <LocalFileSystem 
initialized at path 
D:\projects\interedu\workspace\AssetStore\target\test-classes\jcr-repository\workspaces\default\index>
2007-11-19 14:33:13,861 DEBUG 
[org.apache.jackrabbit.core.query.lucene.Recovery] - <RedoLog is empty, 
no recovery needed.>
2007-11-19 14:33:13,861 INFO 
[org.apache.jackrabbit.core.query.lucene.SearchIndex] - <Index 
initialized: 
D:\projects\interedu\workspace\AssetStore\target\test-classes\jcr-repository\workspaces\default/index>
2007-11-19 14:33:13,861 INFO [org.apache.jackrabbit.core.RepositoryImpl] 
- <Repository started>
2007-11-19 14:33:13,861 INFO 
[org.apache.jackrabbit.core.TransientRepository] - <Transient repository 
initialized>
2007-11-19 14:33:13,861 DEBUG 
[org.apache.jackrabbit.core.TransientRepository] - <Opening a new session>
2007-11-19 14:33:13,892 DEBUG 
[org.apache.jackrabbit.core.state.MLRUItemStateCache] - 
<org.apache.jackrabbit.core.state.MLRUItemStateCache@578073 size=1, 
664/4194304>
2007-11-19 14:33:13,892 INFO 
[org.apache.jackrabbit.core.TransientRepository] - <Session opened>
2007-11-19 14:33:13,908 DEBUG 
[org.springmodules.jcr.jackrabbit.LocalTransactionManager] - <Opened new 
session [org.apache.jackrabbit.core.XASessionImpl@1415056] for JCR 
transaction>
2007-11-19 14:33:13,923 DEBUG 
[org.springmodules.jcr.jackrabbit.LocalTransactionManager] - <Found 
thread-bound session [org.apache.jackrabbit.core.XASessionImpl@1415056] 
for JCR transaction>
2007-11-19 14:33:13,923 DEBUG 
[org.springmodules.jcr.jackrabbit.LocalTransactionManager] - <Using 
transaction object 
[org.springmodules.jcr.jackrabbit.LocalTransactionManager$JcrTransactionObject@4845aa]>
2007-11-19 14:33:13,923 DEBUG 
[org.springmodules.jcr.jackrabbit.LocalTransactionManager] - 
<Participating in existing transaction>
2007-11-19 14:33:13,923 DEBUG [org.springmodules.jcr.JcrTemplate] - 
<Found thread-bound Session for JcrTemplate>
2007-11-19 14:33:13,939 DEBUG 
[org.apache.jackrabbit.core.state.MLRUItemStateCache] - 
<org.apache.jackrabbit.core.state.MLRUItemStateCache@14a75bb size=1, 
964/4194304>
2007-11-19 14:33:13,970 DEBUG [org.apache.jackrabbit.core.ItemManager] - 
<created item cafebabe-cafe-babe-cafe-babecafebabe>
2007-11-19 14:33:13,970 DEBUG [org.apache.jackrabbit.core.ItemManager] - 
<caching item cafebabe-cafe-babe-cafe-babecafebabe>
[...]
2007-11-19 14:33:14,001 DEBUG [org.apache.jackrabbit.core.ItemManager] - 
<caching item 
f39def9f-4dde-4b31-9de5-8f804f493bbd/{http://www.jcp.org/jcr/1.0}predecessors>
2007-11-19 14:33:14,017 DEBUG 
[org.apache.jackrabbit.core.HierarchyManagerImpl] - <failed to build 
path of f39def9f-4dde-4b31-9de5-8f804f493bbd>
2007-11-19 14:33:14,017 DEBUG [org.apache.jackrabbit.core.ItemManager] - 
<created item ebdad629-ac0b-44fe-8438-f0479403c4fb>
2007-11-19 14:33:14,017 DEBUG [org.apache.jackrabbit.core.ItemManager] - 
<caching item ebdad629-ac0b-44fe-8438-f0479403c4fb>
2007-11-19 14:33:14,017 DEBUG [org.springmodules.jcr.JcrTemplate] - <Not 
closing pre-bound Jcr Session after JcrTemplate>
2007-11-19 14:33:14,017 DEBUG 
[org.springmodules.jcr.jackrabbit.LocalTransactionManager] - <Found 
thread-bound session [org.apache.jackrabbit.core.XASessionImpl@1415056] 
for JCR transaction>
2007-11-19 14:33:14,017 DEBUG 
[org.springmodules.jcr.jackrabbit.LocalTransactionManager] - <Using 
transaction object 
[org.springmodules.jcr.jackrabbit.LocalTransactionManager$JcrTransactionObject@650892]>
2007-11-19 14:33:14,017 DEBUG 
[org.springmodules.jcr.jackrabbit.LocalTransactionManager] - 
<Participating in existing transaction>
2007-11-19 14:33:14,017 DEBUG [org.springmodules.jcr.JcrTemplate] - 
<Found thread-bound Session for JcrTemplate>
2007-11-19 14:33:14,017 DEBUG [org.springmodules.jcr.JcrTemplate] - <Not 
closing pre-bound Jcr Session after JcrTemplate>
2007-11-19 14:33:14,017 DEBUG 
[org.springmodules.jcr.jackrabbit.LocalTransactionManager] - <Found 
thread-bound session [org.apache.jackrabbit.core.XASessionImpl@1415056] 
for JCR transaction>
2007-11-19 14:33:14,017 DEBUG 
[org.springmodules.jcr.jackrabbit.LocalTransactionManager] - <Using 
transaction object 
[org.springmodules.jcr.jackrabbit.LocalTransactionManager$JcrTransactionObject@13e15f7]>
2007-11-19 14:33:14,017 DEBUG 
[org.springmodules.jcr.jackrabbit.LocalTransactionManager] - 
<Participating in existing transaction>
2007-11-19 14:33:14,017 DEBUG [org.springmodules.jcr.JcrTemplate] - 
<Found thread-bound Session for JcrTemplate>
2007-11-19 14:33:14,173 DEBUG 
[org.apache.jackrabbit.core.query.lucene.QueryImpl] - <Executing query:
+ Root node
+ Select properties: *
  + PathQueryNode
    + LocationStepQueryNode:  NodeTest={} Descendants=false Index=NONE
    + LocationStepQueryNode:  NodeTest={}interedu Descendants=false 
Index=NONE
    + LocationStepQueryNode:  NodeTest=* Descendants=false Index=NONE
 >
2007-11-19 14:33:14,189 DEBUG 
[org.apache.jackrabbit.core.query.lucene.QueryResultImpl] - 
<getResults(2147483647)>
2007-11-19 14:33:14,267 DEBUG 
[org.apache.jackrabbit.core.query.lucene.AbstractIndex] - <merging 
segments _0 (1 docs) _1 (1 docs) _2 (1 docs) _3 (1 docs) _4 (1 docs) _5 
(1 docs) _6 (1 docs) _7 (1 docs) _8 (1 docs) _9 (1 docs) _a (1 docs) _b 
(1 docs) _c (1 docs) _d (1 docs) _e (1 docs) _f (1 docs) _g (1 docs) _h 
(1 docs) _i (1 docs) _j (1 docs) _k (1 docs) _l (1 docs) _m (1 docs) _n 
(1 docs) _o (1 docs) _p (1 docs) _q (1 docs) _r (1 docs) _s (1 docs) _t 
(1 docs) _u (1 docs) _v (1 docs) _w (1 docs) _x (1 docs) _y (1 docs) _z 
(1 docs) _10 (1 docs) _11 (1 docs) _12 (1 docs) _13 (1 docs) _14 (1 
docs) _15 (1 docs) _16 (1 docs) _17 (1 docs) _18 (1 docs) _19 (1 docs) 
_1a (1 docs) _1b (1 docs) _1c (1 docs) _1d (1 docs) _1e (1 docs) _1f (1 
docs) _1g (1 docs) _1h (1 docs) _1i (1 docs) _1j (1 docs) _1k (1 docs) 
_1l (1 docs) _1m (1 docs) _1n (1 docs) _1o (1 docs) _1p (1 docs) _1q (1 
docs) _1r (1 docs) _1s (1 docs) _1t (1 docs) _1u (1 docs) _1v (1 docs) 
_1w (1 docs) _1x (1 docs) _1y (1 docs) _1z (1 docs) _20 (1 docs) _21 (1 
docs) _22 (1 docs) _23 (1 docs) _24 (1 docs) _25 (1 docs) _26 (1 docs) 
_27 (1 docs) _28 (1 docs) _29 (1 docs) _2a (1 docs) _2b (1 docs) _2c (1 
docs) _2d (1 docs) _2e (1 docs) _2f (1 docs) _2g (1 docs) _2h (1 docs) 
_2i (1 docs) _2j (1 docs) _2k (1 docs) _2l (1 docs) _2m (1 docs) _2n (1 
docs) into _2o (96 docs)>
2007-11-19 14:33:14,283 DEBUG 
[org.apache.jackrabbit.core.query.lucene.AbstractIndex] - <closing 
IndexWriter.>
2007-11-19 14:33:14,298 DEBUG 
[org.apache.jackrabbit.core.query.lucene.AbstractIndex] - <merging 
segments _0 (1 docs) into _1 (1 docs)>
2007-11-19 14:33:14,298 DEBUG 
[org.apache.jackrabbit.core.query.lucene.AbstractIndex] - <closing 
IndexWriter.>
2007-11-19 14:33:14,329 DEBUG 
[org.apache.jackrabbit.core.query.QueryImpl] - <executed in 0,16 s. 
(/jcr:root/interedu/*)>
2007-11-19 14:33:14,329 DEBUG 
[org.apache.jackrabbit.core.query.lucene.DocOrderNodeIteratorImpl] - <0 
node(s) ordered in 0 ms>
2007-11-19 14:33:14,329 DEBUG [org.springmodules.jcr.JcrTemplate] - <Not 
closing pre-bound Jcr Session after JcrTemplate>
2007-11-19 14:33:14,329 DEBUG 
[org.springmodules.jcr.jackrabbit.LocalTransactionManager] - <Triggering 
beforeCompletion synchronization>
2007-11-19 14:33:14,345 DEBUG 
[org.springmodules.jcr.jackrabbit.LocalTransactionManager] - <Initiating 
transaction rollback>
2007-11-19 14:33:14,345 DEBUG 
[org.springmodules.jcr.jackrabbit.LocalTransactionManager] - <Rolling 
back JCR transaction on session 
[org.apache.jackrabbit.core.XASessionImpl@1415056]>
2007-11-19 14:33:14,345 DEBUG 
[org.springmodules.jcr.jackrabbit.LocalTransactionManager] - <Triggering 
afterCompletion synchronization>
2007-11-19 14:33:14,345 DEBUG 
[org.springmodules.jcr.jackrabbit.LocalTransactionManager] - <Closing 
JCR session [org.apache.jackrabbit.core.XASessionImpl@1415056] after 
transaction>
2007-11-19 14:33:14,345 DEBUG 
[org.springmodules.jcr.SessionFactoryUtils] - <Closing JCR Session>
2007-11-19 14:33:14,345 INFO 
[org.apache.jackrabbit.core.TransientRepository] - <Session closed>
2007-11-19 14:33:14,345 DEBUG 
[org.apache.jackrabbit.core.TransientRepository] - <Shutting down 
transient repository>
[...]
2007-11-19 14:33:14,408 INFO 
[org.apache.jackrabbit.core.TransientRepository] - <Transient repository 
shut down>

Bye,

Daniel

Re: XPath query returns no results

Posted by Marcel Reutegger <ma...@gmx.net>.
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
> 
> 


Re: XPath query returns no results

Posted by Daniel Mitterdorfer <da...@salzburgresearch.at>.
Christoph Kiehl wrote:
> Daniel Mitterdorfer wrote:
>
>> 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!
>
> I'm not an XPath expert and it might be a bug, that the above doesn't 
> work. But until then try 'interedu/*' or '/jcr:root/interedu/*'. 
> Relative queries are always relative to the root node.
>
> Cheers,
> Christoph
>
Hi Christoph,

Thanks for your response. I just tried both queries. Unfortunately, 
neither of them returned a result. :-(

Bye,

Daniel

Re: XPath query returns no results

Posted by Christoph Kiehl <ch...@sulu3000.de>.
Daniel Mitterdorfer wrote:

> 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!

I'm not an XPath expert and it might be a bug, that the above doesn't work. But 
until then try 'interedu/*' or '/jcr:root/interedu/*'. Relative queries are 
always relative to the root node.

Cheers,
Christoph