tracker r2584 - in trunk: . data/services src/libtracker-data src/tracker-extract src/tracker-indexer
- From: mottela svn gnome org
- To: svn-commits-list gnome org
- Subject: tracker r2584 - in trunk: . data/services src/libtracker-data src/tracker-extract src/tracker-indexer
- Date: Wed, 26 Nov 2008 15:20:07 +0000 (UTC)
Author: mottela
Date: Wed Nov 26 15:20:07 2008
New Revision: 2584
URL: http://svn.gnome.org/viewvc/tracker?rev=2584&view=rev
Log:
Added extraction support for multivalued fields
Modified:
trunk/ChangeLog
trunk/data/services/default.metadata
trunk/src/libtracker-data/tracker-rdf-query.c
trunk/src/tracker-extract/tracker-xmp.c
trunk/src/tracker-indexer/tracker-metadata-utils.c
Modified: trunk/data/services/default.metadata
==============================================================================
--- trunk/data/services/default.metadata (original)
+++ trunk/data/services/default.metadata Wed Nov 26 15:20:07 2008
@@ -75,12 +75,14 @@
DisplayName=Subject
Description=specifies the topic of the content of the resource
DataType=index
+MultipleValues=true
[DC:Keywords]
Abstract=true
DisplayName=Keywords
Description=Keywords that are used to tag a resource
DataType=keyword
+MultipleValues=true
[DC:Title]
Abstract=true
Modified: trunk/src/libtracker-data/tracker-rdf-query.c
==============================================================================
--- trunk/src/libtracker-data/tracker-rdf-query.c (original)
+++ trunk/src/libtracker-data/tracker-rdf-query.c Wed Nov 26 15:20:07 2008
@@ -1219,13 +1219,13 @@
data.sql_where = g_string_new ("");
- g_string_append_printf (data.sql_where, " (S.ServiceTypeID in (select TypeId from ServiceTypes where TypeName = '%s' or Parent = '%s')) ", service, service);
+ g_string_append_printf (data.sql_where, "\n WHERE (S.ServiceTypeID in (select TypeId from ServiceTypes where TypeName = '%s' or Parent = '%s')) ", service, service);
/* only search for items on enabled volumes */
- g_string_append (data.sql_where, "AND (S.AuxilaryID = 0 OR S.AuxilaryID IN (SELECT VolumeID FROM Volumes WHERE Enabled = 1)) ");
+ g_string_append_printf (data.sql_where, "AND (S.AuxilaryID = 0 OR S.AuxilaryID IN (SELECT VolumeID FROM Volumes WHERE Enabled = 1)) ");
if (strlen (query) >= 10) {
- g_string_append (data.sql_where, "AND ");
+ g_string_append_printf (data.sql_where, "AND ");
}
if (limit < 1) {
Modified: trunk/src/tracker-extract/tracker-xmp.c
==============================================================================
--- trunk/src/tracker-extract/tracker-xmp.c (original)
+++ trunk/src/tracker-extract/tracker-xmp.c Wed Nov 26 15:20:07 2008
@@ -50,7 +50,7 @@
if (append) {
gchar *orig;
if (g_hash_table_lookup_extended (metadata, key, NULL, (gpointer)&orig )) {
- new_value = g_strconcat (orig, " ", value, NULL);
+ new_value = g_strconcat (orig, "|", value, NULL);
} else {
new_value = g_strdup (value);
}
Modified: trunk/src/tracker-indexer/tracker-metadata-utils.c
==============================================================================
--- trunk/src/tracker-indexer/tracker-metadata-utils.c (original)
+++ trunk/src/tracker-indexer/tracker-metadata-utils.c Wed Nov 26 15:20:07 2008
@@ -312,6 +312,7 @@
gchar **values;
const gchar *service_type;
gint i;
+ TrackerField *field;
service_type = tracker_ontology_get_service_by_mime (mime_type);
if (!service_type) {
@@ -349,17 +350,50 @@
if (!name || !value)
continue;
+
+ field = tracker_ontology_get_field_by_name (name);
- if (!g_utf8_validate (value, -1, NULL)) {
- utf_value = g_locale_to_utf8 (value, -1, NULL, NULL, NULL);
- } else {
- utf_value = g_strdup (value);
+ if (!field) {
+ g_warning ("Field name '%s' isn't described in the ontology", name);
+ continue;
}
+
+ if (tracker_field_get_multiple_values (field)) {
+ GStrv values = NULL;
+ GList *list = NULL;
+ guint i;
+
+ values = g_strsplit (value, "|",-1);
+
+ for (i = 0; values[i]; i++) {
+ if (!g_utf8_validate (values[i], -1, NULL)) {
+ utf_value = g_locale_to_utf8 (values[i], -1, NULL, NULL, NULL);
+ } else {
+ utf_value = g_strdup (values[i]);
+ }
+
+ if (!utf_value)
+ continue;
- if (!utf_value)
- continue;
+ list = g_list_prepend (list, utf_value);
+ }
+
+ g_strfreev (values);
- tracker_data_metadata_insert (metadata, name, utf_value);
+ tracker_data_metadata_insert_values (metadata, name, list);
+
+ } else {
+ if (!g_utf8_validate (value, -1, NULL)) {
+ utf_value = g_locale_to_utf8 (value, -1, NULL, NULL, NULL);
+ } else {
+ utf_value = g_strdup (value);
+ }
+
+ if (!utf_value)
+ continue;
+
+ tracker_data_metadata_insert (metadata, name, utf_value);
+ }
}
g_strfreev (values);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]