What is the search range? When we use Baidu, we can see them. To help you find the desired content more accurately, you can define some search scopes so that you can tell the search engine the scope of the content you want to search, to get more accurate results.
The built-in search function of SharePoint Server 2010 also supports search range. SharePoint 2010 has two built-in search scopes: "All websites" and "people ". The former includes all content in all content sources, and the latter only contains all users (from the user configuration file ). If necessary, the administrator can add additional search scopes to help users search for desired content more conveniently.
To create a custom search range and display it in the SharePoint 2010 search center, some additional settings are required. This article shows how to add a "Word Document" search range for the SharePoint 2010 system and enable users to search word documents through the search center.
(1) Add a search range in the search service application
Open the SharePoint 2010 management center and open the search management interface through "manage Service Application-search service application. Click the "range" link on the left side of the search management page, and then click "create range ".
Name the new range "Word Document" and enter "wordresults. aspx" on the target result page. Don't worry. We will create this page in the search center website later. This page is used to display the search results of the "Word Document" search range.
Next, add rules for the range of "Word documents. A rule defines which search results belong to a specific search range. There are multiple types of rules. You can use URL matching (for example, the content in a path belongs to a certain range) or attributes (for example, any content whose author is equivalent to kaneboy belongs to a certain range ), or the content source (for example, the content from a BCS external data content source belongs to a certain range) to define the rule.
Because the files with the extension names of Doc. docsion and Doc. docx appear in the Word document search range, you need to define a rule for the attribute Query Class and add an attribute query condition of "fileextension = docx. In the rule action, select "include ". For example, add a "fileextension = Doc" Rule for the "Word Document" range. Define the search range settings interface for these two rules, as shown in.
The SharePoint 2010 Search Service regularly updates the range settings. To make the modified range settings take effect immediately, click the "Start update now" link on the search Management Homepage.
To make the new search range available, you can completely crawl all content sources after defining the range.
(2) centralized use of search scope on websites
In the website set, you can directly use the scope defined in the search service application. Go to the website settings page of the website set top-level website, and click the "search range" link in the "website set management" area to see the previously defined "Word Document" range.
Click "display group" to see the "Search drop-down list" and "Advanced Search" groups. Edit them separately and include the "Word Document" range.
Click "Search Settings" in the "website set management" area on the website settings page to go to the "website set Search Settings" page. By entering the path of a search center website in the "website set search center", you can connect the search of a website set to a search center. For example, if you use the "Search" path and "enterprise search center" template in this website set to create a search center website, you can enter "Search/pages" in the "website set search center" text box. In this way, when users use the search function in the website set, they will be automatically directed to the search center.
The "website set search drop-down list mode" is used to determine whether the drop-down list is displayed on the left side of the search box of the website set. If you select "display range drop-down list", the range drop-down box is displayed on the left side of the search box.
After completing these settings, go back to the website homepage and you will see how these settings affect the search function in the website set.
Finally, because the specified website set will be connected to the search center website with the path "Search", we will create this search center website.
(3) use the search range on the search center website
First, we need to use the "Enterprise Search Center" template in the website set on the specified "Search" path (to match the path specified in the website set settings) create a search center website.
Open the new search center website and you will see that the defined "Word Document" range does not appear here.
On the "All website content" page of the search center website, you can see two key lists on this website, "tabs in search results" and "tabs in search pages ".
Open the "tab" list on the search page, add a new project, enter "Word Document" in the "tab name", and enter "wordsearch. aspx "(don't worry, we will create this page later ).
For example, add a new project to the "tab in search results" list. The "tab name" is set to "Word Document" and the "page" is set to "wordresults. aspx "(we will create it later ).
Then we will create the previously specified "wordsearch. aspx" and "wordresults. aspx" pages. The former is the page used for searching, and the latter is the page used to display the search results.
Open the "page" document library on the search center website and click "create document-page" in the ribbon area ".
Specify a title for the new page, "Search for Word documents", set the URL of the page to "wordsearch. aspx" (corresponding to the previously specified path), and select "search box" for the page layout ".
For example, create 2nd pages with the title "Word document search result", the URL of the page is "wordresults. aspx", and the page layout is "search result ".
After creating the "wordsearch. aspx" and "wordresults. aspx" pages, you also need to set them. Open the "wordsearch. aspx" Page, enter the editing status, and then edit the properties of the "search box" Web part.
Change the value of the URL attribute of the "target search result page" of the "search box" Web part to "wordresults. aspx ". In this way, the user will send the search request to the "wordresults. aspx" page only when searching on the current page.
Then open "wordresults. on the "aspx" Page, go to the editing status, modify the "search box" Web part on the page, and change the value of the "target search result page url" attribute to "wordresults. aspx "(that is, the current page ).
Then, modify the attributes of the "Search core result" Web part on the page.
Modify the "range" attribute of the "Search core result" Web part to the specified "word" document range.
In this way, the two pages are modified. Remember to check them into the main version, otherwise normal users will not be able to access them.
Go back to the homepage of the search center website and you will see that there is a third scope, "Word document ". When you click this range, the page will actually jump to the "wordsearch. aspx" page. When you use this range for search, the search results are displayed on the "wordresults. aspx" page.
In addition to the search center website, when searching in the website set, because the website set search is connected to the search center website, users' search requests will also be directed to the search center website.
Summary
By defining a custom search range, you can use the search function provided by Sharepoint 2010 more conveniently. However, to make the custom search range work properly, the administrator needs to set a series of settings in the search service application, website set, and search center website.