SharePoint Search Query Syntax

 1. LIKE VALUE
WHERE <column> LIKE <wildcard_literal>
%,_,[ ],[^ ]
Usage:-

comp%r matches “comp” followed by zero or more of any characters, ending in an “r”.

comp_ter matches “comp”  followed by exactly one of any character, followed by “ter”.

comp[a-z]re matches “comp” followed by a single character in the range of lowercase a through lowercase z, followed by “re”.

comp[ao] matches “comp” followed by a single character that must be either a lowercase a or a lowercase o

comp[^u] matches “comp” followed by any single character that is not a lowercase u.

2. LITERAL VALUE
WHERE <column> <comp_op> <literal>
=,!=,<>,>=,=<,<
WHERE MetaDataProperty = FALSE

3. NULL Predicate
WHERE <column> IS [NOT] NULL

WHERE Title IS NULL

4. DATE FUNCTION
DATEADD (DateTimeUnits, OffsetValue, DateTime)
WHERE LastModifiedTime <=DATEADD (DAY, -5, GETGMTDATE())
WHERE LastModifiedTime <=DATEADD (DAY, -2, DATEADD (HOUR, -4, GETGMTDATE()))
This can be one of  YEAR,QUARTER,MONTH,WEEK,DAY,HOUR,MINUTE,SECOND
Note : This value is case-sensitive.

5. ORDER BY
ORDER BY <column> [<direction>] [,<column> [<direction>]]
…ORDER BY A ASC, B, C, D DESC, E, F, G ASC

6. FREETEXT
WHERE FREETEXT('computer software hardware')
WHERE FREETEXT(DEFAULTPROPERTIES, 'hardware store -computer')
   Note:search terms "hardware" and "store", and do not contain the search term "computer".
7. CONTAINS
WHERE CONTAINS ('computer')
WHERE CONTAINS ('computer software')
WHERE CONTAINS ('"compu*"')
WHERE CONTAINS ('computer' AND 'software')
WHERE CONTAINS ('computer' NEAR 'software')
8. Search URL Syntax
k=Keyword
s=Scope
v=relevance or date
start=Page number
Known Issues

1. Like statement is limited to 64 characters

2. Path managed property. In you case just do CONTAINS(Path,’http://servername/sitename/listname/folder‘).”

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s