Never mind about my mail below: I did not see Christoph Kiehl's mail who clearly did an indept explanation, and about the special Jackrabbit feature child axis expression I was not aware of.
So discard my incorrect mail please :-) Ard > > > I am not totally sure, but if I look at the queries again: > > query 1: > //element(*,cwe:file)[jcr:contains(jcr:content/@jcr:mimeType, > 'application/msword')]/rep:excerpt() order by @jcr:score desc > > query 2: > //element(*,cwe:file)[jcr:contains(cwe:comment/@cwe:body, > 'banana')]/rep:excerpt() order by @jcr:score desc > > isn't the @jcr:mimeType perhaps a property of cwe:file > instead of jcr:content (or does cwe:file also has this > @jcr:mimeType)? Then, it might be, that > > > //element(*,cwe:file)[jcr:contains(jcr:content/@jcr:mimeType, > 'application/msword')]/rep:excerpt() order by @jcr:score desc > > is translated into (just guessing, and it might be different, > but probably the behavior is not specified since the query is > not valid) > > //element(*,cwe:file)[jcr:contains(@jcr:mimeType, > 'application/msword')]/rep:excerpt() order by @jcr:score desc > > or > > //element(*,cwe:file)[jcr:contains(., > 'application/msword')]/rep:excerpt() order by @jcr:score desc > > returning a hit....but anyway, your query isn't backed by the > specification, so it doesn't really matter that you get > strange results, because the queries aren't allowed in the > first place. If you really need to know why you get the hit, > I think you should find out which lucene query is executed, > and look for example with luke at the lucene index what is > actually in there > > Regards Ard > > > > > > > Yeah I saw that also, However, if you look at Query 1 in my > > first post, that > > query returns a cwe:file node and searches on the > > jcr:content/@jcr:mimeType > > child property and returns the correct results. How is that > > working, but my > > other query is not? Seems like you are able to query on a > child node > > property. Again, the only difference i see is that > > jcr:content is a direct > > child property and cwe:comment is a child node. Not sure if > > that makes a > > difference, but it looks like it is. > > > > > > > > Ard Schrijvers wrote: > > > > > > > > >> > > >> > > >> Yes, your first query returns the correct results, and the > > >> second returns > > >> nothing? However, I'm not sure what that tells me. It seems > > >> like i can't > > >> reference a node property for that nodetype. Any ideas? > > > > > > According 6.6.5.2 jsr 170 specification you can either use > > "." (this node) > > > or a property (@my:property). So apparently, your second > > query is not > > > valid according specification. > > > > > > //element(*,cwe:comment)[jcr:contains(@cwe:body,'banana')] > > should work > > > again, > > > > > > Regards Ard > > > > > >> > > >> > > >> > > >> Ard Schrijvers wrote: > > >> > > > >> > Ah, ofcourse, you said query 2 isn't working :-) > > >> > > > >> > But what happens when you simplify the query, for example by > > >> > > > >> > query 2: > > >> > //*[jcr:contains(@cwe:body,'banana')] > > >> > > > >> > does this return results? > > >> > > > >> > if so, does > > >> > > > >> > //*[jcr:contains(cwe:comment/@cwe:body,'banana')] > > >> > > > >> > Perhaps if for example the first gives you a hit and the > > >> second not, it > > >> > helps you find the problem > > >> > > > >> > Regards Ard > > >> > > > >> >> > > >> >> > > >> >> Yes, I have checked to make sure the values are there. Query > > >> >> 1 is actually > > >> >> working fine. It is Query 2 that is having an issue. The > > >> >> only difference i > > >> >> can see is that jcr:content is a property of cwe:file of type > > >> >> nt:resource > > >> >> and cwe:comment is a child node of cwe:file. Should that > > >> >> affect anything? > > >> >> > > >> >> > > >> >> > > >> >> Ard Schrijvers wrote: > > >> >> > > > >> >> > Hello, > > >> >> > > > >> >> > > > >> >> >> query 1: > > >> >> >> > //element(*,cwe:file)[jcr:contains(jcr:content/@jcr:mimeType, > > >> >> >> 'application/msword')]/rep:excerpt() order by > @jcr:score desc > > >> >> > > > >> >> > You can try first to debug a little: > > >> >> > > > >> >> > does //*[jcr:contains(@jcr:mimeType, 'application/msword')] > > >> >> for example > > >> >> > returns a result? If not, you might know better where to > > >> >> look (do you > > >> >> > actually have a property mimeType to begin with...you might > > >> >> take a look > > >> >> > with Luke at your lucene index). Futhermore, > > >> >> > > > >> >> > //[EMAIL PROTECTED]:mimeType='application/msword'] makes IMO more > > >> >> sense (though 99% > > >> >> > of the time it will return the same result (depending on > > >> >> your analyzer > > >> >> > used)) > > >> >> > > > >> >> > Regards Ard > > >> >> > > > >> >> > > > >> >> > > > >> >> > > > >> >> > > >> >> -- > > >> >> View this message in context: > > >> > > > > > http://www.nabble.com/query-for-child-property-tf4262707.html# a12145049 >> Sent from the Jackrabbit - Users mailing list archive at Nabble.com. >> >> >> > > -- > View this message in context: > http://www.nabble.com/query-for-child-property-tf4262707.html#a12147456 > Sent from the Jackrabbit - Users mailing list archive at Nabble.com. > > > -- View this message in context: http://www.nabble.com/query-for-child-property-tf4262707.html#a12150522 Sent from the Jackrabbit - Users mailing list archive at Nabble.com.
