Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to match with splits keywords #6

Open
alswl opened this issue Jun 25, 2023 · 3 comments
Open

Is it possible to match with splits keywords #6

alswl opened this issue Jun 25, 2023 · 3 comments
Labels
enhancement New feature or request

Comments

@alswl
Copy link

alswl commented Jun 25, 2023

Now I have a project named "abc-explorer-0", when I type "idea abc 0", I cannot match the result. I must type idea abc-ex to match it.

I want match the project with fuzzy keyword, thanks.

If you think this feature is ok, I can provide the implemented with pull request.

@artemy
Copy link
Owner

artemy commented Jun 28, 2023

The way fuzzy search currently works is if you would like to find a project named abc-explorer-0 you would only need to type the first letters of each keyword, i.e. idea ae0
Would that work for you?

@artemy artemy added the enhancement New feature or request label Jun 28, 2023
@alswl
Copy link
Author

alswl commented Jun 28, 2023

I am using the match func now:

def match_fuzzy(chars, string):
    index = 0
    for char in chars:
        if char not in string[index:]:
            return False
        index = string.index(char, index) + 1
    return True

...

    def matches_query(self, query):
        splits = filter(lambda x: x.strip() != '', query)
        return match_fuzzy(splits, self.name.lower())

I can match chars separated, and type the keywords in the project name.

@artemy
Copy link
Owner

artemy commented Jun 29, 2023

Please open a pull request so we can discuss the solution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants