Wednesday, November 05, 2008

Limiting Search Scope to Wiki Page Library(Document Library) AND Hiding Scope Drop Down

Hi,

I want to search a single Wiki Page Library(or Document Library) and I want to hide the Scope DropDown in UI.

For this, I found some solutions:

1)Create a Wiki Page Library(or Document Library) and note down the URL for later use.(For ex: "http://idc-dk-is:44510/sites/TestSite/WikiPageLibrary", Don't forget to remove the "/Forms/AllPages.aspx" from the URL).

2)Open SharePoint Designer and Open your master page where youwant to include this search.

3) From the main Menu, select "Task Panes" and Check/Select "Web Parts". It will open "Web Parts" task pane on the right hand side of the designer.

4) From the "Web Part List", Filter by "Search" and drag and drop "Search Box" web part to your master page.

5) Select "Code" view for the master page.
To hide the Scope Drop Down, set the following property:
<DropDownModeEx xmlns="urn:schemas-microsoft-com:SearchBoxEx">HideScopeDD

6) To specify search in the specific document library, you need to set two properties, "AppendToQuery" to false and "AppQueryTerms" to the Document Library Url (from step 1) as follows in the Search Webpart.

In spswc:searchboxex, AppendToQuery="false" AppQueryTerms="site:http://idc-dk-is:44510/sites/TestSite/WikiPageLibrary"


Another Solution:


1) Follow the Step 1 specified above to create Wiki Page Library

2)Create a Search Scope For the Document Library and note down the Scope name(For example: WikiSearch with scope rule ( Type = Web Address and Web Address = Folder,"http://idc-dk-is:44510/sites/TestSite/WikiPageLibrary")

3)Follow the steps from 2 to 5 specified in above solution.

4)To specify search in the specific document library, you need to set two properties, "AppendToQuery" to false and "AppQueryTerms" to "Scope:DocLibrarySearchScopeName" as follows.

In spswc:searchboxex webpart,
AppendToQuery="false" AppQueryTerms
Scope:WikiSearch"

Save the modified Master Page and publish it to see the Search returning results from the Doc Library only.

Happy Searching...
Yasovardhan.

3 comments:

HelloSharePoint said...

In case your scope name has spaces:

AppQueryTerms="Scope:&quot;My Scope&quot;"

HelloSharePoint

Derek said...

You....


ROCK!


Thanks! I've been banging my head on my desk with this problem for hours. The scope option works great!

Eric Fontaine said...

Great post, I didn't find how to force the scope with the AppQueryTerms anywhere.

Thank you for this post!

Éric