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

Sort search results by highest to lowest match scores #80

Merged
merged 1 commit into from Sep 29, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -1045,7 +1045,8 @@ as_pool_build_search_terms (AsPool *pool, const gchar *search)
/**
* as_sort_components_by_score_cb:
*
* Helper method to sort result arrays by the #AsComponent match score.
* Helper method to sort result arrays by the #AsComponent match score
* with higher scores appearing higher in the list.
*/
static gint
as_sort_components_by_score_cb (gconstpointer a, gconstpointer b)
@@ -1056,9 +1057,9 @@ as_sort_components_by_score_cb (gconstpointer a, gconstpointer b)
s1 = as_component_get_sort_score (cpt1);
s2 = as_component_get_sort_score (cpt2);

if (s1 < s2)
return -1;
if (s1 > s2)
return -1;
if (s1 < s2)
return 1;
return 0;
}
@@ -1069,7 +1070,7 @@ as_sort_components_by_score_cb (gconstpointer a, gconstpointer b)
* @search: A search string
*
* Search for a list of components matching the search terms.
* The list will be unordered.
* The list will be ordered by match score.
*
* Returns: (transfer container) (element-type AsComponent): an array of the found #AsComponent objects.
*