Recently, I faced a really thorny issue regarding the Content Search Web Part in SharePoint Online. The customer is configured with a one-way, outbound hybrid topology with SharePoint Online/Office 365. We had Search Federation setup and working great on-premises. They setup a Content Search Web Part on their SharePoint Online home page to display all sites the user belongs to, and they wanted that same Content Search Web Part in their on-premises farm. What they found, however, was a puzzler: the exact same query configured the exact same way would return more results in SharePoint Online than it did on-premises.
We verified that the user had the proper permissions, the sites were being indexed, etc. A site that we found missing in the on-premises results could actually be returned if we narrowed the search just to its URL. We couldn’t explain the behavior, and understandably, it was quite a concern for the customer. However, I was finally able to crack the nut and figured others might be struggling with the same issue. The problem: duplicates and a probable bug in SharePoint Online.
Before moving into the details of the solution, let me give you some more background information.