SharePoint Online Search Results and PnP Search Web Parts suddenly stops working

Introduction

We have been working at iThink 365 with one of the NHS Trust in the UK to move their SharePoint 2010 environment to SharePoint Online.

One of the tools that we have made a lot of use of is the excellent PnP Search Webparts. If you have not checked these out then you must do so, more information here (https://microsoft-search.github.io/pnp-modern-search/).

Here is an example of something that was built with them.

The strange thing we were seeing is that every once in a while the search results would stop working. No one seem to do anything or at least change anything but they would stop working.

The search results used custom search result sources (site settings -> manage result sources) and Microsoft SharePoint search rather than Microsoft Graph.

Resolution

After a lot of trying out different queries in the search result sources page the issue was down to one main issue.

Here is the original result source query which looked like this:

The fixed version ended up being this, do you see the subtle difference?

Note: the double quotes around the path.

On a couple of occasions the ” were stripped out of the query when a user went into the search results and we think that an administrator was saving the result query rather than cancelling and this seemed to break the search web part.

Anyway hope that helps someone as it took us a few hours to work out what was going on!

Thoughts? Comments about this post? Please leave them here..

This site uses Akismet to reduce spam. Learn how your comment data is processed.