summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2015-08-12 14:10:17 +0100
committerRichard Hughes <richard@hughsie.com>2015-08-12 14:10:20 +0100
commit8fd67fa0cca230169e59e0f120c1a30512317f79 (patch)
tree4bcfad391d8ad706dc00b0eeb13c1aab6252c09f
parentb7dcb22b7cc560b6a5261e6d96c13dc32c0194ad (diff)
downloadappstream-glib-8fd67fa0cca230169e59e0f120c1a30512317f79.tar.gz
Do not blacklist the 'desktop' token as this is sometimes legitimate
When building the token cache use the sanitised ID filename (which has no extension suffix) as this removes the word from the cache completely and means we don't have to blacklist it.
-rw-r--r--libappstream-glib/as-app.c4
-rw-r--r--libappstream-glib/as-self-test.c1
-rw-r--r--libappstream-glib/as-utils.c2
3 files changed, 4 insertions, 3 deletions
diff --git a/libappstream-glib/as-app.c b/libappstream-glib/as-app.c
index c5dbdd4..eee6ef5 100644
--- a/libappstream-glib/as-app.c
+++ b/libappstream-glib/as-app.c
@@ -4000,8 +4000,8 @@ as_app_create_token_cache_target (AsApp *app, AsApp *donor)
guint j;
/* add all the data we have */
- if (priv->id != NULL)
- as_app_add_tokens (app, priv->id, "C", 100);
+ if (priv->id_filename != NULL)
+ as_app_add_tokens (app, priv->id_filename, "C", 100);
locales = g_get_language_names ();
for (i = 0; locales[i] != NULL; i++) {
if (g_str_has_suffix (locales[i], ".UTF-8"))
diff --git a/libappstream-glib/as-self-test.c b/libappstream-glib/as-self-test.c
index c014cc2..452f048 100644
--- a/libappstream-glib/as-self-test.c
+++ b/libappstream-glib/as-self-test.c
@@ -3080,6 +3080,7 @@ as_test_store_addons_func (void)
/* check we can search for token from the addon */
g_assert_cmpint (as_app_search_matches (app, "xtest"), >, 0);
+ g_assert_cmpint (as_app_search_matches (app, "eclipse-php"), >, 0);
/* check it marshals back to the same XML */
str = as_store_to_xml (store, 0);
diff --git a/libappstream-glib/as-utils.c b/libappstream-glib/as-utils.c
index a3d9299..4b5f743 100644
--- a/libappstream-glib/as-utils.c
+++ b/libappstream-glib/as-utils.c
@@ -1300,7 +1300,7 @@ as_utils_search_token_valid (const gchar *token)
{
guint i;
const gchar *blacklist[] = {
- "and", "the", "desktop", "application", "for", "you", "your",
+ "and", "the", "application", "for", "you", "your",
"with", "can", "are", "from", "that", "use", "allows", "also",
"this", "other", "all", "using", "has", "some", "like", "them",
"well", "not", "using", "not", "but", "set", "its", "into",