Thank you! searching on jcr:content only worked! interestingly,
//*[jcr:primaryType = 'prm:File'] seems to do what //[EMAIL PROTECTED]:primaryType = 'prm:File'] does. But i added the @ as, as you point out, that is the correct thing to do. Thanks again. dave -----Original Message----- From: Marcel Reutegger <[EMAIL PROTECTED]> Sent: Tuesday, March 18, 2008 11:46am To: [email protected] 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: http://jackrabbit.apache.org/frequently-asked-questions.html > 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); testRootNode.save(); String stmt = "//[EMAIL PROTECTED]:primaryType = 'nt:file' and jcr:content/@jcr:data]"; QueryResult result = executeQuery(stmt); for (NodeIterator it = result.getNodes(); it.hasNext(); ) { System.out.println(it.nextNode().getPath()); } 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? regards marcel
