Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sorting is not prefering name matches #77

Closed
aleixpol opened this issue Sep 21, 2016 · 2 comments
Closed

Sorting is not prefering name matches #77

aleixpol opened this issue Sep 21, 2016 · 2 comments
Labels

Comments

@aleixpol
Copy link
Collaborator

For example, looking for writer doesn't prioritize libreoffice writer.over calligra author.

$ appstreamcli search writer
Identifier: gco.desktop [desktop]
Name: GNOME Comics Organizer
Summary: A GNOME interface for managing your comic book collection
Package: gco
Icon: gco_gco-gco.png
----
Identifier: author.desktop [desktop]
Name: Calligra Author
Summary: Write ebooks and textbooks
Package: calligraauthor
Icon: calligraauthor_calligraauthor.png
----
Identifier: org.gnome.MultiWriter.desktop [desktop]
Name: MultiWriter
Summary: Write an ISO file to multiple USB devices at once
Package: gnome-multi-writer
Homepage: https://wiki.gnome.org/Apps/MultiWriter
Icon: gnome-multi-writer_gnome-multi-writer.png
----
Identifier: libreoffice-writer.desktop [desktop]
Name: LibreOffice Writer
Summary: Create and edit text and graphics in letters, reports, documents and Web pages by using Writer.
Package: libreoffice-writer
Homepage: http://www.libreoffice.org/discover/writer/
Icon: libreoffice-writer_libreoffice-writer.png
----
@larryprice
Copy link
Contributor

larryprice commented Sep 29, 2016

It looks to me like it is preferring names but in reverse, which I assumed was by design.

In fact, the sorting line that is used specifically sorts the search results by score, as seen here: https://github.com/ximion/appstream/blob/master/src/as-pool.c#L1051

Furthermore, there is a comment in the as_pool_search function which states the results will be unordered, though it definitely uses the as_sort_components_by_score_cb sorting function to order the results by score.

So it's really just a question of what is the preferred way to return search results? I also would have expected them to be sorted from highest score match to lowest.

larryprice added a commit to larryprice/appstream that referenced this issue Sep 29, 2016
@ximion
Copy link
Owner

ximion commented Sep 29, 2016

Indeed, I made a mistake there :-)
Thanks for looking into this and providing a patch!

ximion pushed a commit that referenced this issue Sep 29, 2016
@ximion ximion added the bug label Sep 29, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants