Including or excluding multiple property filters in SharePoint search results web part query

In one of my projects, we built a directory largely based on this article with content created by Stacy Deere-Strole of Focal Point Solutions. Something we ran into was wanting to include multiple departments in our base search query (not refiners, as that only narrows our results instead of expanding them). We also wished to eliminate multiple results in the JobTitle property within the query text. While this is a simple solution, hopefully it will save you some trial and error in writing your search language.

  1. Go to “edit web part” on the “Search Results” web part
  2. Click “Change Query” under Search Criteria
  3. Begin building your query how you normally would, using the “Keyword filter” and “Property filter” builders to assist along the way.
    1. Under property, selecting “–Show all managed properties–” will allow you to find all of your possible fields. You can then select department, job title, or whatever you’re looking for and your query operator (contains, starts with, etc.) and conditional content (“Manual value” is a good option from the last dropdown).
    2. To add multiple property filters for the same property, simply separate them with a space as seen in the screenshot below.
    3. Placing a minus sign before the property will exclude anything matching that part of the query
    4. It doesn’t seem to matter if you use “:” or “=” after a property
    5. An asterisk (wildcard) after or before a word or partial word will include anything with those letters included as part of another word (i.e., Librar* will get both “Libraries-Reference” as well as “Library-General”). You might have to play around with this to get the results you’re looking for.
    6. Use “test query” to update the preview on the right and make sure your results are resembling what you need before clicking OK (on the Build Your Query and Web Part Settings Panel, or your changes won’t save). Save your page and make sure you have what you want.

Our final result resembled this:

{searchboxquery} contentclass=SPSPeople Department:Lib-* Department:Conserv* -Department:law* -JobTitle:retire* -JobTitle:student*



One Reply to “Including or excluding multiple property filters in SharePoint search results web part query”

  1. Hi there,

    is it possible to exclude everyone with no job title? I tried doing {searchboxquery} contentclass=spspeople -accountname:spo* -PreferredName:”Foreign Principal” -JobTitle:”” but that doesn’t work.


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.