Hi there,
I tried to use the simpleSearchto achieve the search functionality
When I try to use the below one.
slingRequest.getResource().adaptTo(SimpleSearch.class);
I got nullpointer exception.
Kindly guide me to resolve the issue.
Thanks
Nanda
Solved! Go to Solution.
Views
Replies
Total Likes
Make sure you have included the 'cq-search' dependency in your project
Views
Replies
Total Likes
Make sure you have included the 'cq-search' dependency in your project
Views
Replies
Total Likes
Why not use QueryBuilder API instead of SimpleSearch?
Views
Replies
Total Likes
<dependency><groupId>com.day.cq</groupId><artifactId>cq-search</artifactId><version>5.5.4</version></dependency>
Views
Replies
Total Likes
Thanks for your reply.
Dependency is already exist in my POM.xml.
I can import the SimpleSearch class in my code.
When I try to print 'slingRequest.getResource()' in the console. I can see the object reference.
But when I try with adaptTo(SimpleSearch.class). Here I got a NullpointerException.
FYI, I am using AEM 6.0.
Thanks
Nanda
Views
Replies
Total Likes
do you have a stacktrace in the error.log file?
Views
Replies
Total Likes
Can you give me the usecase for adapting SimpleSearch ?
Views
Replies
Total Likes