GNOME Bugzilla – Bug 688772
Partial matches are scored higher than exact matches
Last modified: 2013-04-05 00:19:53 UTC
Steps to reproduce: 1) In any folder, enter search parameter 2) Uncheck "reversed order" from the dropdown 3) Alter search parameters in any way -- the search has now reset to reversed order
Nautilus search results are sorted by search relevance. Relevance must be in descending order ( = most relevant result first). "Reverse order" means "descending order" when sorting numbers. I must agree this use of "Reverse order" is misleading when talking about Relevance. But "Descending order" would make no sense in the context of alphabetic sorting. Anyway, I don't see any use case for ascending relevance order ( = least relevant result first). In my opinion, the "Reverse order" option should be disabled and hidden when items are sorted by relevance.
What I am speaking about is the sorting where longer filenames are listed before shorter filenames. Create a folder with 3 files in it: 'me', 'meme', and 'mememe'. Now search in that folder or "me". The first result is 'mememe'. This is counter-intuitive and also contrary to the behavior of every other file manager. When I search for "me", I want 'me' to show up first. If I am searching for "document1", would I want "document198942" to show up first, or "document1"? If I am searching for a picture and type "frank", why would I want "FrankZee.jpg" to show up before simply "Frank.jpg"?
Thanks for quick feedback. I see what you mean and I can reproduce it here. I think your expectations are right. Exact matches should be scored higher than partial matches (modulo file format extension). I'll rename the title of this report to reflect this.
There were indeed bugs in how results were ranked in those cases. I pushed some fixes for this to git master now, thanks for the report. The following fixes have been pushed: dd8f341 file: do not reverse collated order for files with same search rank 9f2d8a5 query: rank prefix matches lower than exact matches e55a3fe search-hit: add a missing break
Created attachment 240674 [details] [review] file: do not reverse collated order for files with same search rank When two search results rank equally, we fall back to the collated order. Since search is usually ranked reversed (highest at the top), we need to ensure we don't accidentally reverse the collated order as well.
Created attachment 240675 [details] [review] query: rank prefix matches lower than exact matches Count how many letters are left after the string occurrence, and subtract that from the match score.
Created attachment 240676 [details] [review] search-hit: add a missing break