7

When I filter-as-you-type the file list in Nautilus, the result list gets sorted "by relevance" by default. How is this defined? What makes a file more relevant than another file?

Can I change this default sorting of the result list to alphabetical sorting, aka "A-Z"? (I should note that I have export LC_ALL=C.UTF-8 in my .bashrc, to have Nautilus respect punctuation in file names)

I am using Fedora Silverblue 37, with Gnome 43

2 Answers 2

8

Regarding the "relevance" algorithm, I looked at the Nautilus source code, and it appears that a file's relevance score is computed as a sum of scores based on how recently the file was accessed or modified, its "proximity" (how close the file is to the current directory in the file system hierarchy), and how well the search term matches. This last score is called fts_rank, which I assume means "full text search rank", meaning it will search the contents of the file as well.

The recency score goes up to a maximum of 100, and the proximity score can be at most 10,000. The FTS score I don't have any values for, but presumably it should have a pretty large weight when determining the total score.

The exact formula can be seen here.

1
  • 1
    It is not difficult to compile Nautilus, in my case it consisted of installing the Builder flatpak and adding the nightly Gnome SDK via commandline: flatpak remote-add --if-not-exists gnome-nightly https://nightly.gnome.org/gnome-nightly.flatpakrepo and flatpak install gnome-nightly org.gnome.Sdk. Then clone the repo and "build" (or "clean", "rebuild", "build", hey, it's C). Commented Apr 5, 2023 at 18:04
3

From what I gather the answers to your questions are:

1 - Nobody knows, except the devs:
"We order based on a formula for search relevance, but it's true there isn't a UI hint about this order"...
although people keep asking about it:
"Could not the design use case(s), and thus algorithm, for "sort by relevance" be explained, perhaps documented in abbreviated pseudo-code?"

2 - You can't change it, it appears this "always-default-to-relevance" is by design (not sure why):
there needed to be a way to restore the default search results order (by “relevance” of the results)

I'd love to be proven wrong...

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .