[gnome-software/1620-search-results-should-priorize-full-matches: 69/69] gs-appstream: Remove the ID token from the search match value
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/1620-search-results-should-priorize-full-matches: 69/69] gs-appstream: Remove the ID token from the search match value
- Date: Tue, 1 Mar 2022 13:23:54 +0000 (UTC)
commit c857c2cc7d2ccb37574e1c05cfbc1f389e4005f0
Author: Milan Crha <mcrha redhat com>
Date: Thu Feb 24 16:00:45 2022 +0100
gs-appstream: Remove the ID token from the search match value
The AS_SEARCH_TOKEN_MATCH_ID is the highest value of the match_value,
but it's (probably) the lowest match for consideration, because there
can be many apps matching words like "GNOME", "Element" and others,
which are part of the app IDs (org.gnome....), thus drop this value
from the match_value, which prioritizes match in the name, as it's
the send highest value in the AsSearchTokenMatch flags.
Closes https://gitlab.gnome.org/GNOME/gnome-software/-/issues/1620
lib/gs-appstream.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
---
diff --git a/lib/gs-appstream.c b/lib/gs-appstream.c
index 0334447c4..05c18a175 100644
--- a/lib/gs-appstream.c
+++ b/lib/gs-appstream.c
@@ -1403,7 +1403,12 @@ gs_appstream_search (GsPlugin *plugin,
continue;
}
g_debug ("add %s", gs_app_get_unique_id (app));
- gs_app_set_match_value (app, match_value);
+
+ /* The match value is used for prioritising results.
+ * Drop the ID token from it as it’s the highest
+ * numeric value but isn’t visible to the user in the
+ * UI, which leads to confusing results ordering. */
+ gs_app_set_match_value (app, match_value & (~AS_SEARCH_TOKEN_MATCH_ID));
gs_app_list_add (list, app);
if (gs_app_get_kind (app) == AS_COMPONENT_KIND_ADDON) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]