Neamar / KISS

Lightning fast, open-source, < 250kb Android launcher
https://kisslauncher.com/
GNU General Public License v3.0
2.92k stars 578 forks source link

Results get reordered even if not needed #1494

Open licaon-kter opened 4 years ago

licaon-kter commented 4 years ago

3.13.5 F-Droid

I'm trying to open an app (Syncthing) so I quickly type about 3 letters, the wanted result appears on screen, I eye it and muscle memory is ready to jump and touch the result 3

but the typing finger is too fast, my mind was thinking "sync" and the fingers got that command, the "c" is added, and I touch the first result as expected 4

Wat? Why did I open Orgzly instead?

TBog commented 4 years ago

You say even if not needed. Can you define it further? The way we order the results now is FuzzyScore. The greater the score, the lower the app. Each character you type will update the score.

Would you want to not compute score if the result list has only 2 matches?

Neamar commented 4 years ago

I think he dislikes the fact the order changes when adding a character. However, it makes sense based on the way we store results -- see #285 and #608 :)

licaon-kter commented 4 years ago

This is closed why exactly? Those two issues are marked as "fixed" but this looks broken.

I've used Syncthing before, I didn't even know that Orgzly had that thing.

Ok score, whatever, but why is "xxxxxxxxxx keyword" first and "keyword" second?

If the answer is "fuzzy score" I should rename this issue as "fuzzy score broken" and reopen? Else this doesn't make any sense.

TBog commented 4 years ago

but why is "xxxxxxxxxx keyword" first and "keyword" second?

"xxxxxxxxxx keyword" has 2 bonus scores.

  1. separator_bonus - bonus if match occurs after a separator
  2. full_word_bonus

Test code:

        String input = "sync";
        Log.i("test", "Input: `" + input + "`");
        StringNormalizer.Result norm = StringNormalizer.normalizeWithResult(input, false);
        FuzzyScore score = new FuzzyScore(norm.codePoints, true);
        FuzzyScore.MatchInfo info;

        String[] list = {"Orgzly: Sync", "Syncthing-Fork"};

        for (String str : list) {
            info = score.match(str);
            Log.i("test", info.score + " score for `" + str + "` " + (info.match ? "matching" : "NOT matching"));
        }

Output:

Input: `sync`
118 score for `Orgzly: Sync` matching
25 score for `Syncthing-Fork` matching
licaon-kter commented 4 years ago

Maybe biasing this on "starts with keyword" is a better idea?

Not sure about you but I usually remember apps by name, the start of the name.

Neamar commented 4 years ago

@saveman71 you looked into this recently, do you have an opinion?

saveman71 commented 4 years ago

First, I think the main concern is justified, i.e. there is a UX deception with results changing order at the last second.

Would you want to not compute score if the result list has only 2 matches?

I actually don't find this sooooo bad. However people might find it weird.

Now, on how to fix this specific issue: I think we should add a bonus "starts with", that would, in this case, checked with a new unit test, ensure that "Syncthing" is ranked higher than "Bla bla bla: Sync".

What do you think? I can draft a PR.

licaon-kter commented 4 years ago

a UX deception

Right, so @TBog why is the score reversed on "syn" vs "sync", this is the strange part. Ok, put Syncthing second, but it should be second (or whatever lower than the other) from the start of the query.

saveman71 commented 4 years ago

Because with "syn", neither "Orgzly: Sync" or "Syncthing-Fork" have the full word bonus. With "sync", one whole word of "Orgzly: Sync" is matched so a bonus is applied.

but it should be second (or whatever lower than the other) from the start of the query

Why is this not the case, this I'm not sure. I can investigate.

saveman71 commented 4 years ago

Okay after reminding myself of the code, there is already a mechanism in place to negatively affect matches with a lot of characters before the first match, like "Orgzly: Sync".

https://github.com/Neamar/KISS/blob/9ef629f8e9009b450bb5792fb67394f035229312/app/src/main/java/fr/neamar/kiss/utils/FuzzyScore.java#L37-L40

So my

I think we should add a bonus "starts with"

is outdated.

This explains why at first, it's ranked lower, but once the full word bonus kicks in, it gets ranked higher. I believe we can tweak this.

licaon-kter commented 4 years ago

Fullword, right, now I understand. I now see the reasoning behind the bonus.

Neamar commented 4 years ago

Would you want to not compute score if the result list has only 2 matches?

Keep in mind most people have search providers, so they always have more results!

Dakkaron commented 4 years ago

To me the most confusing part as a user is not that the order is illogical, but that it gets resorted without an obvious reason.

Would it maybe be useful to just resort if the score difference crosses some kind of threshold?

licaon-kter commented 3 years ago

So no more progress?

EmmanuelMess commented 2 years ago

I don't know if this option has been considered, but only allowing "filtering" for visible items, and not reordering would be a good idea. That would mean that "Mercado Pago" and "Mercado Libre" don't switch places at the last second. Probably this has to be a property of the sorting algorithm, and not explicit in code.