Not getting search results using OmniSearchService.getSearchResults() in Author | Community
Skip to main content
Level 3
February 19, 2024
Solved

Not getting search results using OmniSearchService.getSearchResults() in Author

  • February 19, 2024
  • 4 replies
  • 1381 views

I am using OmniSearchService.getSearchResults() to get the search results. In publisher i am getting all the search results properly but in author its getting me 0 results. what could be the reason for this issue ?
As i am checking in logs i am getting 0 hits in author but in publisher all the results are coming fine.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Raja_Reddy

Hi @monish_gavali 

Omnisearch works from below nodes which are marked as granite:InternalArea

You can find the code in these paths..

/libs/granite/ui/content/shell/omnisearch &
 /libs/granite/ui/components/shell/omnisearch

 

  1. Permissions: Make sure that the user you are using to perform the search has the necessary permissions to access the content in author. Check the user's permissions in the User Administration console.

  2. Indexing: Check if the content is indexed properly in author. You can do this by going to the Query Debugger in the AEM author instance and running the same query that you are using in your code. If you get 0 results in the Query Debugger, then the content is not indexed properly.

  3. Replication: Check if the content is replicated properly from publisher to author. If the content is not replicated properly, then it will not be available for search in author.

  4. Search configuration: Check if the search configuration is the same in both publisher and author. Make sure that the search index is configured properly in both instances.

  5. Code issues: Check if there are any code issues that are causing the search to fail in author. Make sure that the code is the same in both publisher and author.
    https://experienceleague.adobe.com/docs/experience-manager-cloud-service/content/assets/manage/search-assets.html?lang=en#searchbehavior 

4 replies

A_H_M_Imrul
Community Advisor
Community Advisor
February 19, 2024

Hello @monish_gavali,

How are you instantiating the ResourceResolver (the one that you are passing into the getSearchResults method)? If its for a service user, make sure it has enough permission. to access intended modules.

https://developer.adobe.com/experience-manager/reference-materials/6-5/javadoc/com/adobe/granite/omnisearch/api/core/OmniSearchService.html#getSearchResults-org.apache.sling.api.resource.ResourceResolver-java.util.Map-long-long- 

Also please share (if possible) more detail about your implementation for better assistance. 

 

Level 3
February 20, 2024

Where can I check the permissions for service user ? Can you please tell me ?

A_H_M_Imrul
Community Advisor
Community Advisor
February 20, 2024
Raja_Reddy
Community Advisor
Raja_ReddyCommunity AdvisorAccepted solution
Community Advisor
February 19, 2024

Hi @monish_gavali 

Omnisearch works from below nodes which are marked as granite:InternalArea

You can find the code in these paths..

/libs/granite/ui/content/shell/omnisearch &
 /libs/granite/ui/components/shell/omnisearch

 

  1. Permissions: Make sure that the user you are using to perform the search has the necessary permissions to access the content in author. Check the user's permissions in the User Administration console.

  2. Indexing: Check if the content is indexed properly in author. You can do this by going to the Query Debugger in the AEM author instance and running the same query that you are using in your code. If you get 0 results in the Query Debugger, then the content is not indexed properly.

  3. Replication: Check if the content is replicated properly from publisher to author. If the content is not replicated properly, then it will not be available for search in author.

  4. Search configuration: Check if the search configuration is the same in both publisher and author. Make sure that the search index is configured properly in both instances.

  5. Code issues: Check if there are any code issues that are causing the search to fail in author. Make sure that the code is the same in both publisher and author.
    https://experienceleague.adobe.com/docs/experience-manager-cloud-service/content/assets/manage/search-assets.html?lang=en#searchbehavior 

Jagadeesh_Prakash
Community Advisor
Community Advisor
February 19, 2024

@monish_gavali  Ideally this should not be a issue with author or publisher until you have some code written specific checking the run mode. 

 

Below screen shot shows what is the output of getSearchResults method returns. 

 

 

Make sure you don't have any code specific to author and publisher. And also make sure author and publish have the same nodes and levels

 

 

kautuk_sahni
Community Manager
Community Manager
February 21, 2024

@monish_gavali Did you find the suggestions from users helpful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.

Kautuk Sahni