SharePoint’s support for REST (query string parameters) on the search.aspx (Portal Server Search/Search Results Page) is very powerful. However, once you get past the basics of passing it a search string (k … short for keywords) the documentation gets a bit fuzzy. Here’s one thing that I was able to do with search.aspx…
First, a few parameters…
||Keywords – General Search
||Type of document (I’ve found Person and Document very handy.)
||Scope — Think Search Scopes from the search drop-down list
||Property — Any of the custom properties that SharePoint indexes. IFilters put these in.
||Date — apparently required when you’re searching for properties
So the next bit is how to encode the properties. Here are a few ASCII/Hex Codes you may need
||# (Hash, Pound, etc.)
So if you want to search for the word ‘spacey’ in any text in a document in a search scope named fuzzy you would have a URL like: http://server/search.aspx?tp=Document&s=fuzzy&k=spacey
It gets a tad bit more complicated when you want to search only in a property not in the full text. First, you have to find the property you want in Manage Properties, and then you have to setup the search … When you add the property to the search you have to add a single character specifier indicating the type of the property before you start it’s name — mostly you’re dealing with Strings so ‘S’ is appropriate. Then you have to put commas after the property name the keyword Contains and another comma — all encoded of course. Next, once I search for a property I have to add a date specifier to the query. The title property is really urn:schemas.microsoft.com:fulltextquery.displaytitle. So if I wanted to find the same thing in only the title property I’d do this: http://server/search.aspx?tp=Document&s=fuzzy&pt=Surn%3aschemas%2emicrosoft%2ecom%3afulltextqueryinfo%3adisplaytitle%2cContains%2cSpacey&2cAnd%2c&d=All
Clear as mud right? It’s not that bad, basically describing the property and url encoding all of the special characters makes it look ugly. If it weren’t encoded it would look like this..http://server/scope.aspx?tp=Document&s=fuzzy&pt=Surn:schemas.microsoft.com:fulltextqueryinfo:displaytitle,Contains,Spacey,And,&d=All still not pretty but certainly much more readable.
I hope this helps when you want to be able to create links to property searches.