Frage

I have a list of training courses which are tagged with a LearningTopic managed metadata column. Values include thinks like Word, Excel, Photoshop, Phone Skills. This LearningTopic termset is used by several different departments and its structure is pretty much set.

The list is shared through the cross-site publishing features of 2013 and on the user/publishing side we have a managed navigation where we reuse terms from the LearningTopic termset.

We create a Category Term page with a content search web part to retrieve the items and put in the query for the CSWP something like this:

owstaxIdLearningTopic:{Term}

And that works. As we navigated the terms in the publishing site the one Category Term page queries the attached catalog's result source and pulls up anything tagged with the appropriate term.

All of this is working as expected and is good so far.

Here is the part that doesn't work

On this one publishing site we want to create a new term in the managed navigation term set. For example we want to add Microsoft products and then reuse the existing Word and Excel terms under that.

In this case when we navigate to Word and Excel it still works, but when we navigate to MicrosoftProducts we get nothing. I tried following this page which shows how to query all children of a term and changed the query to:

owstaxIdLearningTopic:GPP|{Term}

But that didn't work because Word and Excel aren't really children of that term they are just pinned there.

I also thought I might be able to put a custom property in the Microsoft Products term so I created a local property called FancySearchTerms with a value of

owstaxIdLearningTopic:GP0|#<guid for Word> OR owstaxIdLearningTopic:GP0|#<guid for Excel>

And then in the content search webpart I change the query to

{Term.FancySearchTerms}

I could see from the Test tab in the query builder that the FancySearchTerms were being read and incorporated into the query text, but unfortunately they were wrapped in "double quotes" which makes it search for text, not the managed properties.

In one sense the reused terms aren't children of the new term, but in another sense they are.

So how does one use a content search web part query to retrieve children reused under a new term?

War es hilfreich?

Lösung

I stumbled across this thread and it contained the secret to retrieving custom properties and incorporating them into the KQL query. I set up my KQL fragment as a custom property as described above. Something like this:

owstaxIdLearningTopic:GP0|#<guid for Word> OR owstaxIdLearningTopic:GP0|#<guid for Excel>

Then in the CSWP query builder I escape the termset custom property using the \ like this:

({\Term.customPropName}) XRANK(nb=1.5) somevalue ....

That tells the query builder to include the dynamic value as part of the query and not as a literal string.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit sharepoint.stackexchange
scroll top