Blame SOURCES/search-engine-tracker-Fix-broken-query-under-some-lo.patch

d677c0
From 7018cdcaa9954271cd82ba1c2620ecdfea176fae Mon Sep 17 00:00:00 2001
d677c0
From: Cristiano Nunes <cfgnunes@gmail.com>
d677c0
Date: Tue, 7 Apr 2020 14:47:41 +0000
d677c0
Subject: [PATCH] search-engine-tracker: Fix broken query under some locales
d677c0
d677c0
We set a 5.0 rank for filename matches in the SPARQL query as a float
d677c0
argument in a format string.
d677c0
d677c0
However, the floats in format strings are translated with the decimal
d677c0
separator from the locale. This means in some locales the rank has a
d677c0
comma instead of a dot, which results in a query error. In turn, this
d677c0
effectively broke the shell search provider.
d677c0
d677c0
Instead of using a format specifier and passing the value as an
d677c0
argument, we should just use compile-time concatenation to insert '5.0'
d677c0
in the query unmodified.
d677c0
d677c0
Fixes https://gitlab.gnome.org/GNOME/nautilus/-/issues/1412 and #1437
d677c0
d677c0
Cherry-picked from 7f00ede9b410e88106cef34c634cb46e46015e37
d677c0
---
d677c0
 src/nautilus-search-engine-tracker.c | 7 +++----
d677c0
 1 file changed, 3 insertions(+), 4 deletions(-)
d677c0
d677c0
diff --git a/src/nautilus-search-engine-tracker.c b/src/nautilus-search-engine-tracker.c
d677c0
index 32b6039a9..571467a25 100644
d677c0
--- a/src/nautilus-search-engine-tracker.c
d677c0
+++ b/src/nautilus-search-engine-tracker.c
d677c0
@@ -287,7 +287,7 @@ search_finished_idle (gpointer user_data)
d677c0
 }
d677c0
 
d677c0
 /* This is used to compensate rank if fts:rank is not set (resp. fts:match is
d677c0
- * not used). The value was determined experimentally. I am conviced that
d677c0
+ * not used). The value was determined experimentally. I am convinced that
d677c0
  * fts:rank is currently always set to 5.0 in case of filename match.
d677c0
  */
d677c0
 #define FILENAME_RANK 5.0
d677c0
@@ -372,10 +372,9 @@ nautilus_search_engine_tracker_start (NautilusSearchProvider *provider)
d677c0
                             " {"
d677c0
                             " ?urn nfo:fileName ?filename ."
d677c0
                             " FILTER(fn:contains(fn:lower-case(?filename), '%s')) ."
d677c0
-                            " BIND(%f AS ?rank2) ."
d677c0
+                            " BIND(" FILENAME_RANK " AS ?rank2) ."
d677c0
                             " }",
d677c0
-                            search_text,
d677c0
-                            FILENAME_RANK);
d677c0
+                            search_text);
d677c0
 
d677c0
     g_string_append_printf (sparql, " . FILTER( ");
d677c0
 
d677c0
-- 
d677c0
2.26.2
d677c0