jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sushil Vegad <vsus...@serebrum.com>
Subject Re: Create search index for a node and its subtree
Date Mon, 31 Mar 2008 18:01:50 GMT

Thanks for your reply. If I can restrict search results using path
expression, I dont need separate indexes. In our application, these top
level folders are accessed by users via permissions, so we were thinkng
separate indexes.

> /jcr-root/Folder-1//element(*,nt:base)[jcr:contains(.,'test')] which will
> return only matches in Folder-1

I tried the query you suggested, it didnt work. It would not return any
result - is it because of the structure we are using? In my example below
all folders (and child folders) are of the type 'nt:MyFolder' that extends
nt:folder. All files under such folders are of type 'nt:MyFile' that extends
nt:file. I tried the query

/jcr-root/Folder-1//element(*,nt:file)[jcr:contains(jcr:content, '" +
searchStr + "')]/rep:excerpt(.)
It returns no results. 

This one does:
//element(*,nt:file)[jcr:contains(jcr:content, '" + searchStr +

Any thoughts please?


Alessandro Bologna wrote:
> Sushil,
> from your message seems like you are just asking how to do queries by
> path,
> which is something that JCR supports very well (both XPATH and SQL
> syntax):
> say that your search expression is:
> //element(*,nt:base)[jcr:contains(.,'test')]
> then your search restricted to one of the paths below is:
> /jcr-root/Folder-1//element(*,nt:base)[jcr:contains(.,'test')] which will
> return only matches in Folder-1
> Alessandro
> On Fri, Mar 28, 2008 at 4:41 PM, Sushil Vegad <vsushil@serebrum.com>
> wrote:
>> Hello,
>> Am a newbie to jackrabbit.
>> Within a workspace, is it is possible to have a search index for a
>> selected
>> folder/node and its entire sub-tree?  For example, the tree structure has
>> the workspace node at the top
>> Workspace
>> Folder-1 (Child-1.1, Child-1.2, Child-1.3 etc)
>> Folder-2 (Child-2.1, Child-2.2, Child-2.3 etc)
>> Folder-3
>> etc
>> We need a separate index for Folder-1 (and sub tree), lets say index-1.
>> When
>> index-1 is searched, it only searches folder-1 and its children. Likewise
>> for Folder-2 (and sub tree), etc. The top level folders on which the
>> index
>> needs to be defined will always be directly under the workspace. They
>> will
>> never be nested
>> Thanks,
>> Sushil
>> --
>> View this message in context:
>> http://www.nabble.com/Create-search-index-for-a-node-and-its-subtree-tp16361535p16361535.html
>> Sent from the Jackrabbit - Users mailing list archive at Nabble.com.

View this message in context: http://www.nabble.com/Create-search-index-for-a-node-and-its-subtree-tp16361535p16397794.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.

View raw message