SharePoint 2013 Search Bug With Anonymous Users

While working on a publishing website built on SharePoint 2013 (with SP1), I came across a rather unusual bug. I had a custom master page and on it I placed a search box using the snippets available with the design manager. The site permissions were set such that anonymous users are able to view the site and no sub-sites or folders were locked down to any particular group. After created several pages and performed a crawl on the site, I started to setup custom display templates for my search web parts (I used both content search and search result web parts).

After crawling and indexing the content, I decided to give search a try while I was logged in. Sure enough I could see the relevant content pop up on my search result page (which was also a custom page with a custom page layout). I thought everything was fine and good until a co-worker asked my why each time they used the search box that was on the master page, their search query and the text in the search box never changed after their first search. I found this odd as I’d never heard of such a thing before. After some investigating, the only thing I could find causing it was that my co-worker was not logged into the site, but I was. I logged out of the site and attempted to do a search with the search box and sure enough each time I searched for something, the search box would revert back to the very first thing I searched for while I was anonymous.

To break it down, here is how I reproduced the bug:

  1. Visit the site as an anonymous user
  2. Use the search box to perform a search
  3. After seeing results, repeat step 2 using different search terms and see if the text in the search box or your search results are different.

What I found was that after the initial search, any subsequent searches would end up with the search box showing your very first search term as opposed to what you actually searched for.

After more investigating, I found that this bug is caused by having the site collection output cache enabled. You can find this settings at the top level site under Site Settings > Site collection output cache. I contacted Microsoft support and I was notified that this is indeed a bug. So far I haven’t seen any CU notes that mention a fix for this.

site settingsoutput cache


Leave a Reply

Your email address will not be published. Required fields are marked *