Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

fuzzy and fuzzyBy produce false positives on long strings (too fuzzy?)

Open
#173 0 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
55/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
angularjs, javascript
Domain
frontend, tooling

Research direction

The issue is in the fuzzy and fuzzyBy filters. Look at the filter implementation files, likely named fuzzy.js or similar. The test case shows the bug: a long string incorrectly matches 'foobar'. Start by understanding the matching algorithm, then adjust the threshold or scoring for long strings. Run the existing tests to ensure changes don't break existing functionality.

Written by the indexing model from the issue text.

Description

While testing the fuzzy and fuzzyBy filters on some sample text, I noticed they tend to match any search term for long string data. The longer the text string, the more likely it will match on words that barely resemble the search string. This makes it hard to use effectively, since the filtered results have a very low signal-to-noise ratio.

var $filter = angular.element(document.body).injector().get('$filter');
var arr = [
    { text: 'foo bar' },
    { text: 'Curabitur ultricies metus eu neque luctus, vitae efficitur ' +
        'quam elementum. Aliquam convallis diam et pretium placerat. Morbi ' +
        'tellus turpis, sollicitudin eu nunc et, mollis sodales lectus. ' +
        'Pellentesque lacinia augue id risus condimentum bibendum.'
    }
];
console.log($filter('fuzzy')(arr, 'foobar').length); // returns 2
Dominant language
JavaScript
Stars
2.9k
Forks
319
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from a8m/angular-filter

All issues in a8m/angular-filter

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.