Columns with benefits

This question recently popped up in our Yammer network:

I’m trying to get my head around how tagging and search works in SharePoint.

Within a Document Library, I added a column and used it to add some keywords to each item. I then searched for the keywords but no results were returned. Does search only work with file names? Is the point of tagging like this only for filtering within the library and enabling various views?

I’m kind of confused at the moment. Obviously, what I want to achieve is to give a document a set of tags which would define that document and then use search to find that document based on the tags that it has been given. But if search only works with file names, maybe this approach will not work…

I thought it would be helpful if I published my response:

When you create a new list or library the only column visible to a search will be the “Title” column. (if you use other out of the box apps like an Issue tracker then there might be couple more). As you observe, filters and views will work as they are not reliant on search. Filters and views in SharePoint work like Sort and Filter in Excel as they allow you to slice the list or library through manipulation.

The contents of the Title column are available to search as the column has associated managed properties which are visible to search. I’d add a caveat that you might need to wait 15 minutes for search to become aware of new items added to columns with managed properties (more about that later). So it goes that if you want search to see content in other columns you need managed properties.

Creating managed properties is a dark art, and something administrators don’t enjoy doing (well this one at least!). It’s fiddly and easy to make mistakes. However, Microsoft know it is hard so they have created a safe path that Administrators and Site Owners can tread.

The safe path is to create “Site columns”. These are different to the columns you create when you add a column to a list, say through Quick Edit, as through that route SharePoint will only add a simple column. The scope of a simple column is limited to the list or library to which it is added. The scope of a site column is that of the site collection it was created in (and it can be wider than that). Site columns are used to establish a consistent, reusable definition across lists and libraries but their abilities go further than that.

Site columns are ‘columns with benefits’

Site columns are created via Cog > Site settings > Site columns (its normally the first option under the “Web Galleries heading”).

Now before you do this, there are some rules that I’d like you to follow (for the detailed guide how to create one check out an earlier post of mine “Reusable columns“). Please create your site column with a lower case camel name e.g. prjman rather than Project Manager as spaces and punctuation in internal names introduce unfriendly complexity. For example, if you create a site column with the name DC Project technology the internal would be DC%5Fx0020%5FProject%5Fx0020%5Ftechnology ! You can give it a friendly name once you have created it. If people are syncing content using OneDrive then you can only have a handful site columns per library. (And if your column uses managed metadata then that greatly reduces the number you can sync owing to lookup thresholds). Once you have defined your columns you can add them to your list or library, not via quick edit but only through the list or library settings.

At this point search is still unaware of the new column, you’ve merely created and added a reusable definition. The magic happens once you add some content to the column. So… Create a new item and populate the site column field, save it and grab a cup of tea (or a good night’s sleep) and come back to it later as the magic happens behind the scenes

Every 15 minutes or so SharePoint is looking for changes to libraries and lists in order to update the search index. When it spots a freshly populated site column. It kicks off a separate task to generate managed properties for that column. This task runs on a schedule that we cannot influence. Sometimes 15 minutes is all it needs to create the managed properties sometimes 24 hours.

Once this task completes the values in the column will be discoverable by search with new items discovered and added to the index every 15 minutes or so. If you’ve used the site column to tag documents in a library, you’ll now be able to use those tags in search. Thereafter we are into the realms of display templates and refiners if the OOTB SharePoint results do not present the results in the format you need.

If you are interested in the behind the scenes magic then check out this post “From site column to managed property – What’s up with that?” – the post and the series of posts it belongs to has been an invaluable reference for me on my SharePoint journey.

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s