Search Result Sources are a great way to define the type of sources of data that get returned from a search. In this post, I will show how to remove OneDrive content from search results.
To get started, go to the SharePoint admin center in Office 365 and select “search” then “Manage Results Sources”

Create a new Result Source. Your query transform should look like this if you want to remove OneDrive results.

The key is the part of the query that subtracts a path. So to remove OneDrive, use the -path:https://…/personal. Next, save your new Result Source and then make sure you get the sourceid from the url of your new result source (in the path of your browser.) It is a GUID.

Now you can create search experiences that target the new results source that you have created. For example, if I can write code in my search web part that targets the new result source like this…

Happy coding!