How a Taxonomy Field is available to Search Service Application


Sathish Nadarajan
SharePoint MVP
Published On :   08 May 2015
Visit Count
Today :  1    Total :   9921
Plan, Migrate, Secure, Report
SharePoint & Office 365 Tool. Simple & Easy to Use. 15-Day Trial!

Sharegate: Kick-Ass Tool
Think Your SharePoint & Office 365 Are Secure ? Find Out Now!


We can find many articles regarding the proper provisioning, creation of Taxonomy columns with different options. But even after provisioning properly, we have to verify some of the interesting (?) features of Taxonomy Field.

· As soon as you planned to have a Taxonomy Field, the first thing before provisioning, we should make sure that the “TaxonomyFieldAdded” Site Collection Feature is activated.

· “Taxonomy Update Scheduler” – Timer Job runs every hour on the Web Application Level

The purpose of the above Feature and Timer are as follows.

· TaxonomyFieldAdded

o This Feature provisions the Event Receiver which is required handle the Taxonomy Field on the List level.

o The Event Receivers are

§ TaxonomyItemSynchronousAddedEventReceiver

· This Event Receiver is responsible for updating the TaxCatchAll and TaxCatchAllLabel Columns based on the Taxonomy Field Added on the SPListItem

§ TaxonomyItemUpdatingEventReceiver

· This Event Receiver is responsible for updating the TaxCatchAll and TaxCatchAllLabel Columns based on the Taxonomy Field Updated on the SPListItem

§ Both the Event Receivers are Synchronous.

· Taxonomy Update Scheduler

o This timer is responsible to push the TermStore Changes to the Taxonomy hidden List.

o Unfortunately this Timer does one way sync.

· Taxonomy Hidden List

o As soon as we add a Taxonomy Field with any List, there is a Hidden List called “Taxonomy hidden List” will get created. TaxonomyFieldAdded Feature is responsible for creating this list as well.

o This List has the Lookup Fields for the Hidden Columns like the Note Field associated to the Taxonomy Field, TaxCatchAll and the TaxCatchAllLabel Fields.

· This hidden list contains all used keywords and terms for the Site Collection and SharePoint uses this list for fast retrieval of the labels of the keyword and terms. You can find the list either by just browsing to /Lists/TaxonomyHiddenList.

· SharePoint uses this list as a lookup column so that it does not have to query the Managed Metadata Service all the time, but instead just looks it up in the local Site Collection.

What if, the TaxCatchAll, TaxCatchAllLabel Column does not got created?

There is nothing to panic about that. If they were not created by default, then we can add them by using the below script.

$site = get-spsite "http://c4968397007:1001/sites/demoadmin"

$field = $site.Rootweb.Fields.GetFieldByInternalName("TaxCatchAllLabel")

$list = $site.Rootweb.Lists["Pages"]

$list.Fields.Add($field)

$list.Update()

The above script shown only for TaxCatchAllLabel column. The same can be used for TaxCatchAll Column as well.

And make sure that the Event Receivers were also properly attached. If not, again, we can add the event receivers using PowerShell or even C# console application will help you.

Why we are focusing much on these columns and Event Receivers.

From the beginning onwards, we are repeatedly talking about these two columns. The importance of these columns are Crawled Properties were picking the values from these columns only. Particularly TaxCatchAll Column.

If these columns were not properly updated, then the Search Query Will not return the values properly. We will be inspecting some thing else. But the actual culprit is, TaxCatchAll Column.

Let me try to explain with an example. I have a Taxonomy Field.

· Let the Internal Name of the Field is MyMMD

· Then the Crawled Property name would be ows_taxId_MyMMD

· Then the Managed Property Name would be owstaxIdMyMMD

The Crawled Property ows_taxId_MyMMD is responsible for that particular record to be retrieved on the Search Result. That we are aware already. But this Crawled Property, picks the value from the TaxCatchAll Column. Not from the MyMMD column directly.

Hence, if we delete the value from the TaxCatchAll Column and do a Crawl, then the result will not be available on the Search Result, though the actual value resides on MyMMD. This is one of the important thing always we should keep in our mind.

Problem Statement:

To identify this, I met with a strange scenario and struggled to overcome this.

The scenario was like this.

· I had a Taxonomy Field on my List

· Created a Checked In Event Receiver.

· A separate Timer which will update and Check in the List Items every 1 hr.

· During the Timer execution, I don’t want the Event Receiver to be triggered.

· For that, already we saw in the past article how to do that.

· But that stopped my execution of default required Event Receivers as well.

§ TaxonomyItemSynchronousAddedEventReceiver

§ TaxonomyItemUpdatingEventReceiver

· With this, the TaxCatchAll Column was not updated properly.

· Hence, whenever the Timer ran, the search does not picks the value properly.

Apologize, if the post is not well organized. Because, I thought of sharing my experience and various knowledge bases together. Moreover, this is not a step by step procedure to explain with screen shots. This is a very strange problem which we used to face very rare. But if we faced, then I bet this will eat our time like anything.

Happy Coding,

Sathish Nadarajan.

SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Categories

Migratiin Tools for SharePoint