diff options
author | Cristiano Nunes <cfgnunes@gmail.com> | 2020-04-07 14:47:41 +0000 |
---|---|---|
committer | António Fernandes <antoniof@gnome.org> | 2020-05-29 12:35:28 +0100 |
commit | 7f00ede9b410e88106cef34c634cb46e46015e37 (patch) | |
tree | cd494151329e1cd74344104f0f85bbc8e8a5b029 /src | |
parent | 01392db750bf6d9b94665e5507b7785924a276c4 (diff) | |
download | nautilus-7f00ede9b410e88106cef34c634cb46e46015e37.tar.gz |
search-engine-tracker: Fix broken query under some locales
We set a 5.0 rank for filename matches in the SPARQL query as a float
argument in a format string.
However, the floats in format strings are translated with the decimal
separator from the locale. This means in some locales the rank has a
comma instead of a dot, which results in a query error. In turn, this
effectively broke the shell search provider.
Instead of using a format specifier and passing the value as an
argument, we should just use compile-time concatenation to insert '5.0'
in the query unmodified.
Fixes https://gitlab.gnome.org/GNOME/nautilus/-/issues/1412 and #1437
Diffstat (limited to 'src')
-rw-r--r-- | src/nautilus-search-engine-tracker.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/nautilus-search-engine-tracker.c b/src/nautilus-search-engine-tracker.c index c5ec176e5..714afb111 100644 --- a/src/nautilus-search-engine-tracker.c +++ b/src/nautilus-search-engine-tracker.c @@ -287,7 +287,7 @@ search_finished_idle (gpointer user_data) } /* This is used to compensate rank if fts:rank is not set (resp. fts:match is - * not used). The value was determined experimentally. I am conviced that + * not used). The value was determined experimentally. I am convinced that * fts:rank is currently always set to 5 in case of filename match. */ #define FILENAME_RANK 5 @@ -372,10 +372,9 @@ nautilus_search_engine_tracker_start (NautilusSearchProvider *provider) " {" " ?urn nfo:fileName ?filename ." " FILTER(fn:contains(fn:lower-case(?filename), '%s')) ." - " BIND(%d AS ?rank2) ." + " BIND(" FILENAME_RANK " AS ?rank2) ." " }", - search_text, - FILENAME_RANK); + search_text); g_string_append_printf (sparql, " . FILTER( "); |