Manipulating SharePoint 2010 Search Results using the URL

SharePoint 2010 has made some great improvements around search. One of these improvements is in regards to to how search queries are passed through the URL. If you perform a search you can look at the URL it generates in order to get a general idea of how the query works.

You may want to manipulate search queries from a custom search form, or even a static link from within SharePoint. Here is a quick summary of how you can create your own search query by manipulating the URL.

 

Include any of the terms: ANY(term1 term2)

Include all of the terms: ALL(term3 term4)

Include none of the terms: NONE(term5 term6)

Include a single scope: (scope:”scope1”)

Include multiple scopes: (scope:”scope1” OR scope:“scope2”)

Include a single refinement: r=refinementname=”refinementvalue”

Include multiple refinements: r=refinementname1=”refinementvalue1” refinementname2=”refinementvalue2”

 

Example URL: results.aspx?k=ANY(term1)NONE(term5)(scope:”scope1”)&r=refinementname=”refinementvalue”

 

You many see SharePoint change the search URL slightly by encoding some of the special characters. Here are some URL encoded characters you may come across.

Character Encoded Value
$ %24
& %26
: %3A
; %3B
= %3D
? %3F
@ %40
%22
< %3C
> %3E
% %25
( %28
) %29
{ %7B
} %7D
| %7C
\ %5C
~ %7E
[ %91
] %93
# %23
+ %2B