[tracker/fts4: 11/21] fts: Respect max-words configuration setting
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/fts4: 11/21] fts: Respect max-words configuration setting
- Date: Mon, 4 Feb 2013 10:03:02 +0000 (UTC)
commit 4a391c7939e49e71de2bd16016ddb747fde0a893
Author: Carlos Garnacho <carlos lanedo com>
Date: Tue Nov 8 14:59:00 2011 +0100
fts: Respect max-words configuration setting
src/libtracker-fts/tracker-fts-tokenizer.c | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/src/libtracker-fts/tracker-fts-tokenizer.c b/src/libtracker-fts/tracker-fts-tokenizer.c
index 8e8f6fb..dea3884 100644
--- a/src/libtracker-fts/tracker-fts-tokenizer.c
+++ b/src/libtracker-fts/tracker-fts-tokenizer.c
@@ -23,6 +23,7 @@
#include <assert.h>
#include <string.h>
+#include "tracker-fts-tokenizer.h"
#include "tracker-fts-config.h"
#include "tracker-parser.h"
#include "fts3_tokenizer.h"
@@ -45,6 +46,7 @@ struct TrackerCursor {
sqlite3_tokenizer_cursor base;
TrackerTokenizer *tokenizer;
+ guint n_words;
};
/*
@@ -159,6 +161,10 @@ static int trackerNext(
p = cursor->tokenizer;
+ if (cursor->n_words > p->max_words){
+ return SQLITE_DONE;
+ }
+
do {
pToken = tracker_parser_next (p->parser,
piPosition,
@@ -176,6 +182,8 @@ static int trackerNext(
*ppToken = pToken;
}
+ cursor->n_words++;
+
return SQLITE_OK;
}
@@ -195,7 +203,7 @@ static const sqlite3_tokenizer_module trackerTokenizerModule = {
** Set *ppModule to point at the implementation of the tracker tokenizer.
*/
gboolean tracker_tokenizer_initialize (sqlite3 *db) {
- sqlite3_tokenizer_module *pTokenizer;
+ const sqlite3_tokenizer_module *pTokenizer;
int rc = SQLITE_OK;
sqlite3_stmt *stmt;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]