When people think of SharePoint, they think of it as the place to store company-wide information and data. As far as uploading or creating new documents, SharePoint never really raised concern. After conducting research and client surveys, however, what does seem to be a major source of frustration is the issue of searching for and locating documents within SharePoint. Here is how to display search results in SharePoint Online.
Let’s address the expectations of end users first. When dealing with SharePoint Search, a majority of end users expect to upload their content to SharePoint and find it via a search à la Google. Basically, they have grown accustomed to a search option being easy, instantaneous, and requiring no additional actions on their part.
Let’s think about this: There are engineers, marketers, project managers, developers, and many others at Google making sure that the content is indexed, crawled, ranked, and distributed accordingly. Their major source of income is from the advertising made via their platform, so it is to be expected that the distribution and surfacing of the data are optimized.
Then what about SharePoint Search? You do have features available out-of-the-box and they will do the basic requested actions you would expect, but to take full advantage of the available platform, there are some steps you can complete to make sure your organization is reaping all the available benefits SharePoint has to offer.
One good best practice is to create a content type (a set of columns attached to SharePoint assets) and attach it as the default for the relevant document libraries you are creating. By grouping common fields together, you gain the ability to add a default template for the content type or set up a custom workflow for that specific content type.
There is a bonus for SharePoint Search in all of this, which is that the default “Document” content type will always be available when you create a simple document library. If your business is used to dealing with sets of documents that have common fields by which they can be grouped, then this will be a great asset for you.
I found this to be tricky when I started consulting on SharePoint Online. Typically, in an on-premise environment, you would make sure you have access to Central Administration to monitor the search crawl(s) happening on your SharePoint environment. On SharePoint Online, this is managed and controlled by Microsoft. When calling them and asking them about the frequency of full crawls, they typically say it occurs within 24 hours. It is true most of the time, but losing the ability to review the crawl(s) means that you have to guess when Search is not working correctly. This, of course, has a tendency to raise concern (Is it because of my content? Is it because of my query? Is it because it is not fully indexed yet?).
To be on the safe side, make sure to hit “Reindex Document/List Library” to reindex all of the content during the next crawl. This is available under Document Library/List Settings >> Advanced Settings.
If you feel like you did not get a full crawl, don’t hesitate to open a ticket with Microsoft Support to inquire about it. Their support answers quickly and you are paying for it, so you might as well utilize their help in cases of doubt.
This is perhaps the more advanced section of this article, but bear with me because it is key — especially if you are planning to surface content using the SharePoint Search Content Web Part.
When you create a custom column, it will likely create a crawled property using the following format: ows_[Column_Name]. Per default, this property might not be mapped to a managed property. The managed property is what will allow you to query and set query text in Search.
To map the crawled property and managed property, make sure you are a SharePoint administrator of your Office 365 subscription before navigating to https://[tenant]-admin.sharepoint.com to click on “Search” and “Manage Search Schema.”
Option 1: Create a new managed property
This method is good because you can efficiently name the managed property you have created; unfortunately, it will not allow you to select the name from the dropdown in the Content Search Query Web Part. However, you can type out the property and it will allow you to search and filter.
Option 2: Map a pre-existing property Microsoft provides a few columns by default that you can use to map to your crawled properties. They all start with “Refinable,” followed by the type of data it is expecting to receive. For example, if you want to map with a text field, you would use RefinableString00. Obviously, check that nothing is currently mapped in the column; if there is, move to the next property.
The only difference between the options is that, in Option 2, the properties can be found using the Content Search Query Web Part dropdown.
One of the most useful web parts introduced in SharePoint 2013 is the Content Search Web Part. This allows you to surface documents based on Search Query, as well as set your query text, refiners, and even result controls/displays.
I could write a full article just about this web part, but in the context of this article, note that once you have the managed property set up and the search index is fully indexed, you will be able to set query text as follows:
If your search returns nothing, you can check the managed property by navigating to the document library or list library and trying to filter there. If the view returns no results, then there is an issue with your managed property.
Finally, use the search display templates in order to modify the views (please check back for my upcoming article about this).
Considerations for Custom Development
With the methods above, you can quickly create and adjust a custom search. However, you will need to consider the following:
I’ve shown you how to display search results in SharePoint Online. Here at NIFTIT, from Office 365 consulting to SharePoint solutions, we can handle projects of any size and difficulty. We follow industry standards and best practices to build world-class solutions. learn more about our office 365 support here!