you can use simple search tag.
http://nexus.magnolia-cms.com/content/sites/magnolia.public.sites/ref/4.4.2/magnolia-taglib-utility/tlddoc/index.html
the "simple" query it generates from the search words you pass in is
startPathToUse + "//*[@jcr:primaryType='mgnl:content']//*[jcr:contains(., '" +
escapedQuery + "')]";
HTH,
Jan
On Mar 2, 2011, at 3:16 PM, Hans Wichman wrote:
> Hi list,
>
> I need to search the repository for a simple value, and got this:
>
> HierarchyManager configManager =
> MgnlContext.getHierarchyManager(ContentRepository.CONFIG);
> QueryManager configQueryManager = configManager.getQueryManager();
> Query configQuery = configQueryManager.createQuery("//*[jcr:contains(.,
> '"+searchKey+"')]", "xpath");
> QueryResult configResult = configQuery.execute();
> Collection<Content> configResults = configResult.getContent("nt:base");
>
> Is there a less verbose way (beside wrapping it in a class myself)?
>
> regards
> Hans
>
>
> ----------------------------------------------------------------
> For list details see
> http://www.magnolia-cms.com/home/community/mailing-lists.html
> To unsubscribe, E-mail to: <[email protected]>
> ----------------------------------------------------------------
----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------