From 4a83601dc9c85ef8ecd3942b7de8898473f49c33 Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Wed, 7 Nov 2018 14:33:51 +0000 Subject: [PATCH] Stem the search text before running the query This allows us to match 'games' for a search term of 'gaming' and 'pony' for 'ponies' -- which increases the quality of search results. We already depend on libxmlb from master, although if using a subproject it may need to be updated manually. --- .gitlab-ci.yml | 1 + plugins/core/gs-appstream.c | 14 +++++++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 825814364..0d99b81b2 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -10,6 +10,7 @@ before_script: - dnf --enablerepo updates-testing -y builddep gnome-software # Some deps may not be sync'd - dnf -y install rpm-ostree-devel + - dnf -y install libstemmer-devel build-gnome-software: stage: build diff --git a/plugins/core/gs-appstream.c b/plugins/core/gs-appstream.c index 4a2742b64..62fef53c8 100644 --- a/plugins/core/gs-appstream.c +++ b/plugins/core/gs-appstream.c @@ -1014,13 +1014,13 @@ gs_appstream_search (GsPlugin *plugin, AsAppSearchMatch match_value; const gchar *xpath; } queries[] = { - { AS_APP_SEARCH_MATCH_MIMETYPE, "mimetypes/mimetype[text()~=?]" }, - { AS_APP_SEARCH_MATCH_PKGNAME, "pkgname[text()~=?]" }, - { AS_APP_SEARCH_MATCH_COMMENT, "summary[text()~=?]" }, - { AS_APP_SEARCH_MATCH_NAME, "name[text()~=?]" }, - { AS_APP_SEARCH_MATCH_KEYWORD, "keywords/keyword[text()~=?]" }, - { AS_APP_SEARCH_MATCH_ID, "id[text()~=?]" }, - { AS_APP_SEARCH_MATCH_ORIGIN, "../components[@origin~=?]" }, + { AS_APP_SEARCH_MATCH_MIMETYPE, "mimetypes/mimetype[text()~=stem(?)]" }, + { AS_APP_SEARCH_MATCH_PKGNAME, "pkgname[text()~=stem(?)]" }, + { AS_APP_SEARCH_MATCH_COMMENT, "summary[text()~=stem(?)]" }, + { AS_APP_SEARCH_MATCH_NAME, "name[text()~=stem(?)]" }, + { AS_APP_SEARCH_MATCH_KEYWORD, "keywords/keyword[text()~=stem(?)]" }, + { AS_APP_SEARCH_MATCH_ID, "id[text()~=stem(?)]" }, + { AS_APP_SEARCH_MATCH_ORIGIN, "../components[@origin~=stem(?)]" }, { AS_APP_SEARCH_MATCH_NONE, NULL } }; -- GitLab