Recent

Only returning real people in search

Depending on how your active directory and profile import is setup, you could have a bunch of non-employee accounts showing up in your SharePoint people search results.  This could include test accounts, admin accounts, service accounts, or anything along those lines.

You can edit the People Search core results webpart query though to filter out results that don’t contain an email address, job title, department or other profiles values.  At our organization we were able to eliminate almost all non-employee accounts using this method.

Filtering which user profiles are returned

1. Go to your people results search center page and edit the page.

2. Edit the People Search Core Results web part
limiting-people-search-1

3. Click on the Change Query option
limiting-people-search-2

Ensuring all users have an Email
Include the filter:
WorkEmail:@YourCompanyEmailAddress

The colon (:) means contains so it just ensures that all accounts end with that email address.
limiting-people-search-3

Ensuring all users have a Job Title
I haven’t been able to find a good way to ensure a field is not blank.  The only work around I know of is to ensure that Job Title contains one of the letters of the alphabet:
(JobTitle:a* OR JobTitle:b* OR JobTitle:c* OR JobTitle:d* OR JobTitle:e* OR JobTitle:f* OR JobTitle:g* OR JobTitle:h* OR JobTitle:i* OR JobTitle:j* OR JobTitle:k* OR JobTitle:l* OR JobTitle:m* OR JobTitle:n* OR JobTitle:o* OR JobTitle:p* OR JobTitle:q* OR JobTitle:r* OR JobTitle:s* OR JobTitle:t* OR JobTitle:u* OR JobTitle:v* OR JobTitle:w* OR JobTitle:x* OR JobTitle:y* OR JobTitle:z*)
limiting-people-search-4

Ensuring all users have a Department
Same as the Job title, this ensures that the users Department is not blank:
(Department:a* OR Department:b* OR Department:c* OR Department:d* OR Department:e* OR Department:f* OR Department:g* OR Department:h* OR Department:i* OR Department:j* OR Department:k* OR Department:l* OR Department:m* OR Department:n* OR Department:o* OR Department:p* OR Department:q* OR Department:r* OR Department:s* OR Department:t* OR Department:u* OR Department:v* OR Department:w* OR Department:x* OR Department:y* OR Department:z*)
limiting-people-search-5

Combing multiple filters together
You can combine multiple filters together, so what we did was require a user account to have an email address AND department AND job title which drastically improved our people results:
limiting-people-search-6

When you have the query working like you desire, Click OK to save the query and OK to save the web part settings.

Deploying your changes globally

If you find that customizing the query returns you better people results, you can create a custom search result source that reflects your new query.  That way instead of changing the actual query text, you can just change the result source for the query.

Go to the Central Administration > Search Administration (If you are a farm admin) or Site Collection Settings (if you are Site Collection Admin).  Click on the Search Result Sources link.

On the Manage Result Sources page, find the Local People Results and copy it.
limiting-people-search-7

This will open a copy of that Result source.  Give it a unique Name and click on the Launch Query Builder.  This will allow you to duplicate your query that you did at the web part level.
limiting-people-search-8

Once you have saved your new Result source, go to your people search results web part(s) and edit the Query.  Now all you have to do is Select your new result source and then your Query text can return to just being the searchboxquery.
limiting-people-search-9

About Nick Hurst (84 Articles)
SharePoint and Nintex developer who strives to find easy to deploy and maintain solutions for business problems.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: