Highlighted Content WebPart and Managed Property Filter HELP

Copper Contributor

I am hoping someone might be able to assist with a little challenge I have been fighting with in a SharePoint Online Communication Site.

 

Scenario:

I am trying to use a Highlighted Content WebPart with metadata from 2 Site Columns (Term Store)  in a page library, to filter the content from multiple site collections in the Highlighted Content WebPart .

 

I have created 2 Custom Site Columns:

 

  • BusinessFunction
    • Sales
    • Marketing
    • Technical
  • BusinessRole
    • Director
    • Dept. Manager
    • Sales Rep
    • Employee

 

Both site columns are "Managed Properties" in the tenant search scheme and I am able to filter content from a single Site Column by using a filter. However things get a little strange when I add the second column into the filter.

 

The business roles have a 1 to many relationship with the business function.

IE: Marketing, Sales and Technical all have a Director Role.

 

Question:

Is there a simple way to setup the Highlighted Content filter to query the site columns within the Highlighted Content webpart so I ONLY return items related to for example: Sales Director?

 

When I setup the below filters on the webpart I would expect to only retrieve the Sales Director information that has been tagged with the BusinessFunction: Sales and BusinessRole: Director… But I don't????

 

Filters:

owstaxidBusinessFunction

Doesn't Contain

Marketing

 

owstaxidBusinessFunction

Doesn't Contain

Technical

 

owstaxIdBusinessRole

Contains

Director

 

Can anyone please assist me on how this can be achieved it's driving me crazy.

8 Replies
Have you tried Filter owstaxidBusinessFunctions contains Sales and a second filter owstaxidBusinessRole contains Director? With two separate filters, the filters will have an implied AND and you should retrieve content for Sales AND Director.
Hi Susan,

Thank you for the reply and let me take a second to say that I love the Governance session you have done at Ignite in the past.

With regards to your response! Unfortunately if I create the filter you suggested it returns all posts marked with Sales & all posts marked with Director.

So I would get:
All OwstaxidBusinessFunction marked with Sales and all owstaxidBusinessRole marked with Director

Example of results:
Sales Director
Sales Dept. Manager
Sales Employee
Marketing Director
Technical Director

I only want to return Sales Director posts. Any Ideas?
Hi Susan,
First let me say how much I loved you Governances guidance and sessions you have done.

To answer your question yes I have:

It returns all Sales posts no matter the owstaxidBusinessrole and all Director posts no matter what the owstaxidBusinessFunction is.

Example results:

In other words all posts with the below metadata.

Sales Director
Sales Dept. Manager
Sales Sales Rep
Sales Employee
Marketing Director
Technical Director

Any other ideas would be gratefully appreciated. :)
Thanks for your kind words. If you want to ensure the AND query and that is not what you are seeing, you will probably need to use the custom query option. The syntax is more complicated but you should be able to get exactly what you want.

Ya I have also tried that but CAML queries don't appear to work at present and KQL only supports queries on the current site collection as far as I can see. :( The whole query/ filter functionality seems very flaky at the moment.

 

The question is why doesn't "Doesn't contain" work as expected. ;) This appears to be a bug as does the fact that the webpart says you can use either CAML or KQL but CAML isn't working.

 

Or perhaps I am doing something incorrect?

<Query>
<Where>
<And>
<Contains>
<FieldRef Name='Function' />
<Value Type='TaxonomyFieldType'>Sales</Value>
</Contains>
<Contains>
<FieldRef Name='BusinessRole' />
<Value Type='TaxonomyFieldType'>Director</Value>
</Contains>
</And>
</Where>
</Query>

 

 

Try using this tool to build your query: https://github.com/pnp/PnP-Tools/tree/master/Solutions/SharePoint.Search.QueryTool. I'm not a pro - I usually get help for queries - but this is a good place to start.

@Susan Hanley 

 

I thought I should point out this is an issue that over 900 others are fighting with according to uservoice. I am happy I am not going mad... ;) It would appear this is a major problem with the way that the filter functionality has been implemented in the "Highlighted Content" and "New" webparts. Please read the uservoice suggestion for further details.

 

But to cut it short if you use multiple columns and refer to the same column twice it acts as an OR not and AND statement, making it very difficult to implement a filter that subtracts results.

 

Please vote for this if you are also having the same issue. (See link below)

https://office365.uservoice.com/forums/264636-general/suggestions/32071210-highlighted-content-web-p...

 

Yes, if you filter for the same value, the implied operator is OR. If you filter for different values, I get an AND experience when at least one of the values are not my custom properties. You are correct, though. I reported the same concern in a blog post in 2018. That is why you will want to use the KQL or CAML query to mitigate the issue. Unfortunately, it's just way more complicated.