You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Sridhar Raman <sr...@gmail.com> on 2008/01/30 06:37:19 UTC

XPATH on versions of deleted nodes?

Hi

Would it possible for me to perform an XPATH query into the version storage
nodes, and try to obtain the frozen child node copy of a deleted node by
using the jcr:frozenUuid property, if I knew the UUID of the node that had
been deleted.

I tried the above, and it returned no results.  Any particular reason why I
am facing this problem?

Thanks in advance,
Sridhar

Re: XPATH on versions of deleted nodes?

Posted by Sridhar Raman <sr...@gmail.com>.
Thanks, it works.

On Feb 7, 2008 2:47 PM, Marcel Reutegger <ma...@gmx.net> wrote:

> Sridhar Raman wrote:
> > No, in my repository.xml file, SearchIndex is a direct child of
> Workspace
> > element, not Repository element.  Could that be the reason?
>
> yes, that's definitively the reason. the SearchIndex child of the
> Workspace
> element is responsible for indexing workspace contents (everything except
> /jcr:system), while the SearchIndex child of the Repository element is
> responsible for indexing repository wide contents (everything under
> /jcr:system).
>
> If the SearchIndex chlild of the Repository element is missing then the
> version
> storage is not indexed and a query will never return results from the
> version
> storage.
>
> Just add a SearchIndex and the very end of your repository.xml and
> restart:
>
> <Repository>
>
>    ......
>
>
>     <!--
>         Search index for content that is shared repository wide
>         (/jcr:system tree, contains mainly versions)
>     -->
>     <SearchIndex class="
> org.apache.jackrabbit.core.query.lucene.SearchIndex">
>         <param name="path" value="${rep.home}/repository/index"/>
>     </SearchIndex>
> </Repository>
>
>
> regards
>  marcel
>

Re: XPATH on versions of deleted nodes?

Posted by Marcel Reutegger <ma...@gmx.net>.
Sridhar Raman wrote:
> No, in my repository.xml file, SearchIndex is a direct child of Workspace
> element, not Repository element.  Could that be the reason?

yes, that's definitively the reason. the SearchIndex child of the Workspace 
element is responsible for indexing workspace contents (everything except 
/jcr:system), while the SearchIndex child of the Repository element is 
responsible for indexing repository wide contents (everything under /jcr:system).

If the SearchIndex chlild of the Repository element is missing then the version 
storage is not indexed and a query will never return results from the version 
storage.

Just add a SearchIndex and the very end of your repository.xml and restart:

<Repository>

    ......


     <!--
         Search index for content that is shared repository wide
         (/jcr:system tree, contains mainly versions)
     -->
     <SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
         <param name="path" value="${rep.home}/repository/index"/>
     </SearchIndex>
</Repository>


regards
  marcel

Re: XPATH on versions of deleted nodes?

Posted by Sridhar Raman <sr...@gmail.com>.
>
> can you please verify that the repository.xml contains a SearchIndex
> element as
> a direct child of Repository element? This is usually at the very end of
> the
> configuration file.
>
No, in my repository.xml file, SearchIndex is a direct child of Workspace
element, not Repository element.  Could that be the reason?

On Feb 6, 2008 11:53 PM, Marcel Reutegger <ma...@gmx.net> wrote:

> Hi Sridhar,
>
> that should work. when I run the following test:
>
>     Node n = testRootNode.addNode("n");
>     n.setProperty("prop", 1);
>     n.addMixin(mixVersionable);
>     testRootNode.save();
>     String uuid = n.getUUID();
>     System.out.println("created node with uuid: " + uuid);
>     n.checkin();
>     n.checkout();
>     n.setProperty("prop", 2);
>     n.save();
>     n.checkin();
>     n.checkout();
>     n.remove();
>     testRootNode.save();
>     String stmt = "//element(*, nt:frozenNode)[@jcr:frozenUuid='" + uuid +
> "']";
>     QueryResult result = executeQuery(stmt);
>     for (NodeIterator it = result.getNodes(); it.hasNext(); ) {
>         System.out.println(it.nextNode().getPath());
>     }
>
> it produces:
>
> created node with uuid: 53e4b2ad-b69b-406a-945d-359cc2828923
>
> /jcr:system/jcr:versionStorage/53/e4/b2/53e4b2ad-b69b-406a-945d-359cc2828923/jcr:rootVersion/jcr:frozenNode
>
> /jcr:system/jcr:versionStorage/53/e4/b2/53e4b2ad-b69b-406a-945d-359cc2828923/1.0/jcr:frozenNode
>
> /jcr:system/jcr:versionStorage/53/e4/b2/53e4b2ad-b69b-406a-945d-359cc2828923/1.1/jcr:frozenNode
>
> can you please verify that the repository.xml contains a SearchIndex
> element as
> a direct child of Repository element? This is usually at the very end of
> the
> configuration file.
>
> regards
>  marcel
>
>
> Sridhar Raman wrote:
> > This his how my XPATH statement looks like:
> > //element(*,
> > nt:frozenNode)[@jcr:frozenUuid='02133790-c6ed-4669-a11d-c7ecd18874b5']
> >
> > where 02133790-c6ed-4669-a11d-c7ecd18874b5 is the UUID of the node that
> was
> > deleted.
> >
> > Am I doing something wrong?
> >
> > On Feb 6, 2008 1:45 PM, Marcel Reutegger <ma...@gmx.net>
> wrote:
> >
> >> Sridhar Raman wrote:
> >>> Would it possible for me to perform an XPATH query into the version
> >> storage
> >>> nodes, and try to obtain the frozen child node copy of a deleted node
> by
> >>> using the jcr:frozenUuid property, if I knew the UUID of the node that
> >> had
> >>> been deleted.
> >>>
> >>> I tried the above, and it returned no results.  Any particular reason
> >> why I
> >>> am facing this problem?
> >> how does your xpath statement look like?
> >>
> >> regards
> >>  marcel
> >>
> >
>
>

Re: XPATH on versions of deleted nodes?

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

that should work. when I run the following test:

     Node n = testRootNode.addNode("n");
     n.setProperty("prop", 1);
     n.addMixin(mixVersionable);
     testRootNode.save();
     String uuid = n.getUUID();
     System.out.println("created node with uuid: " + uuid);
     n.checkin();
     n.checkout();
     n.setProperty("prop", 2);
     n.save();
     n.checkin();
     n.checkout();
     n.remove();
     testRootNode.save();
     String stmt = "//element(*, nt:frozenNode)[@jcr:frozenUuid='" + uuid + "']";
     QueryResult result = executeQuery(stmt);
     for (NodeIterator it = result.getNodes(); it.hasNext(); ) {
         System.out.println(it.nextNode().getPath());
     }

it produces:

created node with uuid: 53e4b2ad-b69b-406a-945d-359cc2828923
/jcr:system/jcr:versionStorage/53/e4/b2/53e4b2ad-b69b-406a-945d-359cc2828923/jcr:rootVersion/jcr:frozenNode
/jcr:system/jcr:versionStorage/53/e4/b2/53e4b2ad-b69b-406a-945d-359cc2828923/1.0/jcr:frozenNode
/jcr:system/jcr:versionStorage/53/e4/b2/53e4b2ad-b69b-406a-945d-359cc2828923/1.1/jcr:frozenNode

can you please verify that the repository.xml contains a SearchIndex element as 
a direct child of Repository element? This is usually at the very end of the 
configuration file.

regards
  marcel


Sridhar Raman wrote:
> This his how my XPATH statement looks like:
> //element(*,
> nt:frozenNode)[@jcr:frozenUuid='02133790-c6ed-4669-a11d-c7ecd18874b5']
> 
> where 02133790-c6ed-4669-a11d-c7ecd18874b5 is the UUID of the node that was
> deleted.
> 
> Am I doing something wrong?
> 
> On Feb 6, 2008 1:45 PM, Marcel Reutegger <ma...@gmx.net> wrote:
> 
>> Sridhar Raman wrote:
>>> Would it possible for me to perform an XPATH query into the version
>> storage
>>> nodes, and try to obtain the frozen child node copy of a deleted node by
>>> using the jcr:frozenUuid property, if I knew the UUID of the node that
>> had
>>> been deleted.
>>>
>>> I tried the above, and it returned no results.  Any particular reason
>> why I
>>> am facing this problem?
>> how does your xpath statement look like?
>>
>> regards
>>  marcel
>>
> 


Re: XPATH on versions of deleted nodes?

Posted by Sridhar Raman <sr...@gmail.com>.
This his how my XPATH statement looks like:
//element(*,
nt:frozenNode)[@jcr:frozenUuid='02133790-c6ed-4669-a11d-c7ecd18874b5']

where 02133790-c6ed-4669-a11d-c7ecd18874b5 is the UUID of the node that was
deleted.

Am I doing something wrong?

On Feb 6, 2008 1:45 PM, Marcel Reutegger <ma...@gmx.net> wrote:

> Sridhar Raman wrote:
> > Would it possible for me to perform an XPATH query into the version
> storage
> > nodes, and try to obtain the frozen child node copy of a deleted node by
> > using the jcr:frozenUuid property, if I knew the UUID of the node that
> had
> > been deleted.
> >
> > I tried the above, and it returned no results.  Any particular reason
> why I
> > am facing this problem?
>
> how does your xpath statement look like?
>
> regards
>  marcel
>

Re: XPATH on versions of deleted nodes?

Posted by Marcel Reutegger <ma...@gmx.net>.
Sridhar Raman wrote:
> Would it possible for me to perform an XPATH query into the version storage
> nodes, and try to obtain the frozen child node copy of a deleted node by
> using the jcr:frozenUuid property, if I knew the UUID of the node that had
> been deleted.
> 
> I tried the above, and it returned no results.  Any particular reason why I
> am facing this problem?

how does your xpath statement look like?

regards
  marcel