Bug 313596 - muon package manager search results are not sorted properly on package name
Summary: muon package manager search results are not sorted properly on package name
Status: RESOLVED FIXED
Alias: None
Product: muon
Classification: Unmaintained
Component: muon (show other bugs)
Version: 2.0.65
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: Jonathan Thomas
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-01-20 22:54 UTC by dmatt
Modified: 2017-02-01 21:59 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description dmatt 2013-01-20 22:54:52 UTC
Tested with muon package manager 1.9.65
When Muon package manager is started, all available packages are listed in ascending alphabetical order, as indicated by caret sign (^) in column title "Packages".

When search keyword is entered, package names are no longer sorted, but caret symbol is still there. Column title needs to be pressed to sort package names, but this click at the same time switches sorting to descending order. Next press shows correct ascending order.

When new search keyword is entered, the same problem occurs. Sorting setting is not retained.

Works correctly on "Status" or "Requested" columns, all searches appear sorted when entered.

Reproducible: Always

Steps to Reproduce:
1.Start Muon package manager
2.Enter any search keyword, results are not sorted
3.Change sorting to descending by clicking on column name "Package"
4. Enter different keyword, result are again not sorted
Actual Results:  
By default every search result is not sorted, if sorting is set on package name.

Expected Results:  
All results are sorted on package name.
Comment 1 Solerman Kaplon 2013-05-24 14:58:32 UTC
Still present in 1.9.97, doesn't work sorting status as well (like, filter by origin and try to sort status to see which packages as upgradeable)
Comment 2 dmatt 2013-07-01 21:30:07 UTC
still present in 2.0.65
Comment 3 Rik Mills 2016-08-24 17:28:40 UTC
Still present in muon version 5.6.0 (Kubuntu Yakkety)
Comment 4 Carlo Vanini 2016-09-01 12:26:33 UTC
When the list is sorted by package name and you perform a search, the search results are sorted by relevance (whatever that means, according to xapian). The point seems to be that the search is performed also on description and not only on name (btw, you can use e.g. name:grub to search only by name). It's a feature, not a bug! ;)

Another reason (documented in the code) is that this is the order returned by xapian (i.e. the library doing the actual search), and re-sorting the list is costly. Consider that the search can be repeated multiple times while you type, and every time we would have to sort the list.

Need to take a deeper look at xapian to find a solution.
Comment 5 Solerman Kaplon 2016-09-01 14:42:37 UTC
Well, if sorting after search is costly, maybe disable the column click so that the user doesn't get the impression that sorting is going to do anything useful
Comment 6 Carlo Vanini 2017-02-01 21:59:05 UTC
Git commit 63c63848589fc011d2fd39e36351d592d9bfab63 by Carlo Vanini.
Committed on 01/02/2017 at 21:34.
Pushed by vanini into branch 'master'.

fix when sort indicator is shown in list header

When starting a new search in the package list, and the list is sorted
by name, then the results are sorted by relevancy and the indicator is
hidden. Clicking on a column header changes the order wrt the selected
column.

Testing Done:
Test 1
------

* Click on 'Status' header
* Search for 'fri' (gives meaningful result to see the order)
* Result is sorted by status and then by name

Test 2
------

* Clear search string, click on 'Package' header
* Search for 'fri'
* Sort indicator is hidden, result is sorted by relevancy
* Click on a header
* Result is order by selected column, indicator is shown
* Continue writing in search string, 'fritz'
* Result is still ordered by column
* Clearing search string and fill it again
* Search result is sorted by relevancy
REVIEW: 129904

M  +8    -1    src/PackageModel/PackageProxyModel.cpp
M  +1    -0    src/PackageModel/PackageProxyModel.h
M  +25   -0    src/PackageModel/PackageViewHeader.cpp
M  +3    -0    src/PackageModel/PackageViewHeader.h
M  +2    -3    src/PackageModel/PackageWidget.cpp

https://commits.kde.org/muon/63c63848589fc011d2fd39e36351d592d9bfab63