SearchContext.GetContext 方法 (SPSite)

请注意:此 API 现在已过时。

获取指定的SPSite对象的搜索上下文实例。

命名空间:  Microsoft.Office.Server.Search.Administration
程序集:  Microsoft.Office.Server.Search(位于 Microsoft.Office.Server.Search.dll 中)

语法

声明
<ObsoleteAttribute("This class is obsolete now. Please use SearchServiceApplication and SearchServiceApplicationProxy instead.")> _
Public Shared Function GetContext ( _
    site As SPSite _
) As SearchContext
用法
Dim site As SPSite
Dim returnValue As SearchContext

returnValue = SearchContext.GetContext(site)
[ObsoleteAttribute("This class is obsolete now. Please use SearchServiceApplication and SearchServiceApplicationProxy instead.")]
public static SearchContext GetContext(
    SPSite site
)

参数

返回值

类型:Microsoft.Office.Server.Search.Administration.SearchContext
一个SearchContext对象。

备注

如果在检索搜索上下文的GetContext方法中指定的SPSite对象,我们建议您的代码实例化中使用的SPSite对象不再需要后,会释放语句来确保对象。请参见示例部分中的代码。

有关SearchContext类和SharePoint 企业级搜索的管理对象模型的详细信息,请参阅Getting Started with the Search Administration Object ModelHow to: Return the Search Context for the Search Service Provider

示例

[C#]

SearchContext context;
using (SPSite site = new SPSite("http://yourSiteName"))
{
     context = SearchContext.GetContext(site);

}

另请参阅

引用

SearchContext 类

SearchContext 成员

GetContext 重载

Microsoft.Office.Server.Search.Administration 命名空间