I want to refine the default search service result source. so i did the following steps; i went to "Central Administration" >> "Managed Service" >> "Search Service" , then i copy the default "local sharepoint results" . and i modify the default query using the "Query builder".

now i am trying to understand what are the differences between using "Not Contains" and "Not equals" inside the search service Query builder.. when i define these for my multi valued managed metadata site column named "WikiCategory". for example based on my test i came out with these outcomes:-

  • let say my managed metadata site column contain values such as A,B ,C ,D ,E,F.

  • and my pages can be linked to this managed metadata site column using multiple values.so a page can have "A;F" OR "A", OR all values.

  • now if i define the following inside my query builder :-


then this means to show the pages that do not have wikicategory = "A" ONLY. but if i have a page linked to 2 options or more such as "A;E;F" then my restriction will not work. in other words this criteria :-


will show page with these values:-




B,C,D,E,F but will not show any page that have only its wiki category = A.

  • now if i want the criteria to exclude and page that is linked with option A regardless if there is other values, then i need to use "Not contains" instead of "Not Equals", as follow:-


this criteria will exclude these pages with these options:-




so can anyone adivce if my assumption about using "Not Contain" and "Not Equal" on multi-valued metadata column is correct? so "Not equal" means not equal when the page have single value ,, while "Not Contain" means any occurrence of the value inside the site column values (A in my case)??

  • 1
    The search is treating that metadata associated with page as string data type. Hence Not Contains works as per your expectation. – Amal Hashim Jun 10 '16 at 2:42
  • @AmalHashim so in this case both Not Equal and Not Contain will work as my assumptions is this correct ? – john Gu Jun 10 '16 at 9:36
  • @AmalHashim so there is no way to compare based on the values provided , i mean to check the occurrence per value rather than combining them as a single string ? – john Gu Jun 10 '16 at 9:37
  • 1
    Not Equal return the data if the string is not equal "A".. – Amal Hashim Jun 10 '16 at 10:07

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.