Skip to main content

Fuzzy Filter

Uncontrolled node

Overview

The Fuzzy Filter node performs fuzzy string matching on a list of items using the Fuse.js library. It filters an input list based on a search pattern, returning only items that match within the specified threshold. This is useful for implementing search functionality, autocomplete features, or filtering large datasets where exact matches aren't required.

The node supports filtering simple string arrays or complex objects by specifying a property path (e.g., address.country to search within nested objects).

Threshold Behavior

The threshold controls how strict the matching is:

  • 0 = Most strict (only exact or very close matches)
  • 10 = Most lenient (allows very loose matches)
  • Default is 6 (moderate fuzziness)

Internally, the threshold is converted to a 0.0-1.0 scale for the Fuse.js algorithm.

Inputs

InputTypeDescriptionDefault
ListListThe array of items to filter. Can be strings or objects.-
PatternTextThe search string or pattern to match against.-
Property PathTextOptional. Dot-separated path to search within objects (e.g., name or address.city). Leave empty to search the entire item.-
ThresholdNumberFuzziness threshold from 0 (strict) to 10 (lenient).6

Outputs

OutputTypeDescription
Filtered ResultsListThe filtered array containing only items that match the pattern within the threshold.

Runtime Behavior and Defaults

  • The node uses Fuse.js for fuzzy matching with includeScore: true to track match quality.
  • If the List input is not an array or the Pattern is not a string, the node returns an empty array.
  • The Threshold is divided by 10 internally (e.g., 6 becomes 0.6) to match Fuse.js's 0.0-1.0 scale.
  • When Property Path is provided, the search only examines that specific property of each object.
  • The output preserves the original item objects (not just the matched property).

Example Usage

Example 1: Filtering a List of Strings

Filter a list of country names for "United States" with typos allowed:

Inputs:

  • List: ["United States", "United Kingdom", "Canada", "Mexico", "United Arab Emirates"]
  • Pattern: "Unted States" (typo intentional)
  • Threshold: 6

Output:

  • Filtered Results: ["United States", "United Arab Emirates"] (matches "United" closely)

Example 2: Filtering Objects by Property

Search for users by name in a list of user objects:

Inputs:

  • List:
    [
    {"name": "John Smith", "age": 30},
    {"name": "Jane Doe", "age": 25},
    {"name": "Johnny Walker", "age": 40}
    ]
  • Pattern: "Jon"
  • Property Path: "name"
  • Threshold: 4

Output:

  • Filtered Results:
    [
    {"name": "John Smith", "age": 30},
    {"name": "Johnny Walker", "age": 40}
    ]

Search within nested objects:

Inputs:

  • List:
    [
    {"address": {"city": "New York", "country": "USA"}},
    {"address": {"city": "London", "country": "UK"}},
    {"address": {"city": "Newcastle", "country": "UK"}}
    ]
  • Pattern: "New"
  • Property Path: "address.city"
  • Threshold: 5

Output:

  • Filtered Results:
    [
    {"address": {"city": "New York", "country": "USA"}},
    {"address": {"city": "Newcastle", "country": "UK"}}
    ]