HST query to search recursively

Hi everyone

I was wondering if I could do a recursive query search using a hippoquery.
Given a parent folder path, I want to find a list of documents whose names contain a search pattern.
I did something like this:

HstQuery hstQuery = hstQueryManager.createQuery(parentNode,CUSTOM_DOC_TYPE);
Filter filter = hstQuery.createFilter();
filter.addContains(“file:Name”, name);
hstQuery.setFilter(filter);
HstQueryResult result = hstQuery.execute();

But i suppose it only looks for files under the path and does not do a recursive search. Is there an option I can configure in my query to do the same ?

Many Thanks
Kiki

Hi folks,

Please could someone help with this . ? thank you very much

Hi,
I don’t think you need to search recursively. Your filter will be applied to all the child nodes below the parentNode, with type CUSTOM_DOC_TYPE.

Please also consider that HST queries are pretty much an abstraction on top of JCR queries, so the same logic applies.

HTH,
Giacomo

Thank you I was able write a XPath query

Hi Kiki,

I think your query will search all the descendant documents of CUSTOM_DOC_TYPE type under the parentNode. The parentNode argument is for “scope”, which means including all the descendants in the scope.

Regards,

Woonsan

Thank you very much for helping me out.