Expand my Community achievements bar.

SOLVED

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

Avatar

Level 4

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.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

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/searc... 



View solution in original post

6 Replies

Avatar

Community Advisor

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/omn...

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

 

Avatar

Level 4

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

Avatar

Correct answer by
Community Advisor

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/searc... 



Avatar

Community Advisor

@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. 

 

Jagadeesh_Prakash_0-1708339604457.png

 

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

 

 

Avatar

Administrator

@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