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

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