[rules-users] Search a keyword in xml file content using jcr:contains() query in jackrabbit

Mohamed Riyaz riyazenayath at gmail.com
Sun Oct 12 06:09:59 EDT 2008


Hi,


In jackrabbit, How to search a keyword in a xml file using jcr:contains()
Xpath query without interfering xml node?

Eg: I have a content property in a blog entry node 'book'. content is
represented as xml file (<*j2ee*>Introduction to x design pattern</*j2ee*>).
If I search a word 'j2ee', its returning the node which is not currect
conceptually.

Please suggest me the possible approch either to use 'regular expression' or
alternative way to resolve this requirement.

//Keyword search

StringBuffer queryStr = *new* StringBuffer();

queryStr.append("//book[jcr:contains(@bookContent,'");

queryStr.append("j2ee");

//queryStr.append("j??e");

queryStr.append("')]");

Query query = queryManager.createQuery(queryStr.toString(), Query.*XPATH*);

QueryResult queryResult = query.execute();



Regards, Riyaz
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20081012/7a841690/attachment.html 


More information about the rules-users mailing list