The following search example demonstrates how to perform search in an index.
The recommended way to perform search when using the API is to resolve an instance of the ISearchResultsBuilder interface by invoking ObjectFactory.Resolve<ISearchResultsBuilder>(). The resolved object will be used to call the method IEnumerable<IDocument> Search(SearchBuilderParams searchParams, out int hitCount), which will take care to create the search query and invoke the configured search service. The Search method returns all the search results that are found as IEnumerable<IDocument>, takes a set of parameters organized in SearchBuilderParams object, and outputs hitCount (the number of the returned search results).
ISearchResultsBuilder
ObjectFactory.Resolve<ISearchResultsBuilder>()
IEnumerable<IDocument> Search(SearchBuilderParams searchParams, out int hitCount)
Search
IEnumerable<IDocument>
SearchBuilderParams
hitCount
The SearchBuilderParams object must include the IndexName and SearchText properties. You can also use this object to set optional properties: SearchFields, Culture, HighlightedFields, OrderBy, Skip, Take, ScoringSettings, GetResultsFromAllSites, SearchFilter.
IndexName
SearchText
SearchFields
Culture
HighlightedFields
OrderBy
Skip
Take
ScoringSettings
GetResultsFromAllSites
SearchFilter
ISearchFilter
SearchFilterClause
object.Clauses
Increase your Sitefinity skills by signing up for our free trainings. Get Sitefinity-certified at Progress Education Community to boost your credentials.
This free lesson teaches administrators, marketers, and other business professionals how to use the Integration hub service to create automated workflows between Sitefinity and other business systems.
This free lesson teaches administrators the basics about protecting yor Sitefinity instance and its sites from external threats. Configure HTTPS, SSL, allow lists for trusted sites, and cookie security, among others.
The free on-demand video course teaches developers how to use Sitefinity .NET Core and leverage its decoupled architecture and new way of coding against the platform.
To submit feedback, please update your cookie settings and allow the usage of Functional cookies.
Your feedback about this content is important