I have the following :-

  • I am working on a SharePoint 2013 server. and I have an enterprise wiki site collection.

  • Each wiki page is linked to a managed metadata term store through a site column named WikiCategory.

  • And each wiki page can be linked to multiple terms through the WikiCategory site column

  • each wiki page have a “Custom Status” site column with 2 values; active (default) & Expired.

Now I am trying to achieve the following:-

  1. To exclude from the search any wiki page which is linked to a single term and this term is deprecated ..
  2. To exclude from the search any wiki page which have its “Custom Status” = Expired regardless if its term is depreciated or not.

Now I know that i can exclude wiki pages based on their WikiCategory value as follow:-

Central Administration >> Managed Services >> Search Service >> Result Sources>>open the Query builder >> Add the following WikiCategory <> “123”. Which will exclude all the wiki pages linked to a term named 123. But I do not want to follow this approach… What I am trying to achieve is to specify to exclude all the wiki pages linked to a single term and this single term is deprecated (deprecating a term can be done from the term store management by right clicking on the term and click on deprecate term). But if a wiki page is linked to let say two WikiCategories and one term is deprecated while the other is not , then I need to keep showing the wiki page inside the search.

So can anyone advice how I can achieve this ? mainly to exclude wiki pages which have their custom status = expired OR they are linked to a single depreciated term ?

Thanks in advance for any help ?


  • 1
    You might need to go the (JavaScript) DisplayTemplate route and process all SearchResults yourself before displaying them – Danny '365CSI' Engelman Jun 14 '16 at 12:50
  • @DannyEngelmanMPW why is not there a way to know if a term is depreciated inside the Search Service level ? – john Gu Jun 14 '16 at 13:07
  • 1
    You have a very specific requirement: "and one term is deprecated while the other is not " This use case just does not apply to the majority of the users of this tool, so the tool was never adapted to do it. For the very same reason your blender can process peeled walnuts and not un-peeled walnuts. FYI for your requirement DisplayTemplates are the way to extend the tool. – Danny '365CSI' Engelman Jun 14 '16 at 15:06
  • @DannyEngelmanMPW but sharepoint is a bit tricky on how the search results work ,, now let say i write this inside the Search Results query WikiCategory <> “123” then if we have a wiki page linked to 2 terms (123 & 456) and one of the terms is 123 then the above exclusion query will bypassed since since "123"+"456" does not equal 123 ... but if i say not contain as -WikiCategory:"123" then if there is a wiki page with 2 terms (123 & 456) then the not contain will be satisfied... – john Gu Jun 14 '16 at 17:19
  • 1
    Powershell is making it way too complex. Take an existing DisplayTemplate and filter out the results you do not want. Simple JavaScript: blog.metrostarsystems.com/2015/09/25/… – Danny '365CSI' Engelman Jun 14 '16 at 18:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.