jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Guggisberg <stefan.guggisb...@gmail.com>
Subject Re: nt:resource nodes and versioning/textfiltering
Date Fri, 11 Nov 2005 15:38:46 GMT
hi kurt

On 11/10/05, Kurt Verduyckt <kurt@modulo1.be> wrote:
> Hi all,
>
> I have some troubles regarding the following situation:
>
> I'm writing an application that needs to store some xml content which needs
> to be versioned and searchable on some -not all- of those xml fields. So my
> best guess was to use the nt:resource node, add a mixin type mix:versionable
> to do the versioning and store the xml data in the jcr:data property. This
> should allow me to write a custom textfilter to filter the xml content and
> index only those xml fields that I'm interested in for searching, right?
>
> Now these are the problems I'm having:
>
> 1) first of all I noticed that when I make the nt:resource node versionable,
> the node somehow loses the jcr:data content after a checkIn operation... and
> only transfers it to the frozen node of the baseversion. Is this normal?
> What really troubles my is if I close the application (properly) and
> restart, doing a dump of the jcr contents, the jcr:data is filled again...
> so it seems it is kept in the session somewhere, but only persisted after a
> repository close operation...
>
> the code sample (with just 'text/plain' mimetype for now because I don't
> have a custom filter yet):
>
>
> Node content = rootnode.addNode("myns:xmlcontent","nt:resource");
> content.addMixin("mix:versionable"); //apparently performs a checkout behind
> the scenes
> content.setProperty("jcr:mimeType", "text/plain");
> content.setProperty("jcr:encoding", "");
> content.setProperty("jcr:data", xmlData2stream(xmlData));
> content.setProperty("jcr:lastModified", Calendar.getInstance ());
> session.save();
>
> //debugging showed that at this point jcr:data is filled with content but
> checkout=true
>
> content.checkin();
>
> //debugging showed that at this point jcr:data field is cleared! Until
> restart of the application, then the node contains data again ?!?
>
>
> so to retrieve the jcr:data field while running, the only way to find it for
> now is find the node, get the baseversion, get the frozennode under it and
> get the jcr:data field from there... but this doesn't feel quite right does
> it?
>
> 2) to search for a node with a certain text content (inside the jcr:data,
> which should be indexed by the textfilter), I guess I need to write an Xpath
> query... the only thing is I can't find any example on the net. My own best
> shot was something like this:
>
>
> Query q = qm.createQuery("//myns:xmlcontent[jcr:contains(.,'" + searchtext +
> "')]", Query.XPATH);
>
>
> but this returns no results... maybe this is just because of the problem
> stated in 1) ?
>
> Anybody who knows what I might be doing wrong?

you're not doing anything wrong, the problem you're describing is
clearly a bug. please post a jira issue.

thanks for reporting this issue!

cheers
stefan

>
> Kind regards,
>
> Kurt
>
>
>
>
>
>
>

Mime
View raw message