tracker r1626 - in branches/xesam-support: . src/libtracker-common src/tracker-indexer src/trackerd
- From: pvanhoof svn gnome org
- To: svn-commits-list gnome org
- Subject: tracker r1626 - in branches/xesam-support: . src/libtracker-common src/tracker-indexer src/trackerd
- Date: Tue, 10 Jun 2008 13:05:41 +0000 (UTC)
Author: pvanhoof
Date: Tue Jun 10 13:05:40 2008
New Revision: 1626
URL: http://svn.gnome.org/viewvc/tracker?rev=1626&view=rev
Log:
* svn merge -r 1618:1625 ../indexer-split
Modified:
branches/xesam-support/ChangeLog
branches/xesam-support/src/libtracker-common/tracker-parser.c
branches/xesam-support/src/tracker-indexer/tracker-indexer-db.c
branches/xesam-support/src/tracker-indexer/tracker-indexer-db.h
branches/xesam-support/src/tracker-indexer/tracker-indexer.c
branches/xesam-support/src/trackerd/tracker-xesam-live-search.c
Modified: branches/xesam-support/src/libtracker-common/tracker-parser.c
==============================================================================
--- branches/xesam-support/src/libtracker-common/tracker-parser.c (original)
+++ branches/xesam-support/src/libtracker-common/tracker-parser.c Tue Jun 10 13:05:40 2008
@@ -335,7 +335,8 @@
gboolean filter_numbers,
gboolean delimit)
{
- const gchar *p = txt;
+ const gchar *p = txt;
+ gchar *parsed_text;
gchar *word = NULL;
guint32 i = 0;
@@ -400,7 +401,8 @@
g_free (attrs);
- return g_string_free (strs, FALSE);
+ parsed_text = g_string_free (strs, FALSE);
+ return g_strstrip (parsed_text);
} else {
GString *str = g_string_new (" ");
@@ -422,7 +424,8 @@
}
if (!p || !*p) {
- return g_string_free (str, FALSE);
+ parsed_text = g_string_free (str, FALSE);
+ return g_strstrip (parsed_text);
}
}
}
Modified: branches/xesam-support/src/tracker-indexer/tracker-indexer-db.c
==============================================================================
--- branches/xesam-support/src/tracker-indexer/tracker-indexer-db.c (original)
+++ branches/xesam-support/src/tracker-indexer/tracker-indexer-db.c Tue Jun 10 13:05:40 2008
@@ -185,18 +185,56 @@
tracker_db_set_metadata (TrackerDBInterface *iface,
guint32 id,
TrackerField *field,
- const gchar *value)
+ const gchar *value,
+ const gchar *parsed_value)
{
gchar *id_str;
id_str = tracker_guint32_to_string (id);
- /* FIXME: determine metadata type */
- tracker_db_interface_execute_procedure (iface, NULL, "SetMetadataKeyword",
- id_str,
- tracker_field_get_id (field),
- value,
- NULL);
+ switch (tracker_field_get_data_type (field)) {
+ case TRACKER_FIELD_TYPE_KEYWORD:
+ tracker_db_interface_execute_procedure (iface, NULL,
+ "SetMetadataKeyword",
+ id_str,
+ tracker_field_get_id (field),
+ value,
+ NULL);
+ break;
+ case TRACKER_FIELD_TYPE_INDEX:
+ case TRACKER_FIELD_TYPE_STRING:
+ case TRACKER_FIELD_TYPE_DOUBLE:
+ tracker_db_interface_execute_procedure (iface, NULL,
+ "SetMetadata",
+ id_str,
+ tracker_field_get_id (field),
+ parsed_value,
+ value,
+ NULL);
+ break;
+ case TRACKER_FIELD_TYPE_INTEGER:
+ case TRACKER_FIELD_TYPE_DATE:
+ tracker_db_interface_execute_procedure (iface, NULL,
+ "SetMetadataNumeric",
+ id_str,
+ tracker_field_get_id (field),
+ value,
+ NULL);
+ break;
+ case TRACKER_FIELD_TYPE_FULLTEXT:
+ /* FIXME: missing DB connection to contents here */
+ /*
+ tracker_db_set_text (iface, id, value);
+ */
+ break;
+ case TRACKER_FIELD_TYPE_BLOB:
+ case TRACKER_FIELD_TYPE_STRUCT:
+ case TRACKER_FIELD_TYPE_LINK:
+ /* not handled */
+ default:
+ break;
+ }
+
g_free (id_str);
}
Modified: branches/xesam-support/src/tracker-indexer/tracker-indexer-db.h
==============================================================================
--- branches/xesam-support/src/tracker-indexer/tracker-indexer-db.h (original)
+++ branches/xesam-support/src/tracker-indexer/tracker-indexer-db.h Tue Jun 10 13:05:40 2008
@@ -39,7 +39,8 @@
void tracker_db_set_metadata (TrackerDBInterface *iface,
guint32 id,
TrackerField *field,
- const gchar *value);
+ const gchar *value,
+ const gchar *parsed_value);
void tracker_db_set_text (TrackerDBInterface *iface,
guint32 id,
const gchar *text);
Modified: branches/xesam-support/src/tracker-indexer/tracker-indexer.c
==============================================================================
--- branches/xesam-support/src/tracker-indexer/tracker-indexer.c (original)
+++ branches/xesam-support/src/tracker-indexer/tracker-indexer.c Tue Jun 10 13:05:40 2008
@@ -381,6 +381,7 @@
{
TrackerField *field;
MetadataForeachData *data;
+ gchar *parsed_value;
gchar **arr;
gint i;
@@ -391,10 +392,14 @@
field = tracker_ontology_get_field_def ((gchar *) key);
data = (MetadataForeachData *) user_data;
- arr = tracker_parser_text_into_array ((gchar *) value,
- data->language,
- tracker_config_get_max_word_length (data->config),
- tracker_config_get_min_word_length (data->config));
+ parsed_value = tracker_parser_text_to_string ((gchar *) value,
+ data->language,
+ tracker_config_get_max_word_length (data->config),
+ tracker_config_get_min_word_length (data->config),
+ tracker_field_get_filtered (field),
+ tracker_field_get_filtered (field),
+ tracker_field_get_delimited (field));
+ arr = g_strsplit (parsed_value, " ", -1);
for (i = 0; arr[i]; i++) {
tracker_index_add_word (data->index,
@@ -404,8 +409,9 @@
tracker_field_get_weight (field));
}
- tracker_db_set_metadata (data->db, data->id, field, (gchar *) value);
+ tracker_db_set_metadata (data->db, data->id, field, (gchar *) value, parsed_value);
+ g_free (parsed_value);
g_strfreev (arr);
}
Modified: branches/xesam-support/src/trackerd/tracker-xesam-live-search.c
==============================================================================
--- branches/xesam-support/src/trackerd/tracker-xesam-live-search.c (original)
+++ branches/xesam-support/src/trackerd/tracker-xesam-live-search.c Tue Jun 10 13:05:40 2008
@@ -538,7 +538,7 @@
ARRAY_OF_INT,
ARRAY_OF_BOOLEAN,
ARRAY_OF_STRING,
- SANE_TYPE
+ SANE_TYPE /* string, float, integer, boolean, datetime */
} OntologyType;
static OntologyType
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]