Skip to content

Add fuzzy matching for name completion. #2562

@przepompownia

Description

@przepompownia

In #2561 @mamazu pointed out where matching of completion input to available names has place. First thing I did was playing with regex-based fuzzy matching (created years ago for my phpcd fork) #2561 (comment) especially checking if it can be intolerably slow.

The benefit seems to be considerable even at some cost of performance.

image

The implementation is simple itself and to replace if it were invented and can be combined with other Criteria classes (for example ShortNameBeginsWith could be checked first, fuzzy matching otherwise) into compound Criteria.

On the other side, to avoid checking

        if (!$record instanceof HasShortName) {
            return false;
        }

        if (!$this->name) {
            return false;
        }

more than once such compound matching should be implemented in a single class - to discuss.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions