To get more relevant search suggestions, you can either narrow down your search results using search refiners, search using Boolean or/or relationship operators and also use wildcards. These are described below.
Use search refiners
Search refiners for custom metadata fields are only available if a customized search results page has been created in your Office 365 tenant:
- The search results can be narrowed by clicking on the various refinements that appear to the left of the search results list. For example, the user can refine the results on file type, document type, modified by, etc.:
- The values shown under the each refinement header are those that are used in the document search list (maximum 15 values per refinement) and those used most frequently are shown on the top of the refinement.
- If the search-page lacks refinements they can be added to a custom search results page, by an administrator.
Search with wildcards
- You can use asterisk (*) to search for parts of words.
- * must be used at the end of a word, not in the beginning.
- micro* finds documents that contain Microsoft or microchip.
- *soft does NOT find documents containing Microsoft.
- By combining * with quotation marks, the search becomes more efficient, for example, “Johan An*” gives more relevant hits than Johan An*.
Search with Boolean operators
All logical expressions (AND, OR, NOT, NEAR, ONEAR) must be written in uppercase, otherwise they are assumed to be normal search phrases. Examples of the most common logical operators:
Finds all the matches that have the first AND the second word (the order of the words is of no importance).
Syntax: phrase1 AND phrase2
Finds all the matches that have the first OR the second word (the order of the words is of no importance).
Syntax: phrase1 OR phrase2
Finds all the matches that have the first but NOT the second word (the order of the words are important).
Syntax: phrase1 NOT phrase2
- ( and )
To make more advanced searches, parentheses can be used, just as in mathematics world.
Example: (SharePoint AND Document Management) NOT (Extranet AND Intranet)
Finds all the matches where the first AND the second word are close to each other (the order of the words is of no importance).
Syntax 1: phrase1 NEAR phrase2
Syntax 2: phrase1 NEAR(n=X) phrase2, where X is the number of words apart. If no n is specified then the default value of X is 8.
Finds all the matches where the first AND the second word are close to each other and that the first word comes before the other.
Syntax 1: phrase1 ONEAR phrase2
Syntax 2: phrase1 ONEAR(n=X) phrase2 where X is the number of words apart. If no n is specified then the default value of X is 8.
Search with relationship operators
- Relationship operators can be used on document properties (metadata):
- : (contains)
- = (equal to)
- <> (not equal to)
- < (less than)
- > (greater than)
- <= (less than or equal to)
- >= (greater than or equal to)
- .. (between the values)
- No spaces may be used between the document properties, the operator, and the search phases.
- Relationship operators can be combined with logical, for example (“wind power” OR “solar cells”) AND (title:innovations OR title:technician).
- Here is a list of the most common predefined document properties:
Document property SharePoint’s predefined search property Example Comments Created by CreatedBy createdby:”john smith” Who created/uploaded the documents. Modified by ModifiedBy modifiedby:”john smith” Who last edited the documents. Created Created created>2013-02-14 When the documents were created. Modified LastModifiedTime lastmodifiedtime>2013-02-14 When the documents were last edited. Document name Filename filename:agenda NOTE: the file extension is not required! File type Filetype filetype:pptx Author Author author:“john smith“ The documents’ author (not the same as created by or modified). File size Size size>1000000 Note: defined in bytes! Title Title title:protocol The documents’ title (not their filenames/ document names).
All of the document properties can be used within the search, but they must first be configured in the search engine
Search using date and time
For a simple date search, it is enough to search using this format: “YYYY-MM-DD”, e.g. “created=2020-02-01”, where:
- YYYY specifies a four-digit year
- MM specifies a two-digit month (01 = January through 12 = December)
- DD specifies a two-digit day of the month (01 through 31)
If you want to be more specific you can also add time and time zone, in this format: “YYYY-MM-DDThh:mm:ss+TZ:00”, e.g. “created=2020-02-01T13:45+01:00”, where:
- T specifies that you want to add a specify a time
- hh specifies a two-digits hour (00 through 23)
- mm specifies a two-digit minute (00 through 59)
- ss specifies a two-digit second (00 through 59)
- TZ specifies the time zone:
- All date/time values are specified according to the UTC (Coordinated Universal Time), also known as GMT (Greenwich Mean Time) time zone.
- If you exclude this part, your search will use the site’s time zone.
- If you want to search using a specific time zone then add, at the end of your query, the time difference between UTC and your time zone in this format: “+TZ:00”, where TZ is the time difference from GMT. In Sweden, e.g. it is: “+02:00”, summer time and “+01:00”, winter time.
You can easily find all documents within a certain range using this format: “created>=YYYY-MM-DD AND created<=YYYY-MM-DD”, e.g.: “created>=2020-01-01 AND created<=2020-03-30” or in this format, if you also want to take the Swedish time-zone into consideration “created>=2020-01-01+01:00 AND created<=2020-03-30+01:00”.
Search for documents that do not have any values in a certain document property
In SharePoint it is not able to search for documents that do not have a value in a certain document property, e.g. by using this search syntax: Tite<>””.
In order to make this possible you instead need need to create a search query that excludes everything that starts with a specific character (a…z) and (0…9). If you want to find all document’s whose Title field does not have any value, then use this query:
NOT(Title:a* OR Title:b* OR Title:c* OR Title:d* OR Title:e* OR Title:f* OR Title:g* OR Title:h* OR Title:i* OR Title:j* OR Title:k* OR Title:l* OR Title:m* OR Title:n* OR Title:o* OR Title:p* OR Title:q* OR Title:r* OR Title:s* OR Title:t* OR Title:u* OR Title:v* OR Title:w* OR Title:x* OR Title:y* OR Title:z* OR Title:1* OR Title:2* OR Title:3* OR Title:4* OR Title:5* OR Title:6* OR Title:7* OR Title:8* OR Title:9* OR Title:0*)
So if you want to search for all documents whose “Document type” is blank, just replace “Title” with “Documenttype”, if “Documenttype” is the search alias for “Document type”.