Sitefinity uses Lucene .NET Search Engine
. There is a class SearchManager which wraps the data access functions of the SiteFinity search module. The class has a static method Search that we use to retrieve data from Lucene segment files.
Search(string searchQuery, string indexName, int startIndex, int max, string mode, bool escapeChars, out int totalItems) - Searches a given search index for matching results, utilizing the Lucene search engine
- "searchQuery" > The search query e.g.(sitefinity "search query")
- "indexName" > The name of the index to search into e.g.("ProductsIndex")
- "startIndex" > start index for paging i.e.(starting index of the displayed documents)
- "max" > max results per page
- "mode" > Sets the query parser operator (if mode is equal to "AnyWord" the default operator becomes OR otherwise is AND)
- "escapeChars" > Specifies if special characters should be escaped and thus becoming part of the search term(s)
- "totalItems" > The total number of hits for the search query
There are two public controls SearchBox - it is used for setting SearchIndex that will be used by SearchResult control
SearchRestult control - reads QueryString data passed by SearchBox and calls the static method of SearchManager class. Then inside CreateChildControls of this control we create a generic list of ResultItem object. The result item object has the following properties.
Title- Gets or set the title of a document.
Snippet - Gets or set a snippet of the content of a document.
Url -Gets or set a URL for the document.
Score - Gets or sets the score for this document within a result set.
You can trigger the index programmatically by using Index
method 9rates an index for all pages and documents provided by all registered clients) of IndexingService class. This class implements IIndexingService interface and it is used to represent services defined in the application configuration.
You can also take a look at
We form the result items based on Telerik.Lucene.Net.Highlight.Highlighter which is used to markup highlighted terms found in the best sections of a text, Fragmenter, Scorer, Formatter, Encoder and tokenizers. The actual segment is created by Lucene and we get the best fragments from there by using Telerik.Lucene.Net.Highlight.GetBestFragment
method - highlights chosen terms in a text, extracting the most relevant
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Telerik Public Issue Tracking
system and vote to affect the priority of the items