Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

The intent is to allow users to create sites and sub-sites, add document libraries and make the sub-sites searchable. I am thinking I need to create a site template with a custom Search UI page that will search the current site and any sub-sites that exist. I am not sure how to go about coding the search page. What to specify for scope? Any help or pointers are most welcome. Thanks in advance.

Edit: The custom search page will have its own code behind. I'll be invoking the Sharepoint search web service.

Edit: I guess I could get the current site from the URL and when invoking the search web service, in the search query, check if "Path" contains the current site's url. Might get tricky if user searches from a sub-site.

share|improve this question
    
is this 2003, 2007, 2010? WSS or MOSS? –  Dave Wise Apr 12 '11 at 21:46
    
It is MOSS 2007. –  noobDotNet Apr 12 '11 at 22:04

2 Answers 2

Out of the box, most site templates have a "this site" scope on the front page of the site that seems to do exactly what you are looking for. If you want to create your own search results page, you can. The search URL would need to have a cs=This%20Site parameter to scope results to that particular site.

share|improve this answer
    
Thanks. I also found that scope in the scope dropdown but not in the list of scopes in Search Administration. I am going to try adding the parameter in the url but I am not sure if it will search sub-sites. –  noobDotNet Apr 13 '11 at 2:20
    
It will search subsites. –  Sean Earp Apr 13 '11 at 4:08
    
The custom page will have its own code-behind logic. So simply passing a parameter won't work. I am trying to figure out what scope is used when you select "This Site" in the out of the box search box. –  noobDotNet Apr 13 '11 at 16:22

If this is SharePoint 2007/2010 not WSS/Foundation:

  1. Create a new Search Scope

  2. Define a rule to include only your site (e.g. via URL).

  3. Configure your search center results page to display results from the scope you created

share|improve this answer
    
So everytime the user creates a new site, I create a new scope? How will the search page know which scope to use for each user created site? –  noobDotNet Apr 12 '11 at 22:07
    
So you want users to be able to search only current site and all the subsites? Like if I am on /A/B I should be able to Search /A/B and /A/B/B1 and /A/B/C but not /A/A1? –  Toni Frankola Apr 12 '11 at 22:29
    
Right. Only current site and sub-sites if any. –  noobDotNet Apr 13 '11 at 2:14
    
AFAIK not possible OOTB. –  Toni Frankola Apr 13 '11 at 8:00

Your Answer

 
discard

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.