[tracker/fts4] libtracker-data: Fix fts detection when constructing SQL
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/fts4] libtracker-data: Fix fts detection when constructing SQL
- Date: Wed, 14 Dec 2011 11:54:02 +0000 (UTC)
commit 77c378d4af665c3efc81c02c5a1914974f16e576
Author: Carlos Garnacho <carlos lanedo com>
Date: Wed Dec 14 12:46:38 2011 +0100
libtracker-data: Fix fts detection when constructing SQL
It would previously miss the FTS binding, depending on the order
of the clauses. so something like { ?u fts:match 'foo'; a nie:DataObject }
would return results whereas { ?u a nie:DataObject ; fts:match 'foo' }
didn't.
src/libtracker-data/tracker-sparql-pattern.vala | 7 ++-----
1 files changed, 2 insertions(+), 5 deletions(-)
---
diff --git a/src/libtracker-data/tracker-sparql-pattern.vala b/src/libtracker-data/tracker-sparql-pattern.vala
index 93dc166..4072a25 100644
--- a/src/libtracker-data/tracker-sparql-pattern.vala
+++ b/src/libtracker-data/tracker-sparql-pattern.vala
@@ -241,7 +241,6 @@ class Tracker.Sparql.Pattern : Object {
internal SelectContext translate_select (StringBuilder sql, bool subquery = false, bool scalar_subquery = false) throws Sparql.Error {
SelectContext result;
- bool has_fts_match = false;
if (scalar_subquery) {
result = new SelectContext.subquery (query, context);
@@ -289,8 +288,6 @@ class Tracker.Sparql.Pattern : Object {
foreach (var variable in context.var_set.get_keys ()) {
if (variable.binding == null) {
throw get_error ("use of undefined variable `%s'".printf (variable.name));
- } else if (variable.binding.table.sql_db_tablename == "fts") {
- has_fts_match = true;
}
}
@@ -354,7 +351,7 @@ class Tracker.Sparql.Pattern : Object {
// select from results of WHERE clause
- if (has_fts_match) {
+ if (match_str != null) {
sql.append (" FROM fts JOIN (");
sql.append (pattern_sql.str);
@@ -448,7 +445,7 @@ class Tracker.Sparql.Pattern : Object {
query.bindings.append (binding);
}
- if (has_fts_match) {
+ if (match_str != null) {
sql.append (") AS ranks USING (docid)");
sql.append_printf (" WHERE fts %s", match_str.str);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]