summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'gnome-extra/gnome-documents/files')
-rw-r--r--gnome-extra/gnome-documents/files/gnome-documents-searchspeed.patch58
1 files changed, 58 insertions, 0 deletions
diff --git a/gnome-extra/gnome-documents/files/gnome-documents-searchspeed.patch b/gnome-extra/gnome-documents/files/gnome-documents-searchspeed.patch
new file mode 100644
index 0000000..014c2c1
--- /dev/null
+++ b/gnome-extra/gnome-documents/files/gnome-documents-searchspeed.patch
@@ -0,0 +1,58 @@
+From 0596135f44b1edaaea6dd7398d109cd3662efa88 Mon Sep 17 00:00:00 2001
+From: "Owen W. Taylor" <otaylor@fishsoup.net>
+Date: Mon, 26 Mar 2012 17:47:45 -0400
+Subject: [PATCH] FTS: proof of concept patch
+
+https://bugzilla.gnome.org/show_bug.cgi?id=672690
+---
+ src/query.js | 11 +++++++++--
+ src/searchbar.js | 12 ++++++++++++
+ 2 files changed, 21 insertions(+), 2 deletions(-)
+
+diff --git a/src/query.js b/src/query.js
+index 7596512..0e91131 100644
+--- a/src/query.js
++++ b/src/query.js
+@@ -140,8 +140,15 @@ QueryBuilder.prototype = {
+
+ _buildQueryInternal: function(global, flags) {
+ let globalSparql =
+- 'WHERE { ?urn a rdfs:Resource ' +
+- this._buildOptional();
++ 'WHERE { ?urn a rdfs:Resource ';
++
++ if ((flags & QueryFlags.UNFILTERED) == 0) {
++ let ftsclause = Global.searchMatchManager.getFTS();
++ if (ftsclause != null)
++ globalSparql += '; ' + ftsclause + ' ';
++ }
++
++ globalSparql += this._buildOptional();
+
+ if (global) {
+ if ((flags & QueryFlags.UNFILTERED) == 0)
+diff --git a/src/searchbar.js b/src/searchbar.js
+index 89c1b8b..a979074 100644
+--- a/src/searchbar.js
++++ b/src/searchbar.js
+@@ -216,6 +216,18 @@ SearchMatchManager.prototype = {
+ this.setActiveItemById(SearchMatchStock.ALL);
+ },
+
++ getFTS: function() {
++ let terms = Global.searchController.getTerms();
++ if (terms.length == 0 || (terms.length == 1 && terms[0] == ''))
++ return null;
++
++ let starterms = [];
++ for (let i = 0; i < terms.length; i++)
++ starterms.push(terms[i] + '*');
++
++ return 'fts:match "' + starterms.join(' ') + '"';
++ },
++
+ getFilter: function() {
+ let terms = Global.searchController.getTerms();
+ let filters = [];
+--
+1.7.9.3 \ No newline at end of file