SharePoint 2010 Search : not showing any results for anonymous users ?

I was testing SharePoint search feature in my lab machine and found that once I enable anonymous access on my web application and once I search for keyword it was not displaying any content.

Instead it gives a message:

"We did not find any results for <keyword>"

For the authenticated users, the search results are returned correctly. Later I found that we have to configure a specific setting to show the search results for anonymous users, cause of this issues was due to security trimming.

To get rid of it please do the following.

  • Under the SharePoint Site go to Site Settings. Search Administration -> Search and offline availability -> Indexing ASPX Page Content, Enable the option "Always index all Web Parts on this site"
  • Under Search Service Application, do a Full Crawl for the content source to resolve this issue.

image