Remove specific people from people search results in SharePoint

Note: Screenshots and steps from a 2016 environment

There may be times when you have AD accounts showing up in search results that you can’t delete, but need to hide from results. The following sections will guide you through removing specific profiles from your people search results.

Steps:

  1. Create a mapped property for user profiles
  2. Use the new property at least once
    • Start a full crawl of people source
  3. Create a managed property mapped to your new user property
    • Start a full crawl of site source
  4. Edit the query on the people search results page
  5. (optional) If you have “People Results” as “Promoted Results” or “Ranked Result Blocks”

1. Create a mapped property for user profiles

From Central admin, click on “Manage service applications”

Select “user profile service application”

Click “Manage User Properties” under “People”

Select “New Property”

Set the new properties settings as follows:

  • Name and display name: RemoveFromPeopleSearch
  • Policy Setting: Optional
  • Default Privacy Setting: Everyone
  • Search settings, Alias: checked
Click to enlarge

Click OK.

2. Use the new property at least once

For the rest to work, you’ll need to mark at least one user profile to not show up in search. I did this by adding a “1” to the property we just created for a user I wished to remove from results.

Back under “User profile service application” (Central admin –> Manage service applications –> “User profile service application”) click on “Manage user profiles.”

Search for and edit the profile of who you’d like to remove from search results.

Start a full crawl of your people content source.

3. Create a managed property mapped to your new user property

Once the crawl is complete, go back to Central Admin home and select “Manage service applications.”

Select “Search service application”

Select “Search schema” from the left under “Queries and Results”

Select “New managed property”

Name it RemoveFromPeopleSearch and check “Queryable” and “Retrievable”

Click to enlarge

Scroll down and click “Add a mapping,” search for “remove” and add our new user property.

Click to enlarge

Click OK

This time, start a full crawl of your SITE content source.

4. Edit the query on the people search results page

Once your crawl is finished (may take a while), you’ll want to go to your people search results page and “Edit page.”

Click to enlarge

Edit the “Results” web part

In the menu that appears on the right, select “Change Query.”

If you’re not in advanced mode, switch to advanced mode. Then expand the “property filter” dropdown and select “show all managed properties.”

Try the dropdown again, and now you’ll see your new property listed. Select it and click “OK

Set properties as follows and click “Add property filter”

Click OK

Click “Apply” on the web part menu

Click “Save” and publish (if checked out)

5. (optional) If you have “People Results” as “Promoted Results” or “Ranked Result Blocks”

If you have people results outside your regular people search (such as a promoted result block in Local SharePoint Results) you’ll just need to be sure to also add the RemoveFromPeopleSearch<>1 string to the end of your query rule’s query.

Query rules can be accessed through central admin (manage service applications –> search service application –> query rules) or from Site Settings –> Query rules depending on where you initially setup your query rules/promoted results.

Edit the query rule in question, click “edit” next to the result block that’s relevant, then “Launch Query Builder” to be able to add the RemoveFromPeopleSearch<>1 string to your query.

Manually start a full or incremental crawl of an on-prem content source in SharePoint

From central admin, click “Manage service applications” under “Application Management”

Select the “Search service application”

Select “Content sources” from the left under “Crawling”

Select the drop-down for the content source you’re crawling and choose either a full or incremental crawl.

How to promote/feature a search result based on user query in SharePoint

If someone searches in SharePoint for “Power BI,” chances are they aren’t looking for a document from 2016 that happens to mention the phrase “Power BI.”

Using out-of-the-box search reports you can come to understand what phrases are being searched (and abandoned) on your intranet, then improve search by promoting/suggesting results you think your users are actually seeking.

I’m going to use my “Power BI” example. If a user searches Power BI on my dev environment, they get these as the top three results. The first two are SharePoint link lists (like promoted links or otherwise) and the third is just a document about embedding Power BI reports. None take you

Let’s make it easier to get directly to our app.powerbi.com portal when searched on the intranet.

  1. Go to central admin –> Manage service applications
  2. Select “Search service application”
  3. Select Query Rules from the left nav
  4. Select “Local SharePoint Results” from the first dropdown
  5. Click “New Query Rule”
  6. Name the rule and enter semi-colon separated phrases you want to trigger our promoted result
  7. Click “Add promoted result”
  8. Complete the form, keeping in mind that the “Title” and “Description” are what will appear in results when searched. Click Save.
  9. Click Save again. Changes are immediate, and your promoted result will appear FIRST in results with a checkmark icon to indicate it’s promoted/suggested
  10. Test your search

Note: If you use SharePoint Online, your navigation to the query rules is a bit different but still starts in central admin. The rest of the steps are the same.

Add Bing search results to SharePoint results

Want to make your “search everything” really search everything? Add bing results to your SharePoint search results. You can do this as a result block (added to your results column) or as a separate results column as seen in the example at the bottom of this post.

Bing supports OpenSearch protocol while Google does not. This allows us to utilize Bing’s search engine from within our SharePoint environments (server or online). If you’re using SharePoint Server (on-prem), you’ll need to provide a proxy server for crawling and federation in central admin –> search administration.

The rest of the steps are the same for either online or on-prem:

  1. Create result source
  2. Create query rule

And you can do a similar process for a single site collection (through site collection settings) but I’ll be demonstrating this through central admin (for all site collections).

Create result source

  1. From central admin –> search administration, click on “Result sources” under “Queries and Results”
  2. Click “New Result Source”
  3. Set the settings as follows, pasting https://www.bing.com/search?q={searchTerms}&format=rss&Market=en-us for the Source URL.
  4. Leave credentials as “anonymous” and click “Save”

Create query rule

  1. Click on “Query Rules” from the left nav in Search Administration
  2. Set context to “Local SharePoint Results” and click “New Query Rule”
  3. Name it “Bing Query Rule” and click “Remove Condition” since we want Bing to be included in every query
  4. Click “Add Result Block” and set as follows:

Optional settings:

  • You can set the “context” settings to apply this rule to ALL result sources, or just to the Local SharePoint Results (default)
  • You can edit the result block so that a “more” link appears. Link it to https://www.bing.com/search?q={subjectTerms} to allow users to leave SharePoint and see even more results from Bing
  • Choose whether you want the “Bing results” block to appear at the top of SharePoint results or ranked. I recommend ranked if you’re only wishing to supplement your search for the occasional user who thinks SharePoint search is internet search.

Implementation

There are too many ways to implement this new result source to share here, but use your imagination. Each “search results” web part can be configured to use or ignore query rules.

In this example, we’re using query rules and promoting the top two bing results to the top of our SharePoint results with a “more” link that would take us out to Bing. This method requires the result source and query rule.

In this example, we’ve created a third column on our search results page that shows the top Bing results alongside our top SharePoint results. You don’t need a query rule for this, just the added result source and a separate web part.

So finally “Search everything” can really “search everything.”

Import a synonym thesaurus to improve search in SharePoint server

Health care or healthcare? Doctor or physician? Emergency room or ER?

No matter which terms, spellings or abbreviations a SharePoint search user uses, they’re searching for something specific. By utilizing a simple thesaurus, we can make sure that a user searching for “ER” also gets results that include “emergency room.”

How to create a thesaurus

Note: Not currently available in SharePoint online/O365. But should be supported in 2013/2016/2019. 

What to include

If your industry is like most others, you have many acronyms – that’s a good starting place for building a thesaurus. Your thesaurus can contain considerations such as:

  • Acronyms (ER/ED for emergency room/department)
  • Abbreviations (Dr. and doctor)
  • Common misspellings (absess and abscess)
  • Formal and casual pairs (gastric and stomach)
  • Synonyms (purchasing, requisition, ordering, supplies, etc.)
  • Variations of a word (radiology, radiologist, radiologic, radiological)

Once you’ve compiled your basic thesaurus from going through the above suggestions, you should analyze the search reports provided by SharePoint to see what people have been actually searching but not finding. Then use those search terms to further enhance your thesaurus.

For example, when my governance committee analyzed search reports, we came up with people searching for “KU” (our local University and neighboring health system) and added “University of Kansas” to our thesaurus.

Import your completed thesaurus

Note: Each time you import, it overwrites the existing thesaurus. I recommend updating the same file you’ve created with new lines rather than recreating it multiple times. Also be sure to save the file in a place others can access and update in your absence. You won’t be able to export it later.

Repeat these steps each time you want to update the thesaurus:

Note: You must be a search service application administrator to import the thesaurus.

Log in to a SharePoint server and run PowerShell with the SharePoint snap-in or just use the SharePoint management shell (recommended). Either way, run as administrator.

Run the following cmdlets

$searchApp = Get-SPEnterpriseSearchServiceApplication 
Import-SPEnterpriseSearchThesaurus -SearchApplication $searchApp -Filename <Full UNC Path>

If successful, you’ll see the following confirmation:

Test your work!

The changes should be almost instant, with no need to perform any crawls. Here’s an example of how in our search “med staff” now also searches for “medical staff”.

Governance activity: analyze SharePoint search reports and provide synonyms

I have an outstanding group of forward-thinking, hard-working volunteers who gather monthly to discuss ways in which we can improve our implementation and utilization of SharePoint at LMH Health. Tomorrow is our last meeting of the year, and we’ll be spending the majority of our meeting poring over abandoned search queries and “no result” queries provided to us by the out-of-the-box SharePoint usage and popularity reports.

Is it worth the time?

Absolutely. No matter how big your company is, investing time in improving search – even if it will only save a searcher 5 seconds – is the logical action from both a financial and efficiency standpoint. Here are some real-world stats from LMH Health (a relatively small health system) to further convince you:

  • 19% of our annual SharePoint site visits are from someone performing a search query
  • That’s 18,972 searches per year, or about 75 each day
  • If each search takes thirty seconds, we spend 158 hours searching annually
  • If we play with a $20/hr wage, we would be spending $3160/year searching or $0.17 per search
  • If we can improve search so that we reduce that thirty seconds to twenty seconds, we’ll save 52.7 hours and $1054/year
Annual costs and savings scenario of SharePoint search times

So if saving money and time is important to you, this is worth exploring with your governance committee or SharePoint team.

How to get your search analytics/reports

Note: You must be at least a site collection admin to access the search reports.

1. Go to Site Settings –> “Popularity and Search Reports” under Site Collection Administration

2. I recommend the three reports below (all queries by month except “Query rule”) for a high-level overview with which your committee will be able to assist.

Note: You could individually use the Query Rule report to analyze the success (or lack thereof) of any query rules you’ve implemented, but I wouldn’t involve your committee in its analysis.

Available search reports as a site collection admin

3. Once those files are downloaded, I’d combine each of the months (each tab of each report is a different month) using Power BI or some excel magic to determine the queries most frequently searched on your site collection (by summing query text counts across tabs)

Engage your governance committee

Now it’s time to present your findings to your committee members. At our meeting we’ll be splitting into groups and each taking a portion of the top abandoned and “no results” queries to determine:

  1. What the searchers were attempting to discover on our intranet using that query text
  2. What synonyms we can come up with to add to a synonym dictionary or query rules to improve search.
    1. Synonym dictionary is installed via PowerShell for on-prem only
    2. Query rules can be on-prem OR hybrid and are a way of promoting certain results based on rules you establish

For my group, I’m using two files: a search thesaurus worksheet and a search analysis worksheet. 

Search thesaurus

This is the “blank slate” I’ll be sharing with each group, challenging them to fill the rest of the rows with words they use that often don’t bring up the correct result because the actual result is using a variation of the query

Search analysis

The second worksheet is focused on analyzing actual, real search queries you collected from the SharePoint search reports. Pick the highest occurring results from the abandoned and “no result” reports and include them in the tables. Have your committee speculate as to what the desired resource actually was and provide alternative names/words so that you can build rules and/or synonyms around it.

Conclusion and follow-up

Always follow up on governance tasks and finish your part of the work before your next meeting. Then you can share the results/impact with your members, celebrating your collaboration.

Once we’re finished with this activity tomorrow, I’ll collect the results and add appropriate suggestions to our synonym dictionary we deploy via PowerShell. There may also be suggestions made that would make great query rules.

For example, if one of your “top queries” is consistently “Dress code,” maybe you’ll create a query rule that provides the actual (and hopefully only) dress code policy at the top of results in its own promote block.

An effective governance committee is one that is put to use. Leverage your organization’s knowledge and inspire your members to be daily advocates for your digital workplace. It’s as much theirs as yours, and we make it better by building it for and with the users.

How to manually start crawls and reindex SharePoint content

After you’ve made changes to managed metadata or the search schema you may wish to re-crawl your content sooner than the next scheduled crawl. You can do this across all site collections (on-prem/server), one site at a time (O365 or on-prem) or individual lists and libraries (O365 or on-prem).

Continue reading “How to manually start crawls and reindex SharePoint content”

A better way to display “today’s events” from multiple calendars in SharePoint on your intranet home page

today at LMH

Below on the left are two traditional, out-of-the-box solutions for showing Today’s events in SharePoint. Notice how both take up a lot of extra space repeating today’s date (which we don’t need to see at all in a web part called “Today’s Events”) or showing gray space where there are no events. Soak that in – prime real estate on your home page goes to non-existent events. These also may require overlays and other manual labor processes that need adjusted every time a calendar is added or removed.

But on the right is what you could have. It uses search instead and displays events from all calendars a user has access to in one place. It shows only the necessary information on the home page and links to full details. And with a little CSS included in this post, it can look polished and themed. Imagine all you could do with that saved space on your home page…

Also seen above: Adding local weather to your SharePoint intranet home page
and a “this week’s menu” button for your intranet

Continue reading “A better way to display “today’s events” from multiple calendars in SharePoint on your intranet home page”

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.

Continue reading “Including or excluding multiple property filters in SharePoint search results web part query”