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 or +
    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
    Syntax 2: phrase1 + 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 or
    Finds all the matches that have the first but NOT the second word (the order of the words are important).
    Syntax 1: phrase1 NOT phrase2
    Syntax 2: phrase1 phrase2 (note that there should be no space between the minus character and the phrase)
  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, e.g. a date or number)
    • > (greater than, e.g. greater than a date or number)
    • <= (less than or equal to, e.g. a date or number)
    • >= (greater than or equal to, e.g. a date or number)
    • .. (between values, e.g. dates or numbers)
  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).
Content typeSPContentTypeSPContentType=”Financial document”
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 for dates 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)

You can also create dynamic date searches using relative words such as “today” and “this year”. These can be good to have when bookmarking today’s created documents. These are the names of these date intervals:

  • today, e.g. created=today
  • yesterday, e.g. created=yesterday
  • this week, e.g. created=”this week”
  • this month, e.g. created=”this month”
  • last month, e.g. created=”last month”
  • this year, e.g. created=”this year”
  • last year, e.g. created=”last year”

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 specific 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 have or do not have values in document properties

To search for documents that have or do not have a value in a certain text type document property (e.g. managed metadata, single line of text, people or group & choice), you can use the wildcard operator.

If you want to search for all documents whose documents property, e.g. title, has a value (not empty), you can search using this syntax:

title:*

If you want to search for all documents whose title do not have a value (is empty), you can search using this syntax:

NOT title:*"

Or

-title:*

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

Search for documents that are of a certain content type

If you want to search for a documents that are of a specific content type you can use SharePoint’s predefined search property, SPContentType, as described in the section Search with relationship operators above. You can however also search for all documents that are of a content type that inherit from a parent content type. Instead of searching for the parent content type’s name you need to use the ID of the parent content type and search according to this syntax: ContentTypeId:[ID of content type]*. Note the wildcard at the end.

ContentTypeId:0x01010068B322AF3C401E459F41BAFF19469D61*