GNOME Bugzilla – Bug 642773
Make file search non-case sensitive
Last modified: 2011-06-06 15:40:39 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.
Created attachment 181347 [details] [review] gtksearchenginetracker: Use non-case sensitive search for non-fts search
Upon initial inspection, this patch looks good to me. Will commit when I get a chance to test it.
fwiw, sounds like a good idea to me.
Martyn, any update on this ?
(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.