SharePoint 2013 Search not working for anonymous users

We had a public site that has a lot of Content Search web parts, everything was working fine but suddenly search web parts stopped working only for anonymous users and was working fine for logged in users.

After some Googling and full crawling, I managed to get it working using the following PowerShell Script, I had run it for every list and library that search read data from


#Add-PSSnapin microsoft.sharepoint.powershell
 $web = get-spweb "http://your server"
$list = $web.Lists["List Title"]

$list.AnonymousPermMask = $list.AnonymousPermMask -bor ([int][Microsoft.SharePoint.SPBasePermissions]::ViewFormPages) #binary or adding the permissions