Compartir a través de


: SearchContext.GetContext (Método) (SPSite) (Microsoft.Office.Server.Search.Administration)

Gets the search context instance for the specified SPSite object.

Espacio de nombres:
Ensamblado: Microsoft.Office.Server.Search (in microsoft.office.server.search.dll)

Sintaxis

'Declaración
Public Shared Function GetContext ( _
    site As SPSite _
) As SearchContext
'Uso
Dim site As SPSite
Dim returnValue As SearchContext

returnValue = SearchContext.GetContext(site)
public static SearchContext GetContext (
    SPSite site
)

Parámetros

  • site

Valor devuelto

A SearchContext object.

Comentarios

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 Enterprise Search Administration object model, see Introducción al modelo de objetos de administración del motor de búsqueda Enterprise Search and Procedimiento: Devolver el contexto de búsqueda para el proveedor del servicio de búsqueda.

Ejemplo

[C#]

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

}

Vea también

Referencia

SearchContext (Clase)
SearchContext (Miembros)
Microsoft.Office.Server.Search.Administration (Espacio de nombres)