You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by hsp_ <pi...@ibest.com.br> on 2008/07/15 14:47:53 UTC
Search question, with jcr:path.
Hi;
I have a need to search node in a level that not match some names.
Take the following tree:
A
A/B
A/B/D
A/C
A/C/E
So, I want to retrieve the nodes only under A, that have the names (or path)
not equal to B (node A/C would be the result in this case).
I tried some searches with xpath and sql, but without sucess.
Well, in the url
http://people.apache.org/~mreutegg/jcr-query-translator/translator.html, I
post the following xpath:
/jcr:root/A/element(*,my:type)[(@jcr:path!='/A/B')]
and in SQL Query box appears:
SELECT * FROM my:type WHERE jcr:path <> '/A/B' AND jcr:path LIKE '/A[%]/%'
AND NOT jcr:path LIKE '/A[%]/%/%'
and in JCR Query tree box appears:
+ Root node
+ Select properties: *
+ PathQueryNode
+ LocationStepQueryNode: NodeTest={} Descendants=false Index=NONE
+ LocationStepQueryNode: NodeTest={}Documentador Descendants=false
Index=NONE
+ LocationStepQueryNode: NodeTest={}Acervo Descendants=false Index=NONE
+ LocationStepQueryNode: NodeTest=* Descendants=false Index=NONE
+ NodeTypeQueryNode: Prop={http://www.jcp.org/jcr/1.0}primaryType
Value={my}type
+ RelationQueryNode: Op: <> Prop=@{http://www.jcp.org/jcr/1.0}path
Type=STRING Value=/A/B
I did the search in jackrabbit with xpath and nor result nor exception
returned.
I did the search in jackrabbit with sql and get the exception:
"javax.jcr.query.InvalidQueryException: Invalid combination of jcr:path
clauses"
How can I do the filter in query to get directly the nodes without handle
after in my code?
I also tried using fn:name but it only works with "=" predicates.
Thanks
Helio.
--
View this message in context: http://www.nabble.com/Search-question%2C-with-jcr%3Apath.-tp18464397p18464397.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.
Re: Search question, with jcr:path.
Posted by Marcel Reutegger <ma...@gmx.net>.
Hi,
hsp_ wrote:
> Hi;
> I have a need to search node in a level that not match some names.
> Take the following tree:
>
> A
> A/B
> A/B/D
> A/C
> A/C/E
>
>
> So, I want to retrieve the nodes only under A, that have the names (or path)
> not equal to B (node A/C would be the result in this case).
>
> I tried some searches with xpath and sql, but without sucess.
>
> Well, in the url
> http://people.apache.org/~mreutegg/jcr-query-translator/translator.html, I
> post the following xpath:
> /jcr:root/A/element(*,my:type)[(@jcr:path!='/A/B')]
jcr:path is a pseudo property that you can only use with SQL.
> and in SQL Query box appears:
> SELECT * FROM my:type WHERE jcr:path <> '/A/B' AND jcr:path LIKE '/A[%]/%'
> AND NOT jcr:path LIKE '/A[%]/%/%'
>
> and in JCR Query tree box appears:
> + Root node
> + Select properties: *
> + PathQueryNode
> + LocationStepQueryNode: NodeTest={} Descendants=false Index=NONE
> + LocationStepQueryNode: NodeTest={}Documentador Descendants=false
> Index=NONE
> + LocationStepQueryNode: NodeTest={}Acervo Descendants=false Index=NONE
> + LocationStepQueryNode: NodeTest=* Descendants=false Index=NONE
> + NodeTypeQueryNode: Prop={http://www.jcp.org/jcr/1.0}primaryType
> Value={my}type
> + RelationQueryNode: Op: <> Prop=@{http://www.jcp.org/jcr/1.0}path
> Type=STRING Value=/A/B
>
> I did the search in jackrabbit with xpath and nor result nor exception
> returned.
that's because there is no property called jcr:path.
> I did the search in jackrabbit with sql and get the exception:
> "javax.jcr.query.InvalidQueryException: Invalid combination of jcr:path
> clauses"
SQL only supports a certain combinations of jcr:path matches. see the jsr 170
specification for details.
> How can I do the filter in query to get directly the nodes without handle
> after in my code?
> I also tried using fn:name but it only works with "=" predicates.
the equals operator is currently the only one supported with fn:name. please
file an enhancement request for other operators that you would like to have
implemented. thanks.
regards
marcel