Commit 7e1924f0 authored by Jamie McCracken's avatar Jamie McCracken

various small fixes

svn path=/trunk/; revision=666
parent 31ac446d
2007-07-17 Patch from Tshepang Lekhonkhobe <tshepang@gmail.com>
* updated README
2007-07-17 Patch from Marcus Fritzsch <fritschy at googlemail com>
* Added MaxTextWords limit to config
* small compiler warning fixes
2007-07-17 Jamie McCracken <jamiemcc at gnome org>
* Fixed metadata tile to display for all cats
......
......@@ -339,4 +339,5 @@ for various fields. It prints to STDOUT all matching files. You can see some
example queries in the RDF-Query-examples folder. You can run the examples as
"tracker-query < RDFFILE"
"tracker-status" - queries status of trackerd
......@@ -55,7 +55,7 @@ tracker_get_all_keywords (TrackerClient *tracker_client)
out_array = tracker_keywords_get_list (tracker_client, SERVICE_FILES, &error);
if (!error && out_array) {
gchar *name = NULL;
gint i;
guint i;
for (i = 0; i < out_array->len; i++) {
name = ((gchar **)out_array->pdata[i])[0];
if (strlen (name) > 2)
......
......@@ -1366,12 +1366,12 @@ tracker_search_metadata_by_text_async (TrackerClient *client, const char *query,
char *metadata;
char *keywords[2];
if(strstr(query, ":") > 0){
if (strchr (query, ':') != NULL) {
metadata = strtok ((char *)query, ":");
if(strcoll(metadata,"tag") == 0){
keywords[0] = strtok (NULL, ":");
keywords[1] = NULL;
client->last_pending_call = org_freedesktop_Tracker_Keywords_search_async (client->proxy_keywords, -1, "Files", (char **)keywords, 0, 512, tracker_array_reply, callback_struct);
client->last_pending_call = org_freedesktop_Tracker_Keywords_search_async (client->proxy_keywords, -1, "Files", (const char **)keywords, 0, 512, tracker_array_reply, callback_struct);
}
}else{
client->last_pending_call = org_freedesktop_Tracker_Search_text_async (client->proxy_search, -1, "Files", query, 0, 512, tracker_array_reply, callback_struct);
......
......@@ -362,6 +362,8 @@ set_snippet (char * snippet, GError *error, gpointer user_data)
GtkTreeIter iter;
SnippetRow *snippet_row = user_data;
g_return_if_fail (error == NULL);
snippet_markup = g_strdup_printf ("<span size='small'>%s</span>", snippet);
if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (snippet_row->gsearch->search_results_list_store), &iter)) {
......
......@@ -393,7 +393,7 @@ tracker_get_field_count (char ***result)
char **row, **p;
int i;
if (!result || tracker_get_row_count == 0) {
if (!result) {
return 0;
}
......@@ -661,7 +661,7 @@ tracker_db_attach_db (DBConnection *db_con, const char *name)
} else if (strcmp (name, "cache") == 0) {
char *path = g_build_filename (tracker->sys_tmp_root_dir, "cache.db", NULL);
char *sql = g_strdup_printf ("ATTACH '%s' as %s", path, name);
sql = g_strdup_printf ("ATTACH '%s' as %s", path, name);
g_free (path);
tracker_db_exec_no_reply (db_con, sql);
......@@ -2214,7 +2214,7 @@ save_full_text (DBConnection *blob_db_con, const char *str_file_id, const char *
value = compressed;
} else {
tracker_error ("WARNING: compression of %s has failed", value);
tracker_error ("WARNING: compression has failed");
value = g_strdup (text);
bytes_compressed = length;
}
......@@ -2833,14 +2833,13 @@ tracker_get_related_metadata_names (DBConnection *db_con, const char *name)
res = tracker_exec_proc (db_con, "GetMetadataAliasesForName", 2, name, name);
int k = 0;
GString *str;
str = g_string_new ("");
if (res) {
int k = 0;
GString *str;
char **row;
str = g_string_new ("");
while ((row = tracker_db_get_row (res, k))) {
if (row[1]) {
if (k==0) {
......@@ -3297,7 +3296,7 @@ tracker_db_set_metadata (DBConnection *db_con, const char *service, const char *
if (!values[0]) break;
save_full_text (db_con->blob, id, values[i], strlen (values[0]));
save_full_text (db_con->blob, id, values[0], strlen (values[0]));
new_value = values[0];
break;
......
......@@ -572,7 +572,7 @@ void
tracker_add_query_word (SearchQuery *query, const char *word, WordType word_type)
{
if (!word || word[0] == 0 || word == " ") {
if (!word || word[0] == 0 || (word[0] == ' ' && word[1] == 0)) {
return;
}
......
......@@ -554,7 +554,7 @@ tracker_parse_text (GHashTable *word_table, const char *txt, int weight, gboolea
total_words++;
if (total_words < 10000) {
if (total_words < tracker->max_words_to_index) {
count = GPOINTER_TO_INT (g_hash_table_lookup (word_table, index_word));
g_hash_table_insert (word_table, index_word, GINT_TO_POINTER (count + weight));
......@@ -589,7 +589,7 @@ tracker_parse_text (GHashTable *word_table, const char *txt, int weight, gboolea
total_words++;
if (total_words < 10000) {
if (total_words < tracker->max_words_to_index) {
count = GPOINTER_TO_INT (g_hash_table_lookup (word_table, word));
......
......@@ -2303,6 +2303,8 @@ tracker_load_config_file ()
"[Performance]\n",
"# Maximum size of text in bytes to index from a file's text contents\n",
"MaxTextToIndex=1048576\n",
"# Maximum number of unique words to index from a file's text contents\n",
"MaxWordsToIndex=10000\n",
"# Specifies the no of entities to index before determining whether to perform index optimization\n",
"OptimizationSweepCount=10000\n",
"# Sets the maximum bucket count for the indexer\n",
......@@ -2488,6 +2490,10 @@ tracker_load_config_file ()
}
if (g_key_file_has_key (key_file, "Performance", "MaxWordsToIndex", NULL)) {
tracker->max_words_to_index = g_key_file_get_integer (key_file, "Performance", "MaxWordsToIndex", NULL);
}
g_free (filename);
......@@ -3177,10 +3183,12 @@ tracker_get_snippet (const char *txt, char **terms, int length)
if (ptr) {
char *snippet = g_strndup (txt, ptr - txt);
char *esc_snippet = g_markup_escape_text (snippet, ptr - txt);
char *highlight_snip = highlight_terms (esc_snippet, terms);
g_free (snippet);
g_free (esc_snippet);
return esc_snippet;
return highlight_snip;
} else {
return NULL;
}
......
......@@ -50,7 +50,8 @@ extern char *tracker_actions[];
#define MAX_INDEX_TEXT_LENGTH 1048576
#define MAX_PROCESS_QUEUE_SIZE 100
#define MAX_EXTRACT_QUEUE_SIZE 500
#define OPTIMIZATION_COUNT 10000
#define OPTIMIZATION_COUNT 10000
#define MAX_WORDS_TO_INDEX 10000
/* default indexer options */
#define MIN_INDEX_BUCKET_COUNT 65536 /* minimum bucket number of word index per division (total buckets = INDEXBNUM * INDEXDIV) */
......@@ -215,6 +216,7 @@ typedef struct {
int battery_throttle;
gboolean use_extra_memory;
int initial_sleep;
int max_words_to_index;
/* indexing options */
int max_index_bucket_count;
......
......@@ -1794,6 +1794,7 @@ set_defaults ()
tracker->max_process_queue_size = MAX_PROCESS_QUEUE_SIZE;
tracker->max_extract_queue_size = MAX_EXTRACT_QUEUE_SIZE;
tracker->optimization_count = OPTIMIZATION_COUNT;
tracker->max_words_to_index = MAX_WORDS_TO_INDEX;
tracker->max_index_bucket_count = MAX_INDEX_BUCKET_COUNT;
tracker->min_index_bucket_count = MIN_INDEX_BUCKET_COUNT;
......@@ -1860,6 +1861,7 @@ sanity_check_option_values ()
if (tracker->max_index_text_length < 0) tracker->max_index_text_length = 0;
if (tracker->max_words_to_index < 0) tracker->max_words_to_index = 0;
if (tracker->optimization_count < 1000) tracker->optimization_count = 1000;
if (tracker->max_index_bucket_count < 1000) tracker->max_index_bucket_count= 1000;
if (tracker->min_index_bucket_count < 1000) tracker->min_index_bucket_count= 1000;
......@@ -1888,6 +1890,8 @@ sanity_check_option_values ()
tracker->throttle = 0;
}
if (tracker->initial_sleep > 1000) tracker->initial_sleep = 1000; /* g_usleep (X * 1000 * 1000) */
char *bools[] = {"no", "yes"};
tracker_log ("Tracker configuration options :");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment