Filtering DSL

When you are working with database and use get_filtered_records method you can use Tabbli filtering DSL for making queries. There are two types of filtering DSL formats:

  • dictionary based

  • URL parameters

The list of filtering parameters:

  • f-<property_name> - filter by filtered or indexed property (supports a list of values with "OR" logic);

  • nmin-<property_name> - minimum value for a numeric property;

  • nmax-<property_name> - maximum value for a numeric property;

  • ffrom-<property_name> - using with date properties for filtering from specified date;

  • fto-<property_name> - using with date properties for filtering to specified date.

Example:

{% set = DB(request).get_collection('events')
    .get_filtered_records(filter_data={
        'f-active': ['true'],
        'f-tags': ['festival', 'concert', 'open-air'],
        'nmax-price': 200,
        'ffrom-date': '2020-02-14'}) %}

Filtering with URL parameters:

?f-active=true&f-tags=festival&f-tags=concert&f-tags=open-air&
    nmax-price=200&ffrom-date=2020-02-14

Last updated