Class SearchDataSource
Provides PageData data to DataBoundControl implementations through search based on various criteria.
Implements
Inherited Members
Namespace: EPiServer.Web.WebControls
Assembly: EPiServer.Web.WebControls.dll
Version: 7.19.2Syntax
public class SearchDataSource : PageDataSource, IListSource, IHierarchicalDataSource, IDataSource, IDataSourceMethodsExamples
Refer to "Using Data Source Controls" under "Navigations and Listings" in the Developer Guide for more information and examples.
Constructors
SearchDataSource()
Initializes a new instance of the SearchDataSource class.
Declaration
public SearchDataSource()SearchDataSource(SearchIndexConfig)
Initializes a new instance of the SearchDataSource class.
Declaration
public SearchDataSource(SearchIndexConfig searchIndexConfig)Parameters
| Type | Name | Description | 
|---|---|---|
| SearchIndexConfig | searchIndexConfig | The search index config. | 
Properties
Criteria
The search criterias that limit the search
Declaration
public List<PropertyCriteriaControl> Criteria { get; }Property Value
| Type | Description | 
|---|---|
| System.Collections.Generic.List<PropertyCriteriaControl> | 
Remarks
The PropertyCriteria in the Criterias collection may be used in two different ways
LanguageBranches
Gets or sets a comma separated list of the language branches to be searched in.
Declaration
public string LanguageBranches { get; set; }Property Value
| Type | Description | 
|---|---|
| System.String | The language branches. | 
MainCatalog
The index server catalog to search in.
Declaration
[Obsolete("This Accessor is no longer being used, indexing is now handled through the Indexing Service")]
public string MainCatalog { get; set; }Property Value
| Type | Description | 
|---|---|
| System.String | 
MainScope
The scope parameter for index server searches. The default is deep traversal under the catalog root.
Declaration
[Obsolete("This Accessor is no longer being used, indexing is now handled through the Indexing Service")]
public string MainScope { get; set; }Property Value
| Type | Description | 
|---|---|
| System.String | 
MaxAllowHits
By default no more than 100 hits can be returned for performance reasons
Declaration
public int MaxAllowHits { get; set; }Property Value
| Type | Description | 
|---|---|
| System.Int32 | 
OnlyWholeWords
A flag to control if the search will match only whole words. If False, the search will match all words that begin with the words in the query (word* match).
Declaration
[Obsolete("This Accessor is no longer being used, handled by the Indexing Service")]
public bool OnlyWholeWords { get; set; }Property Value
| Type | Description | 
|---|---|
| System.Boolean | 
PageCriteriaSearchService
Gets or sets the IPageCriteriaQueryService that is used internally in this instance.
Declaration
public Injected<IPageCriteriaQueryService> PageCriteriaSearchService { get; set; }Property Value
| Type | Description | 
|---|---|
| Injected<IPageCriteriaQueryService> | 
SearchFiles
A flag to tell whether files should be included in the search or not.
Declaration
[Obsolete("SearchDataSource does not support searching for files", false)]
public bool SearchFiles { get; set; }Property Value
| Type | Description | 
|---|---|
| System.Boolean | 
SearchLocations
A comma separated string of file system locations used as starting locations when searching for files.
Declaration
[Obsolete("SearchDataSource does not support searching for files", false)]
public string SearchLocations { get; set; }Property Value
| Type | Description | 
|---|---|
| System.String | Default value in String.Empty | 
Remarks
If empty, will search in all unified directories.
You can set more than one location by building a comma-separated list of paths.
SearchQuery
Search query string.
Declaration
public string SearchQuery { get; set; }Property Value
| Type | Description | 
|---|---|
| System.String | 
Remarks
If SearchQuery is empty and the Criterias collection contains at least one PropertyCriteria, the search will be performed using FindPagesWithCriteria(PageReference, PropertyCriteriaCollection). Default you will only get hits on pages where PageVisibleInMenu is true. If you want to get hits on pages where PageVisibleInMenu is false you need to set the property EnableVisibleInMenu to false.
Methods
AddTrailingWildcards(String)
Declaration
public virtual string AddTrailingWildcards(string query)Parameters
| Type | Name | Description | 
|---|---|---|
| System.String | query | 
Returns
| Type | Description | 
|---|---|
| System.String | 
CreateFileSearchMatch(String, String, DateTime, Int32, String)
Create a file search match that can be added to the PageSearch results. This function is called by PopulatePages() for each file match. Override this function to customize the PageData instance that holds the file search match.
Declaration
[Obsolete("SearchDataSource does not support searching for files", false)]
protected virtual PageData CreateFileSearchMatch(string fileName, string fileUrl, DateTime lastModified, int rank, string displayText)Parameters
| Type | Name | Description | 
|---|---|---|
| System.String | fileName | Name of matched file | 
| System.String | fileUrl | Relative or absolute Url to matched file | 
| System.DateTime | lastModified | The date when the file was last modified | 
| System.Int32 | rank | The match rank. | 
| System.String | displayText | The display text. | 
Returns
| Type | Description | 
|---|---|
| PageData | An initialized PageData instance that can be added to the PageSearch results (a PageDataCollection). | 
CreateFileSearchMatch(String, String, DateTime, Int32, String, String)
Create a file search match that can be added to the PageSearch results. This function is called by PopulatePages() for each file match. Override this function to customize the PageData instance that holds the file search match.
Declaration
[Obsolete("SearchDataSource does not support searching for files", false)]
protected virtual PageData CreateFileSearchMatch(string fileName, string fileUrl, DateTime lastModified, int rank, string iconUrl, string displayText)Parameters
| Type | Name | Description | 
|---|---|---|
| System.String | fileName | Name of matched file | 
| System.String | fileUrl | Relative or absolute Url to matched file | 
| System.DateTime | lastModified | The date when the file was last modified | 
| System.Int32 | rank | The match rank. | 
| System.String | iconUrl | Url to an icon that represents the file | 
| System.String | displayText | The display text. | 
Returns
| Type | Description | 
|---|---|
| PageData | An initialized PageData instance that can be added to the PageSearch results (a PageDataCollection). | 
Delete(IDictionary)
Declaration
public override int Delete(IDictionary values)Parameters
| Type | Name | Description | 
|---|---|---|
| System.Collections.IDictionary | values | 
Returns
| Type | Description | 
|---|---|
| System.Int32 | 
Overrides
PerformFileSearch(TextSearchParameters)
Declaration
[Obsolete("This Method is no longer being used, handled by the Indexing Service")]
protected virtual IndexServerResults PerformFileSearch(TextSearchParameters searchParams)Parameters
| Type | Name | Description | 
|---|---|---|
| TextSearchParameters | searchParams | 
Returns
| Type | Description | 
|---|---|
| IndexServerResults | 
PerformIndexServerSearch(TextSearchParameters)
Declaration
[Obsolete("This Method is no longer being used, handled by the Indexing Service")]
protected virtual IndexServerResults PerformIndexServerSearch(TextSearchParameters searchParams)Parameters
| Type | Name | Description | 
|---|---|---|
| TextSearchParameters | searchParams | 
Returns
| Type | Description | 
|---|---|
| IndexServerResults | 
PerformUnifiedFileSystemSearch()
Declaration
[Obsolete("This Method is no longer being used, handled by the Indexing Service")]
protected virtual IndexServerResults PerformUnifiedFileSystemSearch()Returns
| Type | Description | 
|---|---|
| IndexServerResults | 
RaiseChanged()
Declaration
public void RaiseChanged()Select(DataSourceSelectArguments)
Declaration
public override IEnumerable Select(DataSourceSelectArguments arguments)Parameters
| Type | Name | Description | 
|---|---|---|
| System.Web.UI.DataSourceSelectArguments | arguments | 
Returns
| Type | Description | 
|---|---|
| System.Collections.IEnumerable | 
