Share via


SPSearchResultCollection Class

This method is deprecated. For Search, use the Execute method of the Microsoft.SharePoint.Search.Query.KeywordQuery class or the Microsoft.SharePoint.Search.Query.FullTextSqlQuery class. Represents a collection of SPSearchResult objects.

Inheritance Hierarchy

System.Object
  Microsoft.SharePoint.Administration.SPAutoSerializingObject
    Microsoft.SharePoint.SPBaseCollection
      Microsoft.SharePoint.SPSearchResultCollection

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

Syntax

<SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel := True)> _
<SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel := True)> _
Public Class SPSearchResultCollection _
    Inherits SPBaseCollection

Dim instance As SPSearchResultCollection
[SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel = true)]
[SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel = true)]
public class SPSearchResultCollection : SPBaseCollection

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 a collection of search results. For example, if the collection is assigned to a variable named mySearchResults, use mySearchResults[index] in Microsoft Visual C#, or mySearchResults(index) in Microsoft Visual Basic, where index is the index number of the search result in the collection.

To use this class and its members, you must install Microsoft SQL Server on the server and enable full-text search in SharePoint Central Administration.

Thread Safety

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

See Also

Reference

SPSearchResultCollection Members

Microsoft.SharePoint Namespace