Use Querystring to define result source for searching

I am migrating a site from SP2010 to SP2013. One of page contain a search result webpart. By define the querystring like this:

SearchResult.aspx?k=Scope:Hotnews

It will return only the defined scope results.

However, SP2013 no longer provide Scope. Can I perform similiar trick with querystring? I have setup a Result Source "Hotnews" on my SP2013 farm. But I don't know the syntax in querystring or is it even supported. Could you please guide me? Thanks.

June 10th, 2014 2:41am

Hi  Mark,

According to your description, my understanding is that you want to set the result source of your search result web part to a custom result source "Hotnews" in SharePoint Server 2013.

For achieving  your demand, you can limit search results of your search result web part as below shows:


Reference: http://techmikael.blogspot.com/2013/04/limiting-search-results-in-sharepoint.html

Also you can have a look at these blogs:

http://www.eliostruyf.com/dynamically-changing-result-source-sharepoint-2013-search-center/

http://blog.mastykarz.nl/programmatically-working-keyword-search-queries-sharepoint-2013/

http://technologybooth.blogspot.com/2013/08/keyword-query-in-sharepoint-2013.html

Thanks,

Eric

Forum Support

Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

Free Windows Admin Tool Kit Click here and download it now
June 10th, 2014 8:19am

I have no problem to setup Result source. I need a way to let user dynamic query the result source by several managed properties.

For example, we have two managed property "FoodCategory" and "CookCategory". There is a page with two dropdown menu. Users can pick a value on these two dropdownmenu and click search. It will redirect user to a URL like:

http://sp/results.aspx?FoodCategory=C01&CookCategory=C02

It is fair easy to achieve in SP2010 but I don't know how to make it in SP2013.

When I click on the refinement panel, the URL will reflect the selection like:
{"k":"1","r":[{"n":"FoodCategory","t":["\"4c303130e9b699e7b8af\""],"o":"and","m":null,"k":false}]}

It seems my solution but there is a unique ID in the string. It makes the future maintenance and deployment very difficult.

Is SP2013 have OOB method for me search with querystring?

June 11th, 2014 7:22am

Hi,

Did you ever find a solution?  If so, please pass it along.  Thanks.

Free Windows Admin Tool Kit Click here and download it now
April 17th, 2015 10:24am

I wrote a custom webpart to handle the search.
April 26th, 2015 10:11pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics