You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Michael Shoener <ms...@softwareapps.net> on 2009/09/24 18:39:35 UTC

Search file content but not all node properties

I have the following query:

//element(*, hfs:fileInfo)[jcr:contains(., 'search term') or
jcr:contains(@hfs:description, 'search term')]/(@hfs:description)

It returns all documents that have the 'search term' contained in either a
the description property, the content of the file, but it also searches all
other property values.

What I want is to search only the content and my specified property
(description), but leave out documents that happen to have the 'search term'
in another property.

It this possible?


Best Regards,

Michael Shoener
Support Staff
Software Application Services, Inc.



Re: Search file content but not all node properties

Posted by Alexander Klimetschek <ak...@day.com>.
On Thu, Sep 24, 2009 at 18:39, Michael Shoener
<ms...@softwareapps.net> wrote:
> I have the following query:
>
> //element(*, hfs:fileInfo)[jcr:contains(., 'search term') or
> jcr:contains(@hfs:description, 'search term')]/(@hfs:description)
>
> It returns all documents that have the 'search term' contained in either a
> the description property, the content of the file, but it also searches all
> other property values.
>
> What I want is to search only the content and my specified property
> (description), but leave out documents that happen to have the 'search term'
> in another property.

What do you mean by content? I guess not the "." in jcr:contains(.,
'search term') as this covers the whole node (and whatever the
indexing considered as full text for the whole node.

If you want the content of the binary stream and your node is like
nt:file/nt:resource, I suggest to use jcr:contains(jcr:data, 'search
term') as that property contains the binary data in case of a
nt:resource.

Regards,
Alex

-- 
Alexander Klimetschek
alexander.klimetschek@day.com