You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Paco Avila <pa...@git.es> on 2007/02/16 11:40:03 UTC

Why these two queries don't return the same?

I think this two queries are "equivalents" because both search in the
node content, but the results are differents:

	//element(*,okm:document)/@jcr:path[jcr:contains(okm:content,'apache')]
order by @jcr:score descending

	//element(*,okm:resource)/@jcr:path[jcr:contains(.,'apache')] order by
@jcr:score descending

This is my node definitions:

[okm:resource] > nt:resource, mix:versionable
- okm:size (long) mandatory
- okm:author (string) mandatory

[okm:document] > nt:hierarchyNode, mix:referenceable, mix:lockable,
mix:accessControlled
- okm:author (string) mandatory
- okm:name (string)
- okm:language (string)
- okm:keywords (string)
- okm:notification (string) multiple
+ okm:content (okm:resource) primary mandatory

-- 
GIT Consultors S.L.
c\ Francesc Rover 2-B
07003 Palma de Mallorca
(Illes Balears)


Re: Why these two queries don't return the same?

Posted by Marcel Reutegger <ma...@gmx.net>.
Paco Avila wrote:
> Marcel Reutegger escribió:
>> But even then, the nodes in the query result will be different because of the 
>> element() node test. the first query will return okm:document nodes, whereas the 
>> second query will return okm:resource nodes.
> 
> More or less, but every okm:document have a okm:content subnode. Both
> queries return the same number of nodes, but I think that the ordering
> should be equal because both check the same content node.

I agree. Are you able to reproduce this behaviour with nt:file and nt:resource 
nodes? If yes, could you please create a jira issue and attach a test case?

Thank you.

regards
  marcel

Re: Why these two queries don't return the same?

Posted by Paco Avila <pa...@git.es>.
El vie, 16-02-2007 a las 14:38 +0100, Marcel Reutegger escribió:
> Paco Avila wrote:
> > I think this two queries are "equivalents" because both search in the
> > node content, but the results are differents:
> > 
> > 	//element(*,okm:document)/@jcr:path[jcr:contains(okm:content,'apache')]
> > order by @jcr:score descending
> > 
> > 	//element(*,okm:resource)/@jcr:path[jcr:contains(.,'apache')] order by
> > @jcr:score descending
> 
> The queries actually look malformed. Shouldn't it read:
> 
> //element(*,okm:document)[jcr:contains(okm:content,'apache')]
>   order by @jcr:score descending
> 
> and
> 
> //element(*,okm:resource)[jcr:contains(.,'apache')]
>   order by @jcr:score descending

No, the queries are ok: i want to get only the jcr:path property. And
they work fine.

> But even then, the nodes in the query result will be different because of the 
> element() node test. the first query will return okm:document nodes, whereas the 
> second query will return okm:resource nodes.

More or less, but every okm:document have a okm:content subnode. Both
queries return the same number of nodes, but I think that the ordering
should be equal because both check the same content node.

-- 
GIT Consultors S.L.
c\ Francesc Rover 2-B
07003 Palma de Mallorca
(Illes Balears)


Re: Why these two queries don't return the same?

Posted by Marcel Reutegger <ma...@gmx.net>.
Paco Avila wrote:
> I think this two queries are "equivalents" because both search in the
> node content, but the results are differents:
> 
> 	//element(*,okm:document)/@jcr:path[jcr:contains(okm:content,'apache')]
> order by @jcr:score descending
> 
> 	//element(*,okm:resource)/@jcr:path[jcr:contains(.,'apache')] order by
> @jcr:score descending

The queries actually look malformed. Shouldn't it read:

//element(*,okm:document)[jcr:contains(okm:content,'apache')]
  order by @jcr:score descending

and

//element(*,okm:resource)[jcr:contains(.,'apache')]
  order by @jcr:score descending

?

But even then, the nodes in the query result will be different because of the 
element() node test. the first query will return okm:document nodes, whereas the 
second query will return okm:resource nodes.

regards
  marcel