[Module Release] FuzzySearch – Fuse.js-inspired fuzzy matching for Roblox
Hey everyone!
I made a lightweight fuzzy search module for Roblox, inspired by the popular JavaScript library Fuse.js.
This module lets you search through arrays of strings or objects even if the search term isn’t exact — great for player search bars, autocomplete, inventory filters, and more.
Features
Fuzzy matching using Levenshtein distance (typo-tolerant search)
Works with strings or tables (object search with key selection)
Adjustable threshold (how strict/loose matches are)
Optional case-sensitive matching
Results sorted by relevance
Example with strings
local FuzzySearch = require(path.to.FuzzySearch)
local fruits = {"apple", "orange", "banana", "pineapple"}
local searcher = FuzzySearch.new(fruits, {threshold = 0.4})
local results = searcher:search("aple")
for _, result in ipairs(results) do
print(result.item, result.score)
end
Output:
apple 0.2
pineapple 0.36
Example with objects
local people = {
{name = "John Doe", job = "Developer"},
{name = "Jane Smith", job = "Designer"},
{name = "Jake Johnson", job = "Doctor"}
}
local searcher2 = FuzzySearch.new(people, {
threshold = 0.3,
keys = {"name", "job"}
})
local results2 = searcher2:search("Desiner")
for _, result in ipairs(results2) do
print(result.item.name, result.item.job, result.score)
end
Output:
Jane Smith Designer 0.18
API
FuzzySearch.new(list, options)
-
list→{string}or{table} -
optionstable:threshold(number) → 0 = exact match, 1 = match everything (default: 0.4)keys(array of strings) → Keys to search in objectscaseSensitive(boolean) → true/false (default: false)
search(pattern)
- Returns
{ {item = any, score = number}, ... }sorted by best score first.
Update – Flexible Key Paths
Nested Key Paths
You can now use dot notation in the keys option to search inside nested tables:
keys = {"name", "job.name"}
Example:
local people = {
{name = "John Doe", job = {name = "Developer", Salary = 2000}},
{name = "Jane Smith", job = {name = "Doctor", Salary = 3000}},
{name = "Jake Johnson", job = {name = "Designer", Salary = 1500}}
}
local searcher = FuzzySearch.new(people, {
threshold = 0.3,
keys = {"name", "job.name"}
})
local results = searcher:search("Desiner")
for _, result in ipairs(results) do
print(result.item.name, result.item.job.name, result.score)
end
Wide Search with .*
You can now search all child string properties of a given path using .* at the end:
keys = {"name", "job.*"}
This will search "name" directly, and all string properties in job, without listing them individually.
Root-Level Wide Search
You can even use ".*" as a root-level wide search to search all string properties in the object, no matter how deeply nested:
keys = {".*"} -- searches everything in the object recursively
Get the module [Free]:
FuzzySearch - Developer Marketplace
Support the Project:
This module is and will remain 100% free.
If it saved you time or helped your game, consider buying me a coffee — it helps me keep making tools like this for the community.
FuzzySearch Support - Roblox
Thanks for reading! ![]()