Hi, Am Mittwoch, den 05.12.2007, 18:28 +0100 schrieb Bertrand Delacretaz: > On Dec 5, 2007 2:55 PM, Christophe Lombart <[EMAIL PROTECTED]> wrote: > > > ...I'm wondering what is the best way to search resources with Sling (mainly > > with MicroSling in the first time).... > > > ...Do I have to make a specific servlet and map it to a resource called > > "/search" (which is not in the repo of course) ?... > > The easiest way is probably to create this /search node, and set its > sling:resourceType to point to a specific script (or servlet). > > Then, in the script, use > node.getSession().getWorkspace().getQueryManager() to create your > query, run it (based on request parameters) and get a NodeIterator.
Well, it is even simpler: use the findResources or queryResources method of the ResourceResolver to place your queries. You get back Resources for findResources and results as maps for queryResources. I think, this is easier to use than going through the node and QueryManager ... Regards Felix
