Overview
This node performs fuzzy searching on a list of items using the Fuse.js library. It allows users to input a search query and an array of items, then returns the best matching results based on the query. This is useful for scenarios where exact matches are unlikely or when you want to provide flexible search capabilities, such as searching through product catalogs, user lists, or any JSON data with partial or approximate matching.
Practical examples:
- Searching a list of book titles and authors to find relevant entries even if the query has typos.
- Filtering a dataset of customer records by name or email with tolerance for misspellings.
- Implementing a search feature in workflows that require ranking results by relevance.
Properties
| Name | Meaning |
|---|---|
| Query | The search string or term to look for within the items. |
| Item List (JSON) | The array of items to search through. Can be provided as a JSON string or an array of objects. |
| Keys | Comma-separated keys specifying which fields in each item to search in (e.g., "title,author.name"). |
| Advanced Options (JSON) | Optional Fuse.js configuration options in JSON format to customize search behavior (e.g., threshold, distance). |
Output
The output is an array of JSON objects representing the search results. Each result object contains:
- The original matched item’s properties.
- A
scorefield indicating the match quality (lower scores mean better matches).
If the original item is a primitive value, it will be returned under the value key alongside the score.
No binary data output is produced by this node.
Example output structure:
[
{
"title": "Example Book",
"author": "John Doe",
"score": 0.1234
},
{
"value": "Some primitive item",
"score": 0.5678
}
]
Dependencies
- Requires the Fuse.js library bundled with the node.
- No external API keys or services are needed.
- No special environment variables or n8n configurations required.
Troubleshooting
- Invalid JSON in Items or Options: If the "Item List (JSON)" or "Advanced Options (JSON)" inputs contain invalid JSON, the node will throw a parsing error. Ensure these inputs are valid JSON strings or arrays/objects.
- Empty or Missing Keys: If the "Keys" property is empty or does not correspond to fields in the items, the search may return no results or unexpected output. Verify that keys match the structure of your items.
- Performance with Large Datasets: Searching very large arrays might impact performance. Consider filtering or paginating data before using this node.
- Unexpected Result Structure: If items are primitives rather than objects, results will include a
valuefield instead of original keys.