jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dave Brosius" <dbros...@mebigfatguy.com>
Subject Re: Struggling with search
Date Tue, 18 Mar 2008 17:59:15 GMT
Thank you! searching on jcr:content only worked!


//*[jcr:primaryType = 'prm:File'] seems to do what
//*[@jcr:primaryType = 'prm:File'] does.

But i added the @ as, as you point out, that is the correct thing to do.

Thanks again.

-----Original Message-----
From: Marcel Reutegger <marcel.reutegger@gmx.net>
Sent: Tuesday, March 18, 2008 11:46am
To: users@jackrabbit.apache.org
Subject: Re: Struggling with search

Dave Brosius wrote:
> My next problem is this. I have this query:
> //*[jcr:primaryType = 'prm:File' and jcr:contains(jcr:content/@jcr:data, 'sample')] order
by jcr:score() descending

see query section in jackrabbit faq: 

> Then i change it to
> //*[jcr:primaryType = 'prm:File' and jcr:content/@jcr:data] order by jcr:score() descending
> and again i get nothing, which seems completely wrong.

I quickly created a test, which works for me:

         Node file = testRootNode.addNode("test.txt", "nt:file");
         Node resource = file.addNode("jcr:content", "nt:resource");
         resource.setProperty("jcr:lastModified", Calendar.getInstance());
         resource.setProperty("jcr:mimeType", "text/plain");
         resource.setProperty("jcr:encoding", "UTF-8");
         resource.setProperty("jcr:data", "hello world", PropertyType.BINARY);
         String stmt = "//*[@jcr:primaryType = 'nt:file' and 
         QueryResult result = executeQuery(stmt);
         for (NodeIterator it = result.getNodes(); it.hasNext(); ) {

this returns the previously created file.

please note the @ in @jcr:primaryType.

can you please provide some code that illustrates what you are trying to do?


View raw message