• Robert Knight's avatar
    Refactor annotation filtering to improve typing and documentation · d4d8c0bf
    Robert Knight authored
    Replace the loosely typed `Checker` interface in `view-filter.js`, which
    used `any` for field values, with a `Matcher` interface which is
    parametrized by the type of parsed query terms/field values. In order to
    do this it was necessary to make normalization of query terms/field
    values part of the `Matcher` interface.
    
    In the process, some additional simplifications/clean-up has been done:
    
     - Remove the `autofalse` check. This was a very minor optimization and many of
       these functions were broken in the sense that they could never return false,
       in order to short-circuit filtering, given the current types of `Annotation`
       object fields.
    
     - Fix a very minor bug where user query terms that contained a suffix
       of the username followed by a prefix of the display name could match.
       The query term should be tested against the username and display name
       separately.
    
     - Eliminate unused `field` argument to TermFilter constructor
    d4d8c0bf
view-filter.js 5.18 KB