Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

How to get instance of com.day.cq.search.Trends when using QueryBuilder

Avatar

Level 3

We have been using first com.day.cq.wcm.foundation.Search and then com.day.cq.search.SimpleSearch to do our sitewide searching. We're moving to using QueryBuilder now as neither of the other search classes provides the flexibility we need. My question is how do I get to the Trends object that is returned by Search and SimpleSearch? I can't find anything in the documentation that tells me how I can get an instance of that class.

1 Accepted Solution

Avatar

Correct answer by
Level 10

WHen using the QUeryBuilder API -a Trends instance is not returned.

QUeryBuilder API returns the result set in an instance of:

com.day.cq.search.result.SearchResult

See this community article to learn how to work with QueryBuilder API and how to get your result set:

https://helpx.adobe.com/experience-manager/using/using-query-builder-api1.html

View solution in original post

4 Replies

Avatar

Correct answer by
Level 10

WHen using the QUeryBuilder API -a Trends instance is not returned.

QUeryBuilder API returns the result set in an instance of:

com.day.cq.search.result.SearchResult

See this community article to learn how to work with QueryBuilder API and how to get your result set:

https://helpx.adobe.com/experience-manager/using/using-query-builder-api1.html

Avatar

Level 3

I guess that I'm surprised that we have this public interface defined but the only way to get an instance of an implementation is to first instantiate a SimpleSearch object. I had hoped that there was some other way to get hold of an instance.

Avatar

Level 3

Thanks for the response. So is there no way to get the Trends when using QueryBuilder? I've read through the linked document and there's no mention of Trends at all there.