Using SharePoint search and content targeting

TheBonzai Intranet Web Part support content targeting for a single list or library.

However, due to the architecture that has been implemented SharePoint search can be used to aggregate and also target content using the Content By Search Web Part in combination with the various Bonzai Intranet display templates that have been created.

This combination offers an almost unlimited set of possibilities to aggregate and present content to users in any fashion. In order to use a Content By Search Web Part to show targeted content the following search query has to be entered:

{|owstaxIdOwlContentTargetOptionsOne:{User.ContentTargetOptionsOne}} OR

-owstaxIdOwlContentTargetOptionsOne:"GTSet|#bf19bc58-7191-4bb2-af90-703fe2babc04")

AND

{|owstaxIdOwlContentTargetOptionsTwo:{User.ContentTargetOptionsTwo}} OR

-owstaxIdOwlContentTargetOptionsTwo:"GTSet|#a821dbdc-123f-4a45-8d28-776e19a45502")

AND

{|owstaxIdOwlContentTargetOptionsThree:{User.ContentTargetOptionsThree}} OR

-owstaxIdOwlContentTargetOptionsThree:"GTSet|#73efcc88-348f-4748-9591-5eef7e35419c")

AND

{|owstaxIdOwlContentTargetOptionsFour:{User.ContentTargetOptionsFour}} OR

-owstaxIdOwlContentTargetOptionsFour:"GTSet|#ae5857006-9cd4-4213-84f5-dae1ae8db0c2")

In Pseudo Code:

{|owstaxIdOwlContentTargetOptionsOne:{User.ContentTargetOptionsOne}} OR

-owstaxIdOwlContentTargetOptionsOne:"GTSet|#Term Set ID of the Content Target One Options")

The search query mimics the in-built Bonzai Intranet search functionality and is constructed the following ways:

  • ({|owstaxIdOwlContentTargetOptionsOne:{User.ContentTargetOptionsOne}} - This is a special search syntax that tells SharePoint search to expand the user profile properties (this is what the "{|" symbol performs) and to see if any of the properties that are part of the item match the user.

    In essence it is doing an OR operation for all user profile properties for the current user against the item.

  • -owstaxIdOwlContentTargetOptions:"GTSet|#bf19bc58-7191-4bb2-af90-703fe2babc04 - This syntax says that if Content Target Options one is blank then return true. This is the same as in the Bonzai Intranet content targeting implementation as if a user has not selected any values as part of targeting we assume that an item should be visible to everyone.

    The GTSET| operator provides this capability to say match on any metadata value and the - operator in front of it is doing the inverse.