Hi,

with the current jackrabbit version you can only match the exact name of a node:

//*[fn:name() = 'foo' or fn:name() = 'bar']

however, JSR 283 defines a NodeLocalName operand that you can use in any comparison that takes a string operand. e.g. comparison using LIKE operator.

jackrabbit trunk partially implements those new features already. for example code see: http://svn.apache.org/repos/asf/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/qom/NodeLocalNameTest.java

regards
 marcel


Cédric Chantepie wrote:
I'm trying to be able to find node, with xpath (or SQL), whose node name contains searched expression.

For example, with following nodes :
/software/
/software/firefox
/software/sunbird
/software/thunderbird

... I'd like to be able to find sunbird and thunderbird with a xpath query like :
//*[jcr:contains(X, '*bird') ;

I've tried "fn:name()" as X but I get an InvalidQueryException ("Unsupported function", probably because of fn:name() nested in jcr:contains()),
I've tried "." as X but I doesn't find anything.

In fact it only work if I substitute X by a property name, but I don't know any implicit (auto-created or pseudo one) property contains node node (or node path).

So finally, is there any way to do such query with a standard jackrabbit configuration ? If not is there any "easy" way to define an auto-created property containing node name (so I can search for this property) ? or is there any way to add pseudo property to index by extending SearchIndex (I don't think so as it work on NodeState which doesn't have node name) ?

Thanks for any help,
Cédric



Reply via email to