You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by Eugeny N Dzhurinsky <eu...@jdevelop.com> on 2005/10/13 13:08:12 UTC

search

Could somebody please explain how to use search within jackrabbit repository 
to find some set of nodes?

-- 
Eugene N Dzhurinsky

Re: search

Posted by Marcel Reutegger <ma...@gmail.com>.
Jackrabbit search works as specified by the spec. See section 6.6.

Or is there anything in particular you are interested in?

regards
  marcel

Eugeny N Dzhurinsky wrote:
> Could somebody please explain how to use search within jackrabbit repository 
> to find some set of nodes?
> 

Re: search

Posted by Eugeny N Dzhurinsky <eu...@jdevelop.com>.
On Thu, Oct 13, 2005 at 01:47:32PM +0200, David Nuescheler wrote:
> > ok, but what if i need to find some node by the part of it's name?
> > The query  //*[starts-with(name(),'node4')]
> > complains about starts-with function, which is not implemented. As I can see
> > from the documentation (JSR 170) there're no starts-with and name functions..
> because of limitations of existing commercial repositories complex
> path operations have been excluded from the spec. i would advise to search
> or filter based on properties instead. this seems to be something
> that may be more portable amongst repositories, even if we would (and i am
> not saying we should) implement something like a start-with
> method in jackrabbit.

Well, okay, but even if I will have some property to search for, will I be
able to use contains() function in similar way as starts-with?

> ... and to be totally honest, i would really be interested in the use case that
> you are operating on. why would someone look for a node name starting
> with 'node4' ??

Well, I'm just testing the JackRabbit's performance, i'd like to know the
speed I could archieve if I need to search for something.

-- 
Eugene N Dzhurinsky

Re: search

Posted by David Nuescheler <da...@gmail.com>.
> ok, but what if i need to find some node by the part of it's name?
> The query  //*[starts-with(name(),'node4')]
> complains about starts-with function, which is not implemented. As I can see
> from the documentation (JSR 170) there're no starts-with and name functions..

because of limitations of existing commercial repositories complex
path operations have been excluded from the spec. i would advise to search
or filter based on properties instead. this seems to be something
that may be more portable amongst repositories, even if we would (and i am
not saying we should) implement something like a start-with
method in jackrabbit.

... and to be totally honest, i would really be interested in the use case that
you are operating on. why would someone look for a node name starting
with 'node4' ??

regards,
david

Re: search

Posted by Eugeny N Dzhurinsky <eu...@jdevelop.com>.
On Thu, Oct 13, 2005 at 01:26:07PM +0200, Christophe Lombart wrote:
> It depends on what you are looking for.
> Maybe the unit tests can help : see on
> jackrabbit/src/test/org/apache/jackrabbit/test/api/query
> I advise you to read the JCR spec. There are many information on
> searching support.
> 
> Here is a code example :
>                         jcrExpression = "/jcr:root/test//element(*,
> graffito:paragraph) [jcr:contains(@graffito:text, 'Graffito')]";

ok, but what if i need to find some node by the part of it's name?
The query  //*[starts-with(name(),'node4')]
complains about starts-with function, which is not implemented. As I can see
from the documentation (JSR 170) there're no starts-with and name functions..

-- 
Eugene N Dzhurinsky

Re: search

Posted by Christophe Lombart <ch...@gmail.com>.
It depends on what you are looking for.
Maybe the unit tests can help : see on
jackrabbit/src/test/org/apache/jackrabbit/test/api/query
I advise you to read the JCR spec. There are many information on
searching support.

Here is a code example :
                        jcrExpression = "/jcr:root/test//element(*,
graffito:paragraph) [jcr:contains(@graffito:text, 'Graffito')]";
			javax.jcr.query.Query jcrQuery =
session.getWorkspace().getQueryManager().createQuery(jcrExpression,
javax.jcr.query.Query.XPATH);

			QueryResult queryResult = jcrQuery.execute();

			NodeIterator nodeIterator = queryResult.getNodes();



			ArrayList result = new ArrayList();

			while (nodeIterator.hasNext())

			{

				Node node = nodeIterator.nextNode();

				log.debug("Node found : " + node.getPath());

				result.add(objectConverter.getObject(session,
query.getFilter().getFilterClass(), node.getPath()));

			}

Christophe


On 10/13/05, Eugeny N Dzhurinsky <eu...@jdevelop.com> wrote:
> Could somebody please explain how to use search within jackrabbit repository
> to find some set of nodes?
>
> --
> Eugene N Dzhurinsky
>