Hi David,

thanks a lot for your answer - it helped me a lot!

I now limit my search to paragraphs by querying the jcr:primaryType attribute like "/jcr:root/index/eventcalendar/eventCalendarItems//[EMAIL PROTECTED]:primaryType='mgnl:contentNode']"

But what really helped me get the desired results, is to also change the ItemType in the getContent() method of the QueryResult. The QueryResultImpl in my magnolia-version (2.1.5) uses by default the ItemType 'mgnl:content'. (parameter-less getContent()-method) So to get all the paragraph-nodes one has to write getContent("mgnl:contentNode") (of the QueryResult instance).

Also a hint, if anyone of you needs to filter dates in xpath:
Apply the xs:dateTime() function to a date-string in ISO-format.
This way attributes of type Date can easily be compared
(E.g. ... [xs:dateTime('2006-09-07T00:00:00.000Z') le @dateTo] ...)

Best regards,

Chris




Weird ... I'm reasonably sure mgnl:contentNode should be paragraphs; mgnl:content should be pages. Are you sure the query is really searching for mgnl:contentNode types? Also, what version of Magnolia are you working with?

--David

Christian P. Praher wrote:

Hi everybody,

how do I query paragraphs with the QueryManager and XPath?

I've already managed to query all the pages in my repository, but I can't query the paragraphs.

A query with the querystring "//element(*,mgnl:contentNode)" e.g. gives me all the pages in the website-repository. What I wan't to do is to query all the paragraphs that are in a certain page.

If I've a page like "/index/eventcalendar", I want to query all the paragraphs that are contained on this page, under the contentNodeCollectionName "eventCalendarItems". The handle of my paragraphs look like /index/eventcalendar/eventCalendarItems/00, /index/eventcalendar/eventCalendarItems/01.
What I want to query are the paragraphs 00, 01, and so forth.

I've tried things like "/jcr:root/index/eventcalendar/eventCalendarItems//element(*,mgnl:contentNode)" to get all the pargraph nodes on the page /index/eventcalendar under the contentNodeCollectionName "eventCalendarItems", but this won't yield any results. I've also tried all kinds of ItemTypes (mgnl:node, mgnl:nodeData, etc.) without success.

I'd need this feature to filter the paragraphs in an event calendar.

Any help is appreciated!

Chris


----------------------------------------------------------------
for list details see
http://documentation.magnolia.info/docs/en/editor/stayupdated.html
----------------------------------------------------------------

Reply via email to