Finds approximate matches for chemical names using DuckDB's native string distance functions. Searches are length-blocked to keep performance reasonable against the 15M-row table.
Usage
dss_fuzzy(
query,
method = c("jaro_winkler", "levenshtein", "damerau_levenshtein", "jaccard"),
threshold = NULL,
cols = "PREFERRED_NAME",
limit = 20L,
con = NULL
)Arguments
- query
A single character string to fuzzy-match.
- method
Distance method. One of
"jaro_winkler"(default),"levenshtein","damerau_levenshtein", or"jaccard".- threshold
Similarity/distance cutoff. For jaro_winkler and jaccard, a minimum similarity (0–1, default 0.85). For levenshtein and damerau_levenshtein, a maximum edit distance (default 3).
- cols
Which
parent_colvalues to search. Defaults to"PREFERRED_NAME". Set toNULLto search all columns (slower).- limit
Maximum results to return. Default 20.
- con
An optional
DBI::DBIConnection.
Value
A tibble with DTXSID, parent_col, values, and a similarity or distance score column, ordered by best match first.
