Title Filters
The Title Filters in Replyke allow developers to filter entities based on the content of theirtitle property. This functionality is versatile and can be used to include or exclude entities with specific title characteristics. Let’s explore how Title Filters work and how to use them effectively.
Overview of Title Filters
ThetitleFilters property can be passed to the fetchEntities function as part of the filters object with the following structure:
hasTitle: A boolean flag to include entities based on whether they have a title (true) or not (false).includes: A string or array of strings. Entities whosetitlecontains any of these strings will be included.doesNotInclude: A string or array of strings. Entities whosetitlecontains any of these strings will be excluded.
Applying Title Filters
Developers can apply title filters by calling thefetchEntities function with the desired filter configuration.
How Title Filters Work
Title Filters are applied on the backend when querying entities. They allow for:- Existence Filtering: Using the
hasTitleflag, you can include only entities that have a title (true) or exclude entities without a title (false). - Text Matching:
includes: Filters entities to include those whose title contains any of the specified strings.doesNotInclude: Filters entities to exclude those whose title contains any of the specified strings.
- Combined Conditions: Developers can combine these conditions to achieve granular control over the results.
Example Use Cases
1. Passing Static Filters to the EntityListProvider
To set static filters for titles at the initialization of the entity list, pass them directly to theEntityListProvider:
2. Dynamically Updating Filters Based on User Interaction
You can also dynamically adjust the title filters based on user actions, such as clicking a button:Important Notes
- Title Filters are case-insensitive, making them flexible for user-defined queries.
- Filters are applied immediately, and the entity list resets to reflect the updated conditions.
- Passing
nulltosetTitleFiltersclears all title-based filtering.

