[tracker/tracker-0.6] Add full text search optional and enabled by default



commit 2cddd9f3ab429cc93ffe57a42d1ba3e00704d99e
Author: Martyn Russell <martyn imendio com>
Date:   Thu May 7 16:04:26 2009 +0100

    Add full text search optional and enabled by default
---
 configure.ac                          |   23 ++++++++++++++++++++++-
 src/tracker-indexer/tracker-indexer.c |    7 ++++++-
 2 files changed, 28 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index 12c99d5..b1acf8b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -270,7 +270,6 @@ fi
 AC_SUBST(GCOV_CFLAGS)
 AC_SUBST(GCOV_LIBS)
 
-
 ####################################################################
 # Should we build GLib based unit tests
 ####################################################################
@@ -566,6 +565,21 @@ if test "$have_inotify" = "yes" ; then
 fi
 
 ####################################################################
+#  Full Text Search (FTS)
+####################################################################
+
+AC_ARG_ENABLE([fts],
+              AS_HELP_STRING([--disable-fts], 
+	                     [disable full text search support [[default=no]]]),,
+              [enable_fts=yes])
+
+AM_CONDITIONAL(ENABLE_FTS, test "$enable_fts" = "yes")
+
+if test "$enable_fts" = "yes" ; then
+   AC_DEFINE(ENABLE_FTS, 1, [Define if we enable FTS support])
+fi
+
+####################################################################
 #  SQLite checks
 ####################################################################
 
@@ -581,6 +595,12 @@ AC_ARG_ENABLE([sqlite_fts],
 	                     [enable SQLite FTS support [[default=no]]]),,
               [enable_sqlite_fts=no])
 
+if test "x$enable_sqlite_fts" = "xyes"; then
+   if test "x$enable_fts" != "xyes"; then
+      AC_MSG_ERROR([Couldn't enable SQLite FTS support, FTS has been disabled.])
+   fi
+fi
+
 if test "x$enable_sqlite_fts" != "xyes" ; then
    enable_sqlite_fts="no  (disabled)"
 else
@@ -1421,6 +1441,7 @@ Build Configuration:
 
 	Enable unit tests:			$have_unit_tests
 	Enable unac accent stripper:	  	$have_unac
+	Enable full text search:               	$enable_fts
 
 	Support for file monitoring:           	gio (w/ libinotify: $have_inotify)
 	Support for ioprio:			$have_ioprio
diff --git a/src/tracker-indexer/tracker-indexer.c b/src/tracker-indexer/tracker-indexer.c
index 7ba818c..ecc63f3 100644
--- a/src/tracker-indexer/tracker-indexer.c
+++ b/src/tracker-indexer/tracker-indexer.c
@@ -2219,7 +2219,6 @@ item_process (TrackerIndexer *indexer,
 	      const gchar    *basename)
 {
 	TrackerModuleMetadata *metadata;
-	gchar *text;
 
 	metadata = tracker_module_file_get_metadata (info->module_file);
 
@@ -2232,7 +2231,13 @@ item_process (TrackerIndexer *indexer,
 	}
 
 	if (metadata) {
+		gchar *text;
+
+#ifdef ENABLE_FTS
 		text = tracker_module_file_get_text (info->module_file);
+#else  /* ENABLE_FTS */
+		text = NULL;
+#endif /* ENABLE_FTS */
 
 		if (tracker_module_file_is_cancelled (info->module_file)) {
 			g_object_unref (metadata);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]