How to use Boolean Operators in SharePoint Search
Today I want to introduce you to a trick that I hope will make your SharePoint search results more relevant. As you migrate all the content from file shares and other cloud platforms, SharePoint becomes THE go-to place for all the documents, knowledge base Wikis, and other content. And given the exponentially growing amount of content, it becomes super important to find exactly what you are looking for. So with this post, I would like to introduce you to Boolean Operators in SharePoint search and explain how they can improve your SharePoint Search experience.
What are Boolean Operators?
In simple words, Boolean Operators are words that connect other words (keywords). The most basic Boolean operators are AND, OR, NOT. Reference this post from MIT for a helpful explanation.
- AND: searches content for the presence of both Keyword 1 and Keyword 2 (both must be present)
- OR: searches content for either Keyword 1 or Keyword 2 (any must be present)
- NOT: searches content that contains Keyword 1 but does not contain Keyword 2 (just Keyword 1 should be present)
Example
Say the document contains keywords Red and White.
- Scenario 1: When you search for Red AND White, it will find the document, because both words are present in a document
- Scenario 2: When you search for Red OR White, it will again find the document, because any of the words are present in the document
- Scenario 3: When you search for Red NOT White, it won’t find a document, because the document contains the word “White”
What does SharePoint Search
Before I explain how Boolean Operators work in the context of SharePoint, it is important to understand how SharePoint search works. When you type a keyword into a search box in SharePoint, it searches the following:
- File Name
- Folder Name
- Metadata
- The text inside of the documents
The reason I mentioned the above is that when we search for keywords in SharePoint, it could search any of the fields. So, in other words, using the examples above, Keywords could apply to the File Name or Text inside of the document or Metadata.
Boolean Operators in SharePoint Search
Important Notes
- Operators themselves (AND, OR, NOT) need to be typed in CAPITAL letters
- Keywords (words connected by operators) can be a file name, folder name, metadata, text inside of the documents (per the above)
- Boolean Operators can be used in any Search Box in SharePoint/Office 365 (library-level, site level, Hub Level, SharePoint Start Page, Office 365 Portal Page, OneDrive Search box)
Examples
To demonstrate Boolean Operators in SharePoint Search, I will use a Document Library with a few files:
- Document 1 includes 3 keywords: Red, White, Blue
- Document 2 includes 2 keywords: Red, White
- Document 3 includes 1 keyword: Blue
Scenario 1: AND
Only 1 document contains both of the keywords, so the result above is expected
Scenario 2: OR
All 3 documents happen to have either of the keywords, so all 3 come up
Scenario 3: NOT
Only 1 document contains the keyword Red without containing the keyword Blue