Hi Marcel, >I'm also a bit confused whether you are finally interested in documents or >categories. The SQL query you posted earlier indicates that you are >interested in documents, but the above XPath query indicates that you are >interested in the referenced category text.
Yes I am (ultimately) interested in the referenced Category text. The query in previous post is a test to achieve my goal described here. Let me make it in plain language... All my:document nodes refer to MULTIPLE "category nodes" - say Country, Size, and ColorScheme. Each of them has multiple category-entries. Say category "Country" has entries "US, Canada, Mexico, Argentina, Brazil"; Category "Size" has entries "Small, Medium, Large"; And Category "ColorScheme" has entries "Red, Green, Yellow, Pink, Black". For any my:document node, - it points to ONE or more entries of Country - it points to zero or more entries of Size - it points to zero or more entries of ColorScheme - it has other text/date properties An example of my query scenario would be: For my:document nodes that meet the following query conditions: 1) refer to countries US, or Canada, or Mexico and, 2) refer to sizes Small or Medium, and 3) refer to colors Red or Yellow, and 4) document content contains arbitrary user entered text 5) ... other property based query parameters Return the country names referred by above document result (in a unique list), and count the number of documents under each returned country name. An example of expected result set may be: US, 19 Canada, 4 You may have noticed that in query condition 1), users are allowed to specify target countries, but the result may not have all country names as specified (Mexico here), because other document filtering parameters may prevent any "Mexico"-referring document from showing in the result. I hope this makes things clear for you. My perception is that I can't achieve the result with One query because there no "Select distinct" and "inner join" equivalent in JCR/Jackrabbit. Would you have any suggestion/comment on the approach? Regards, Dan
