6

Is there a javascript way to default search scope for various sub sites.

For example, I have a site collection (Marketing) Under Marketing I have 5 sub-sites

Meeting
Sale
Region
News
Contact

I have created 5 scopes each targeting it's respected sub-site. Now you can only default to one search scope and it's per site collection level.

Is there a javascript code which can sit in the masterpage (head section) to will look at the sub site and default the search scope dropdown to the value pertaining to that subsite?

meaning if user goes to meeting sub site then default the search scope dropdown to Search Meeting scope and so forth

  • you can add a s parameter to the url when loading the page like s=Meeting search scope dropdown takes the value from that parameter on page load – Gintas K Oct 15 '13 at 17:05
1

You can Customize SharePoint search directly in the url

SharePoint 2010 search parameters in the URL:

k

Specify a keyword. Only one key word can be used.

results.aspx?k=sharepoint%20search

s

Specify a search scope. Can contain multiple values separated by %2c.

results.aspx?s=SDKContent results.aspx?s=SDKContent%2cTechnicalArticles

v

Specify the result to sort by: -relevance -date

results.aspx?v=date results.aspx?v=relevance

start Specifying the page Result

results.aspx?start=3

a

Specify the property on which to filter. Ex: Search SharePoint site where the property Companies=Microsoft

results.aspx?k=sharepoint&a=companies:microsoft

u

Specify the url from which the results will appear (without creating a new Scope)

results.aspx?k=sharepoint&u=http://www.contoso.com

Ref MSDN: http://bit.ly/wI75g0

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.