Search output order is not what I expected

Hello all,

I just started using atuin, before I used a fzf zsh plugin.

What make me uncomfortable is the order of the result: I expected the order to be by timestamp, but with the search_mode=‘fuzzy’ the result is re-ordered in some other way.

I saw the code that do that:
The sql with “order by timestamp”

Then a re-ordering here:

And here the “real” reordering (if fuzzy):

I tried with ‘fulltext’ search mode and results are ordered as expected, by timestamp, but I don’t like the searching algorithm.

I would like to have the choice to order the result by timestamp and searching by fuzzy algorithm.

What do you think?

Fuzzy tries to sort by the best match, not by time. Unfortunately we won’t be able to make large changes to it - what some people dislike, other people like, and vice-versa. I would be open to making it configurable though, but I’m not sure the fuzzy algorithm would be best for that.

What didn’t you like about the fulltext algorithm? Did you try skim?

We’ve got this issue opened for enhanced querying

I’d like to implement this with something like Tantivy, which will give us much better control over which fields from history are most important

fulltext is too “strict” to me. I give a try to skim, it seems really close to fuzzy syntax.

If I can give a feedback the documentation doesn’t mention about the fuzzy reorder (is the only search_mode that changes the order) and I suppose that the fuzzy mode makes the --reverse option useless because ignored by reordering.

I think the documentation assumes the user is aware that the search tries to find the best match, which is not necessarily the most recent one. Fuzzy will give truly horrible matches if it strictly orders by time

Would this work better for you?

I was not aware, but now I am :sweat_smile:

Use of “exact” instead of “fulltext” seems better in my opinion. But I will go with skim that could be a “super set” of “exact”.

I notice that the main (maybe the only) difference between skim and fuzzy is the use of AND instead of OR for separated words. I like it.

Because of that I think my best option is skim.

Thank you Ellie for your work and fast response!

1 Like