FilterController.FullTextFilterAction Property
Provides access to the FilterController‘s FullTextSearch Action.
Namespace: DevExpress.ExpressApp.SystemModule
Assembly: DevExpress.ExpressApp.v24.2.dll
NuGet Package: DevExpress.ExpressApp
Declaration
Property Value
Type | Description |
---|---|
ParametrizedAction | A ParametrizedAction object representing the FullTextSearch Action. |
Remarks
The FullTextSearch Action is intended to search the current List View‘s objects whose persistent properties include individual words from the combination typed by an end-user:
- ASP.NET Core Blazor
- Windows Forms
- ASP.NET Web Forms
The code below demonstrates how access the FullTextFilterAction and show an object’s Detail View if the Action returns only one object.
using System;
using System.Collections;
using DevExpress.ExpressApp;
using DevExpress.ExpressApp.SystemModule;
using DevExpress.Persistent.BaseImpl;
// ...
public class FilterActionController : ObjectViewController<ListView, Person> {
protected override void OnActivated() {
base.OnActivated();
FilterController filterController = Frame.GetController<FilterController>();
if(filterController != null) {
filterController.FullTextFilterAction.Executed += FullTextFilterAction_Executed;
}
}
private void FullTextFilterAction_Executed(object sender, DevExpress.ExpressApp.Actions.ActionBaseEventArgs e) {
int count = ((IList)View.CollectionSource.Collection).Count;
if (count == 1) {
IObjectSpace objectSpace = Application.CreateObjectSpace(typeof(Person));
Object person = ((IList)View.CollectionSource.Collection)[0];
e.ShowViewParameters.CreatedView = Application.CreateDetailView(
objectSpace, objectSpace.GetObject(person));
}
}
}
When the FullTextSearch is executed, the Search Criteria Builder generates the CriteriaOperator object, which is then assigned to the FullTextSearchCriteria item of the List View Collection Source’s Criteria collection. To generate the criterion, the Builder collects the properties based on the Filter Controller’s FilterController.FullTextSearchTargetPropertiesMode property value.
By default, the FullTextSearch Action splits the search request into separate words by spaces. The result includes records that contain all these words in an arbitrary order. If you need to find the exact match of the phrase containing spaces, enclose your request in quotation marks (“”).
Note
The FullTextSearch Action always performs a search over the Friendly Key property, even if the FullTextSearchTargetPropertiesMode.VisibleColumns mode is specified and Friendly Key column is hidden. The Friendly Key property is a business class property specified via the FriendlyKeyPropertyAttribute or via the IModelClass.FriendlyKeyProperty option in the Application Model.
The following techniques can be used to modify the default behavior of the FullTextSearch Action:
- To modify the approach by which the criterion is created, handle the FilterController.CustomBuildCriteria event.
- To provide a custom list of the properties to be used in the generated criterion, handle the FilterController.CustomGetFullTextSearchProperties event.
- To perform a search only by the properties that are presented by visible columns in the current List View, set the FilterController.FullTextSearchTargetPropertiesMode property to the FullTextSearchTargetPropertiesMode.VisibleColumns value.
- To exclude individual properties from the list of the properties to be used in the generated criterion, apply the SearchMemberOptionsAttribute to them. See the SearchClassOptionsAttribute as well.
- To search the word combination typed as the Action’s parameter, in each persistent property of the available objects, set the FilterController.FullTextSearchMode property to the SearchMode.SearchInProperty value.
By default, the FullTextSearch Action is active when the target object type is persistent, and the object collection is allowed for filtering. To ascertain why the FullTextSearch Action is currently deactivated or disabled, use the DiagnosticInfo Action. If you need to change the Action’s “active” or “enabled” state in code, use its ActionBase.Active or ActionBase.Enabled property, respectively.
Information on the FullTextSearch Action is available in the Application Model‘s ActionDesign node. To access it, use the Model Editor.