Managed Metadata (Part 2) - Using it for predefining the search results
"This is part 2 of the smal series about managed Metadata. In the last post, I described the differences about crawled and managed properties. In this post i want to show you where we can use the managed properties.
Managed properties are, that we have learned since the last post, a single or a set of crwaled properties, mapped to one property in the property store.
So what can we do with this?
Searching by managed properties
Yes we can search for it, but how? The answer is simple. But first let assume you got a crawled property called "DocumentState". This crwaled property contains values from a choice list (Approved, Active, Closed). These crawled property is assigned to the managed property calles "DocumentStateM".Â
Now we can use in the searchbox the following syntax:
"DocumentStateM: Active"
Ths Syntax is very easy "{ManagedProperty}:{Searchvalue}". The example above will search (and display) all entries that contains the Property DocumentStateM with value "Active" assigned.Â
Do you want all documents that have the state active and closed, the syntax will be the following:
"DocumentStateM: Active OR DocumentStateM: Closed"
This is the basic syntax of the Search Query language in SharePoint.Â
Result Sources
This example is very handy, but it will be more effective if you can create a preselection for the user. For example, you will only dsiplay the documents the contains the Value "Approved" to the document. For this you can create a result source.Â
This will autmate some preselection for the user, before he assign his search query.
to create a new result source, you must navigate to https://{yourSharepoint}/_layouts/15/manageresultsources.aspx
This will show you a list with existing preselected resultsources.Â
When you add a new result source, you will be redirected to a details page where you will enter a unique Name, and a protocoll and with a wizard, the predefined query. In our example you must insert DocumentStatusM:Approved {searchTerms}.Â
After click on test query you will se on the right side the search results.
The keyword {searchTerms} is a placeholder for the manual user input from a search list. If you don't want that the user input will be considered then you can remove this.
In another post I will describe the other options of this wizard. For now you can ignore the other setting and close the wizard by clicking on "OK".
After saving the new result source, this will be avaiable in the searchresults webparts.Â
Please pay attention where you create the result source. When you create a result source on the site level and want to use it on another site, it is not possible. For this you must defined it in the search configuration on the central administration.Â
Lesson learned
What we had learned? First of all, we can only use Managed Property for searching after it. thats the reason why we must assing the crwaled property to the managed property. Search restriction We also learned that we can use the managed property to preselect some data for the user, by creating a own result source.  This result source will be available acros the scope, where you create it.Â













