You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Marcel Reutegger <ma...@gmx.net> on 2009/10/01 11:16:56 UTC

Re: Query mixin and nt:resource nodes

Hi,

On Mon, Sep 28, 2009 at 23:54, Michael Shoener
<ms...@softwareapps.net> wrote:
> I tried your suggestion to use @jcr:data and still get nothing.

see: http://jackrabbit.apache.org/frequently-asked-questions.html

"Why doesn't //*[jcr:contains(@jcr:data, 'foo')] return matches for
binary content?"

> What exactly does the "." in the jcr:contains search in relation to the
> node?

it means that the XPath context node is searched using the
jcr:contains() function. In jackrabbit jcr:contains will search all
properties on that node unless otherwise configured in the indexing
configuration.

see: http://wiki.apache.org/jackrabbit/IndexingConfiguration

> Any other suggestions?

you could separate the resource from the file. e.g. have the
description property on a node that is distinct from the node where
you have the jcr:data on.

using built in node types that would be:

//element(*, nt:file)[jcr:contains(jcr:content, 'example')]

or if you also want to search on description:

//element(*, nt:file)[jcr:contains(@description, 'example' or
jcr:contains(jcr:content, 'example')]

(assuming you have a custom node type that extends from nt:file and
allows you to set @description)

regards
 marcel

Re: Query mixin and nt:resource nodes

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

On Thu, Oct 1, 2009 at 15:08, Michael Shoener <ms...@softwareapps.net> wrote:
> Should I be adding the mixin to the parent nt:file node?

if you need to do fulltext searches only on the file content
(excluding the description) this is a good option.

> If so, then what
> node type do I search on in my query?

you search for nt:file.

> I have a custom mixin defined called "hfs:fileInfo". Is has several
> properties (description, entered, modified).

btw, what's the use of entered and modified? aren't those already
covered with the predefined properties jcr:created (on nt:file) and
jcr:lastModified (on nt:resource) ?

> What would the query look like to search on both the binary file data and my
> custom mixin properties?

see examples in my previous post.

regards
 marcel

RE: Query mixin and nt:resource nodes

Posted by Michael Shoener <ms...@softwareapps.net>.
I haven't touched any of the indexing configuration settings and from what I
have seen the default is to index the basic file types I am storing in the
repository.

What I am trying to do is have my query search on both the binary file data
and my custom mixin which is added to the nt:resource node.

Should I be adding the mixin to the parent nt:file node? If so, then what
node type do I search on in my query?

I have a custom mixin defined called "hfs:fileInfo". Is has several
properties (description, entered, modified).

What would the query look like to search on both the binary file data and my
custom mixin properties?


Best Regards,

Michael Shoener
Support Staff
Software Application Services, Inc.


-----Original Message-----
From: mreutegg@day.com [mailto:mreutegg@day.com] On Behalf Of Marcel
Reutegger
Sent: Thursday, October 01, 2009 5:17 AM
To: users@jackrabbit.apache.org
Subject: Re: Query mixin and nt:resource nodes

Hi,

On Mon, Sep 28, 2009 at 23:54, Michael Shoener <ms...@softwareapps.net>
wrote:
> I tried your suggestion to use @jcr:data and still get nothing.

see: http://jackrabbit.apache.org/frequently-asked-questions.html

"Why doesn't //*[jcr:contains(@jcr:data, 'foo')] return matches for binary
content?"

> What exactly does the "." in the jcr:contains search in relation to 
> the node?

it means that the XPath context node is searched using the
jcr:contains() function. In jackrabbit jcr:contains will search all
properties on that node unless otherwise configured in the indexing
configuration.

see: http://wiki.apache.org/jackrabbit/IndexingConfiguration

> Any other suggestions?

you could separate the resource from the file. e.g. have the description
property on a node that is distinct from the node where you have the
jcr:data on.

using built in node types that would be:

//element(*, nt:file)[jcr:contains(jcr:content, 'example')]

or if you also want to search on description:

//element(*, nt:file)[jcr:contains(@description, 'example' or
jcr:contains(jcr:content, 'example')]

(assuming you have a custom node type that extends from nt:file and allows
you to set @description)

regards
 marcel