SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My requirement is to search within sub site, if i am searching within a specific sub site result should come from current sub site. Here everything is working fine. But when I do advanced search it gives result from all site scope.

I can not create scope because we have more then 1000 sub site under one site collection and we have more then 50 site collections.

While I was looking at advanced search web part I don't see option for "Default to contextual scope" simile to search box web part.

I tried to set scope property of core result web part to "This Site" but its not working.

Note: I am not using FAST search

share|improve this question

You have to pass the context url parameter u as query string. Example:**k**=SharePoint&**cs**=This%20List&**u**= 

k = keyword
cs = contextual scope
u = contextual scope url

Here is an example how you can do something similar with JavaScript:

share|improve this answer

I'm using KeywordQuery to Search. Add each column you want returned to the "SelectProperties".

SPWeb site = SPContext.Current.Web;
KeywordQuery keywordQuery = new KeywordQuery(site);

keywordQuery.QueryText = "Search Term";
share|improve this answer
could you please add more details about it. – Waqas Sarwar MCSE Apr 6 at 19:18

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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