Skip to main content

Filter Fuzzy Matching Implementation Method

Scenario: In e-commerce, usually for search optimization, various high-frequency search terms are added to product titles, causing product title changes to be untraceable. Maintaining a product abbreviation matching table based on product titles is tedious and unrealistic, so the way of filtering through abbreviations is not feasible. Therefore, customers hope to filter products through certain specific flavor keywords in product names (i.e., the need for fuzzy matching), and hope to filter multiple flavors simultaneously (i.e., satisfy the "OR" relationship between flavors).

Implementation Effect:

image.png

Implementation Method:

1. Set global parameters: Administrator Settings-Resource Management-Global Parameters-New Parameter, as follows, text parameter "Flavor", multi-value. You can set options in advance, or modify options from the parameter filter edit interface later. Note: Single-value parameters are only applicable to single-selection filters, multi-selection parameters are compatible with single-selection and multi-selection scenarios, so it's recommended to create multi-value text parameters.

image.png

2. Enter the card edit area, set the calculated fields needed in the filter area. Create a new calculated field, reference the text parameter created in the previous step.

Note: In the card edit area, when adding calculated fields, split doesn't work for text-type global parameters. You need to separately create a calculated field for this global parameter, and apply split to the added field for splitting. As shown in the figure below, field [Flavor].

image.png

3. Following the above, create a new calculated field, named [Parameter Control], and drag it into the filter area.

If the filter only needs single selection, then use the instr function, type as boolean;

instr([Product Title],[Flavor])>0

For multi-selection filter scenarios, SQL functions have two writing methods, as follows, choose one, type as boolean.

  1. exists(split([Flavor],','), x -> instr([Product Title],x)>0)

  2. array_sum(transform(split([Flavor],','), x -> instr([Product Title],x)))>0

image.png

4. Save the card, return to the page, create a new parameter filter, select the parameter created in step one. Default values can be reselected, and options can be manually modified or selected to import from the dataset. Parameter filters will automatically match cards on the current page that use this parameter and automatically link, production complete.

image.png