You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@sling.apache.org by "Craig S. Dickson" <cr...@craigsdickson.com> on 2012/06/25 19:02:17 UTC
Querying non-JCR resources using ResourceResolver.findResources
Hi,
I have a custom ResourceProvider that is surfacing resources under a path like /data/external for example and it appears to be working as expected if I attempt to resolve a specific path like /data/external/users/1 for example.
However, I would now like to run queries for resources across the whole tree - in other words if I ran a query like "select * from nt:base where jcr:mimeType like 'image/%'" I would l like to have resources from the JCR repository that match returned AND resources from the external data source that match also returned.
I have been attempting this using the ResourceResolver.findResources method and passing in the query, but it appears to only return the JCR based resources, which seems to roughly concur with the JavaDoc for that method which states "For JCR repository being used as storage, the query and lanuage parameters are used to create a JCR Query through the QueryManager".
Am I doing something wrong? Or is this the expected behavior? If it is the expected behavior, is there an alternative approach?
Thanks in advance.
==========================
Craig S. Dickson
Independent Consultant
http://craigsdickson.com
http://www.linkedin.com/in/craigsdickson
Re: Querying non-JCR resources using ResourceResolver.findResources
Posted by Carsten Ziegeler <cz...@apache.org>.
Hi Craig,
with the released versions of Sling there is no search support for
resource providers other than the default jcr resource provider.
However, if you checkout latest trunk, there is a new interface
QueriableResourceProvider. Your custom resource provider should
implement this to support querying. If it does, you can use
ResourceResolver.findResources and it will combine the results from
all resource providers implementing this special interface.
Regards
Carsten
2012/6/25 Craig S. Dickson <cr...@craigsdickson.com>:
> Hi,
>
> I have a custom ResourceProvider that is surfacing resources under a path
> like /data/external for example and it appears to be working as expected if
> I attempt to resolve a specific path like /data/external/users/1 for
> example.
>
> However, I would now like to run queries for resources across the whole tree
> - in other words if I ran a query like "select * from nt:base
> where jcr:mimeType like 'image/%'" I would l like to have resources from the
> JCR repository that match returned AND resources from the external data
> source that match also returned.
>
> I have been attempting this using the ResourceResolver.findResources method
> and passing in the query, but it appears to only return the JCR based
> resources, which seems to roughly concur with the JavaDoc for that method
> which states "For JCR repository being used as storage, the query and
> lanuage parameters are used to create a JCR Query through the QueryManager".
>
> Am I doing something wrong? Or is this the expected behavior? If it is the
> expected behavior, is there an alternative approach?
>
> Thanks in advance.
>
> ==========================
> Craig S. Dickson
> Independent Consultant
> http://craigsdickson.com
> http://www.linkedin.com/in/craigsdickson
>
>
>
>
>
>
>
>
>
>
--
Carsten Ziegeler
cziegeler@apache.org