jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Shoener" <mshoe...@softwareapps.net>
Subject RE: Custom node or mixin added to existing node
Date Fri, 09 Oct 2009 13:38:41 GMT
Ok. I'll give an example of my query. In this example the "hfs:fileInfo" is
a mixin that was added to the "jcr:content" node (which is an nt:resource
node type).

	//element(*,hfs:fileInfo)[jcr:contains(jcr:content, 'testing') or

	The above for some reason does not check the actual contents of the
file, it only checks my custom property @hfs:description.

Then I tried querying the "nt:resource" nodes like below, but it then does
not return my custom mixin property values (I believe it gave me an error
when trying to retrieve the custom properties defined because it only
returned "nt:resource" node types).

	//element(*,nt:resource)[jcr:contains(jcr:content, 'testing') or

Then I created my own custom node type (hfs:file) which extends the
"nt:file" node type. Then when I queried on that node type it returns the
results correctly (meaning it searched both my custom property and the
binary file contents.

	//element(*,hfs:file)[jcr:contains(jcr:content, 'testing') or

Now what I need clarification on is what I am doing by defining my custom
node type the correct (i.e.. best practice) way to go about just adding
custom properties needed or should I be using a custom defined mixin?  And
If I should be using a mixin then which node does it go on? The "nt:file" or

Best Regards,

Michael Shoener
Support Staff
Software Application Services, Inc.

-----Original Message-----
From: Alexander Klimetschek [mailto:aklimets@day.com] 
Sent: Friday, October 09, 2009 3:53 AM
To: users@jackrabbit.apache.org
Subject: Re: Custom node or mixin added to existing node

On Thu, Oct 8, 2009 at 23:05, Michael Shoener <mshoener@softwareapps.net>
> In our application we want to allow users to create custom named 
> tag/value pairs that will get stored with the document in the 
> repository as properties.

Use nt:unstructured or have a custom node type / mixin with residual
property definitions (* - the heart of unstructuredness).

> I have tried using a mixin but when searching I have to search on my 
> mixin type not the nt:resource (which contains the binary data) 
> because the nt:resource does not contain my custom property values and 
> they don't get returned with the query. But when I do that I can't 
> query the binary content of the node because my query is searching 
> against my custom mixin type I created.

I don't understand? Why can't you search for the mixin + a jcr:contains
fulltext search?

> Do I need to define a custom node type that extends nt:resource and 
> allow arbitrary property value (if this is even possible).

Of course it is! See here http://jackrabbit.apache.org/node-types.html


Alexander Klimetschek

View raw message