Export (0) Print
Expand All
0 out of 1 rated this helpful - Rate this topic

SearchContext Class

Represents the search service instance for a Shared Services Provider (SSP).

System.Object
  Microsoft.Office.Server.Search.Administration.SearchContext

Namespace:  Microsoft.Office.Server.Search.Administration
Assembly:  Microsoft.Office.Server.Search (in Microsoft.Office.Server.Search.dll)
'Declaration
<GuidAttribute("E4CCCDDF-F320-479F-9EFD-588F4EC91C84")> _
<SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel := True)> _
Public NotInheritable Class SearchContext
'Usage
Dim instance As SearchContext

The SearchContext object is the entry point to the Enterprise Search[N.Microsoft.Office.Server.Search.Administration] object model. The GetContext() method returns the search context for site, server, or SSP that you specify.

NoteNote

If you use the GetContext overload of the SearchContext class 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. The code in the Example section demonstrates how to do this.

For more information about the SearchContext class and the Enterprise Search Administration object model, see Getting Started with the Enterprise Search Administration Object Model and How to: Return the Search Context for the Search Service Provider.

[C#]

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

}

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.