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

Search algorithm improvement? #614

Open
hckiang opened this issue May 26, 2023 · 1 comment
Open

Search algorithm improvement? #614

hckiang opened this issue May 26, 2023 · 1 comment

Comments

@hckiang
Copy link

hckiang commented May 26, 2023

I have been using the app for years but now as my password store grows bigger, the search algorithm now can seldom find the entry that I want. For example, when I type Pinboard in the search box these are the first few file names that matches:

Amazon.co.uk Sign in
anonymous in "Linux box" Virtualbox
bourbaki wifi raspberry pi
Facebook Mobile PIN
Hidden app in Microsoft Launcher
hkjc pin

In the above, it seems that in is matching Pinboard. The 'most sensible' entry pinboard.in is at the 18th position.

Another example: the query Facebook will actually match the file name BCM e-banking, which IMHO is too fuzzy. I suspect this is some Levenshtein distance algorithm(?)

QtPass, on the other hand, appears to just tokenises the search query then find file names that matches any one of the tokens. It isn't perfect but most of the time it can find the thing that I need in one go.

Any chance this can be improved?

@hckiang
Copy link
Author

hckiang commented May 26, 2023

I think this function here could look like this:

    public static func match(nameWithCategory: String, searchText: String) -> Bool {
        let querywords = searchText.split {!($0.isLetter || $0.isNumber || $0 == ".") }
        for str in querywords {
            if nameWithCategory.localizedCaseInsensitiveContains(str) {
                return true
            }
        }
        return false
    }

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

No branches or pull requests

1 participant