You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Sushil Vegad <vs...@serebrum.com> on 2008/03/28 21:41:17 UTC
Create search index for a node and its subtree
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.
Re: Create search index for a node and its subtree
Posted by Marcel Reutegger <ma...@gmx.net>.
Hi,
this is not possible. why do think you need separate indexes?
regards
marcel
Sushil Vegad 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
>
Re: Create search index for a node and its subtree
Posted by Alessandro Bologna <al...@gmail.com>.
sorry, I made a typo.. it's jcr:root, not jcr-root. And you can even just
try //Folder-1//element(*,nt:file) etc etc..
Alessandro
On Mon, Mar 31, 2008 at 2:01 PM, Sushil Vegad <vs...@serebrum.com> wrote:
>
> Alessandro,
> 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 +
> "')]/rep:excerpt(.)
>
> Any thoughts please?
>
> Thanks,
> Sushil
>
>
> 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 <vs...@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.
>
>
Re: Create search index for a node and its subtree
Posted by Sushil Vegad <vs...@serebrum.com>.
Alessandro,
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 +
"')]/rep:excerpt(.)
Any thoughts please?
Thanks,
Sushil
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 <vs...@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.
Re: Create search index for a node and its subtree
Posted by Alessandro Bologna <al...@gmail.com>.
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 <vs...@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.
>
>