[
https://issues.apache.org/jira/browse/SLING-307?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Philipp Koch updated SLING-307:
-------------------------------
Attachment: queryservlet.patch
> QueryServlet
> ------------
>
> Key: SLING-307
> URL: https://issues.apache.org/jira/browse/SLING-307
> Project: Sling
> Issue Type: New Feature
> Components: Default Servlets
> Reporter: Philipp Koch
> Attachments: queryservlet.patch
>
>
> it would be nice to have a way to specify a jcr query in the url in order to
> query the underlying jcr repository.
> the attached patch works as follows:
> The new query servlet is called if the extension is ".json" and the selector
> is set to "query". you can pass following parameters in the url:
> statement: jcr query statement (XPATH or SQL)
> queryType: xpath or sql (of none is specified xpath is taken)
> property: specifies which property (relative path) has to be "put" into the
> result set (this parameter can be added multiple times)
> excerptPath: specifies the relative node path from where the excerpt has to
> be built.
> the result is returned as json string. e.g.:
> [
> {"name":"ee0","rep:excerpt()":"<excerpt><fragment>geometrixx/components/contentpage
> ...
> ee<\/fragment><\/excerpt>","jcr:path":"/content/ee0","jcr:score":"528","cq:content/jcr:title":"ee"},
> {"name":"news","rep:excerpt()":"<excerpt><fragment> ...
> geometrixx/components/contentpage ... ... ... ... news about
> geometrix<\/fragment><\/excerpt>","jcr:path":"/content/geometrixx/en/about/news","jcr:score":"521","cq:content/jcr:title":"News"}
> ]
> example query call:
> http://localhost:8080/sling/myhome.query.json?statement=//element(*,cq:Page)[jcr:contains(.,'sling')]/(rep:excerpt(.))&property=cq:content/jcr:title&excerptPath=cq:content
>
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.