Partager via


SPSearchResultCollection Class

The SPSearchResultCollection class represents a collection of SPSearchResult objects.

System.Object

   Microsoft.SharePoint.SPBaseCollection

      Microsoft.SharePoint.SPSearchResultCollection

Public Properties

The following table shows the public properties of the SPSearchResultCollection class, the data type of each property, and a brief description of each.

Name Data Type Description
Count Int32 Gets the number of search result objects in the collection.
Item Microsoft.SharePoint.SPSearchResult Gets the search result object at the specified index in the collection.
NextPagePosition Microsoft.SharePoint.SPSearchResultCollectionPosition Gets the position for the next page of data in a paged view of the search results.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread safe.

Remarks

Use one of the SearchListItems methods or one of the SearchDocuments methods of the SPWeb class to perform a search on a list or a document library and return a collection of search results. Use an indexer to return a single item from the collection of search results. For example, if the collection is assigned to a variable named mySearchResults, use mySearchResults[index] in C#, or mySearchResults(index) in Visual Basic .NET, where index is the index number of the search result in the collection.

Use of this class and its members requires that Microsoft SQL Server be installed on the server and that you enable full-text search in SharePoint Central Administration.

Requirements

Namespace: Microsoft.SharePoint

Platforms: Microsoft Windows Server 2003

Assembly: Windows SharePoint Services (in Microsoft.SharePoint.dll)

Security: Code Access Security