How to use advanced search

To get more relevant search suggestions, you can either narrow down your search results using wildcards or search using Boolean or/or relationship operators. These are described below.

Search with wildcards

  1. You can use asterisk (*) to search for parts of words.
  2. * 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.
  3. 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:

  1. AND
    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
  2. OR
    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
  3. NOT
    Finds all the matches that have the first but NOT the second word (the order of the words are important).
    Syntax: phrase1 NOT phrase2
  4. ( and )
    To make more advanced searches, parentheses can be used, just as in mathematics world.
    Example: (SharePoint AND Document Management) NOT (Extranet AND Intranet)
  5. NEAR
    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.
  6. ONEAR
    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

  1. 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)
  2. No spaces may be used between the document properties, the operator, and the search phases.
  3. 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 and they can all be used directly without any configuration:

Document propertySharePoint’s predefined search propertyExampleComments
Created byCreatedBycreatedby:”john smith”Who created/uploaded the documents.
Modified byModifiedBymodifiedby:”john smith”Who last edited the documents.
CreatedCreatedcreated>2013-02-14When the documents were created.
ModifiedLastModifiedTimelastmodifiedtime>2013-02-14When the documents were last edited.
Document nameFilenamefilename:agendaNOTE: the file extension is not required!
File typeFiletypefiletype:pptx
AuthorAuthorauthor:“john smith“The documents’ author (not the same as created by or modified).
File sizeSizesize>1000000Note: defined in bytes!
TitleTitletitle:protocolThe documents’ title (not their filenames/ document names).
PathPathpath:”https://contoso-my.sharepoint.com”The documents’ path, in the example on the left, only showing documents that are stored in OneDrive.

All custom properties can also 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<>””.

For columns that contain text you can however create a search query that excludes everything that starts with a specific character, e.g. a…z and 0…9.

If you, e.g. want to find all document’s whose Title field does not have any value, then use this query:

NOT(title:(a* OR b* OR c* OR d* OR e* OR f* OR g* OR h* OR i* OR j* OR k* OR l* OR m* OR n* OR o* OR p* OR q* OR r* OR s* OR t* OR u* OR v* OR w* OR x* OR y* OR z* OR 1* OR 2* OR 3* OR 4* OR 5* OR 6* OR 7* OR 8* OR 9* OR 0*))

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”.

For date fields you can e.g. search for all documents that are not larger than a specific date, e.g. 1900-01-01 by using this query:

NOT date>="1900-01-01”