diff --git a/visidata/fuzzymatch.py b/visidata/fuzzymatch.py index a8a634ee7..5f918f6b9 100644 --- a/visidata/fuzzymatch.py +++ b/visidata/fuzzymatch.py @@ -367,8 +367,8 @@ def _format_match(s, positions): @VisiData.api def fuzzymatch(vd, haystack:"list[dict[str, str]]", needles:"list[str]) -> list[CombinedMatch]"): - 'Return sorted list of matching dict values in haystack, augmenting the input dicts with _score:int and _positions:dict[k,set[int]] where k is each non-_ key in the haystack dict.' - + '''Perform case-insensitive matching. Return sorted list of matching dict values in haystack, augmenting the input dicts with _score:int and _positions:dict[k,set[int]] where k is each non-_ key in the haystack dict.''' + needles = [ p.lower() for p in needles] matches = [] for h in haystack: match = {} @@ -376,6 +376,7 @@ def fuzzymatch(vd, haystack:"list[dict[str, str]]", needles:"list[str]) -> list[ for k, v in h.items(): if k[0] == '_': continue positions = set() + v = v.lower() for p in needles: mr = _fuzzymatch(v, p) if mr.score > 0: