After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 642773 - Make file search non-case sensitive
Make file search non-case sensitive
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: GtkFileChooser
unspecified
Other All
: Normal normal
: ---
Assigned To: gtk-bugs
Federico Mena Quintero
Depends on:
Blocks:
 
 
Reported: 2011-02-19 18:31 UTC by Vincent Untz
Modified: 2011-06-06 15:40 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gtksearchenginetracker: Use non-case sensitive search for non-fts search (1.55 KB, patch)
2011-02-19 18:31 UTC, Vincent Untz
none Details | Review

Description Vincent Untz 2011-02-19 18:31:16 UTC
I think most people doing a search on files don't expect the search to be case sensitive: when I'm in a search entry, if I type 'gnome', I also expect to see results for 'GNOME'.

As far as I can tell, the fallback (simple) backend already does this.

I'm attaching a patch for the tracker backend. We probably want to check other backends too, if we adopt this behavior.
Comment 1 Vincent Untz 2011-02-19 18:31:18 UTC
Created attachment 181347 [details] [review]
gtksearchenginetracker: Use non-case sensitive search for non-fts search
Comment 2 Martyn Russell 2011-02-20 11:06:16 UTC
Upon initial inspection, this patch looks good to me.

Will commit when I get a chance to test it.
Comment 3 Matthias Clasen 2011-02-20 21:54:45 UTC
fwiw, sounds like a good idea to me.
Comment 4 Matthias Clasen 2011-06-01 00:48:09 UTC
Martyn, any update on this ?
Comment 5 Matthias Clasen 2011-06-01 00:49:13 UTC
Martyn, any update on this ?
Comment 6 Martyn Russell 2011-06-06 15:40:39 UTC
(In reply to comment #5)
> Martyn, any update on this ?

Just committed this, thanks for the kick Matthias.

(In reply to comment #1)
> Created an attachment (id=181347) [details] [review]
> gtksearchenginetracker: Use non-case sensitive search for non-fts search

Superb patch, I have tested it with the gtk-3.0 branch too (and cherry-picked for master), works perfectly:

--

martyn@Petunia:~/Source/gtk+/demos/gtk-demo$ export TRACKER_VERBOSITY=3
martyn@Petunia:~/Source/gtk+/demos/gtk-demo$ ./gtk3-demo 
#Gtk-Message: Failed to load module "canberra-gtk-module"
Gtk-Message: Failed to load module "canberra-gtk-module"
(lt-gtk3-demo:11258): Gtk-DEBUG: Loaded Tracker library and all required symbols
(lt-gtk3-demo:11258): Gtk-DEBUG: Creating GtkSearchEngineTracker...
(lt-gtk3-demo:11258): Tracker-DEBUG: tracker-backend.vala:33: Waiting for service to become available...
(lt-gtk3-demo:11258): Tracker-DEBUG: tracker-backend.vala:41: Service is ready
(lt-gtk3-demo:11258): Tracker-DEBUG: tracker-backend.vala:43: Constructing connection, direct_only=false
(lt-gtk3-demo:11258): Tracker-DEBUG: tracker-backend.vala:171: Using backend = 'AUTO'
(lt-gtk3-demo:11258): Tracker-DEBUG: Locale 'TRACKER_LOCALE_LANGUAGE' was set to 'en_GB.utf8'
(lt-gtk3-demo:11258): Tracker-DEBUG: Locale 'TRACKER_LOCALE_TIME' was set to 'en_GB.utf8'
(lt-gtk3-demo:11258): Tracker-DEBUG: Locale 'TRACKER_LOCALE_COLLATE' was set to 'en_GB.utf8'
(lt-gtk3-demo:11258): Tracker-DEBUG: Locale 'TRACKER_LOCALE_NUMERIC' was set to 'en_GB.utf8'
(lt-gtk3-demo:11258): Tracker-DEBUG: Locale 'TRACKER_LOCALE_MONETARY' was set to 'en_GB.utf8'
Tracker-Message: Setting database locations
Tracker-Message: Checking database files exist
Tracker-Message: Opened sqlite3 database:'/home/martyn/.cache/tracker/meta.db'
(lt-gtk3-demo:11258): Tracker-DEBUG: Resetting collator in db interface 0x7f578c0338d0
(lt-gtk3-demo:11258): Tracker-DEBUG: [libunistring collation] Initializing collator for locale 'en_GB.utf8'
(lt-gtk3-demo:11258): Tracker-DEBUG: Preparing query: 'PRAGMA journal_mode = WAL;'
Tracker-Message:   Setting page size to 8192
Tracker-Message:   Setting cache size to 250
Tracker-Message: Setting up monitor for changes to config file:'/home/martyn/.config/tracker/tracker-fts.cfg'
Tracker-Message: Loading defaults into GKeyFile...
(lt-gtk3-demo:11258): Tracker-DEBUG: tracker-backend.vala:45: Backend is ready
(lt-gtk3-demo:11258): Gtk-DEBUG: Query starting, search criteria:'GTK', location:'(null)'
(lt-gtk3-demo:11258): Tracker-DEBUG: tracker-backend.vala:86: Tracker.Sparql.Backend.query_async(): 'SELECT nie:url(?urn) WHERE {  ?urn a nfo:FileDataObject ;    tracker:available true .  FILTER (fn:contains(fn:lower-case(nfo:fileName(?urn)),"gtk"))} ORDER BY DESC(nie:url(?urn)) DESC(nfo:fileName(?urn))'
(lt-gtk3-demo:11258): Tracker-DEBUG: Preparing query: 'SELECT (SELECT "nie:url" FROM "nie:DataObject" WHERE ID = "1_u") COLLATE TRACKER FROM (SELECT "nfo:FileDataObject1"."ID" AS "1_u", 1 FROM "nfo:FileDataObject" AS "nfo:FileDataObject1", "nie:DataObject" AS "nie:DataObject2" WHERE "nfo:FileDataObject1"."ID" = "nie:DataObject2"."ID" AND "nie:DataObject2"."tracker:available" = ? AND (SparqlLowerCase ((SELECT "nfo:fileName" FROM "nfo:FileDataObject" WHERE ID = "1_u") COLLATE TRACKER) GLOB ?)) ORDER BY (SELECT "nie:url" FROM "nie:DataObject" WHERE ID = "1_u") COLLATE TRACKER DESC, (SELECT "nfo:fileName" FROM "nfo:FileDataObject" WHERE ID = "1_u") COLLATE TRACKER DESC'
(lt-gtk3-demo:11258): Gtk-DEBUG: Query returned cursor:0x1c00920


(lt-gtk3-demo:11258): Gtk-DEBUG: Query stopping
Tracker-Message: Closed sqlite3 database:'/home/martyn/.cache/tracker/meta.db'
(lt-gtk3-demo:11258): Gtk-DEBUG: Creating GtkSearchEngineTracker...
(lt-gtk3-demo:11258): Tracker-DEBUG: tracker-backend.vala:33: Waiting for service to become available...
(lt-gtk3-demo:11258): Tracker-DEBUG: tracker-backend.vala:41: Service is ready
(lt-gtk3-demo:11258): Tracker-DEBUG: tracker-backend.vala:43: Constructing connection, direct_only=false
(lt-gtk3-demo:11258): Tracker-DEBUG: tracker-backend.vala:171: Using backend = 'AUTO'
Tracker-Message: Setting database locations
Tracker-Message: Checking database files exist
Tracker-Message: Opened sqlite3 database:'/home/martyn/.cache/tracker/meta.db'
(lt-gtk3-demo:11258): Tracker-DEBUG: Resetting collator in db interface 0x7f578c033a30
(lt-gtk3-demo:11258): Tracker-DEBUG: [libunistring collation] Initializing collator for locale 'en_GB.utf8'
(lt-gtk3-demo:11258): Tracker-DEBUG: Preparing query: 'PRAGMA journal_mode = WAL;'
Tracker-Message:   Setting page size to 8192
Tracker-Message:   Setting cache size to 250
Tracker-Message: Setting up monitor for changes to config file:'/home/martyn/.config/tracker/tracker-fts.cfg'
Tracker-Message: Loading defaults into GKeyFile...
(lt-gtk3-demo:11258): Tracker-DEBUG: tracker-backend.vala:45: Backend is ready
(lt-gtk3-demo:11258): Gtk-DEBUG: Query starting, search criteria:'sliff', location:'(null)'
(lt-gtk3-demo:11258): Tracker-DEBUG: tracker-backend.vala:86: Tracker.Sparql.Backend.query_async(): 'SELECT nie:url(?urn) WHERE {  ?urn a nfo:FileDataObject ;    tracker:available true .  FILTER (fn:contains(fn:lower-case(nfo:fileName(?urn)),"sliff"))} ORDER BY DESC(nie:url(?urn)) DESC(nfo:fileName(?urn))'
(lt-gtk3-demo:11258): Tracker-DEBUG: Preparing query: 'SELECT (SELECT "nie:url" FROM "nie:DataObject" WHERE ID = "1_u") COLLATE TRACKER FROM (SELECT "nfo:FileDataObject1"."ID" AS "1_u", 1 FROM "nfo:FileDataObject" AS "nfo:FileDataObject1", "nie:DataObject" AS "nie:DataObject2" WHERE "nfo:FileDataObject1"."ID" = "nie:DataObject2"."ID" AND "nie:DataObject2"."tracker:available" = ? AND (SparqlLowerCase ((SELECT "nfo:fileName" FROM "nfo:FileDataObject" WHERE ID = "1_u") COLLATE TRACKER) GLOB ?)) ORDER BY (SELECT "nie:url" FROM "nie:DataObject" WHERE ID = "1_u") COLLATE TRACKER DESC, (SELECT "nfo:fileName" FROM "nfo:FileDataObject" WHERE ID = "1_u") COLLATE TRACKER DESC'
(lt-gtk3-demo:11258): Gtk-DEBUG: Query returned cursor:0x1c00920

--

This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.