Gets the search context instance for the specified SPSite object.
命名空间: Microsoft.Office.Server.Search.Administration
程序集: Microsoft.Office.Server.Search (在 microsoft.office.server.search.dll 中)
语法
声明
Public Shared Function GetContext ( _
site As SPSite _
) As SearchContext
用法
Dim site As SPSite
Dim returnValue As SearchContext
returnValue = SearchContext.GetContext(site)
public static SearchContext GetContext (
SPSite site
)
参数
- site
返回值
A SearchContext object.
备注
If you specify an SPSite object in the GetContext method to retrieve the search context, we recommend that your code instantiates the SPSite object within a using statement to ensure the object is released once it's no longer needed. See code in the Example section.
For more information about the SearchContext class and the 企业级搜索 Administration object model, see 企业级搜索管理对象模型入门 and 如何:返回搜索服务提供程序的搜索上下文.
示例
[C#]
SearchContext context;
using (SPSite site = new SPSite("http://yourSiteName"))
{
context = SearchContext.GetContext(site);
}
另请参阅
参考
SearchContext 类
SearchContext 成员
Microsoft.Office.Server.Search.Administration 命名空间