tracker r2507 - in branches/uri: . data/db data/services src/libtracker-data src/libtracker-gtk src/tracker-indexer src/tracker-indexer/modules src/trackerd tests/scripts/data
- From: juergbi svn gnome org
- To: svn-commits-list gnome org
- Subject: tracker r2507 - in branches/uri: . data/db data/services src/libtracker-data src/libtracker-gtk src/tracker-indexer src/tracker-indexer/modules src/trackerd tests/scripts/data
- Date: Mon, 17 Nov 2008 15:14:51 +0000 (UTC)
Author: juergbi
Date: Mon Nov 17 15:14:51 2008
New Revision: 2507
URL: http://svn.gnome.org/viewvc/tracker?rev=2507&view=rev
Log:
2008-11-17 JÃrg Billeter <j bitron ch>
* data/db/sqlite-service.sql:
* data/db/sqlite-stored-procs.sql:
* data/db/sqlite-tracker.sql:
* data/db/sqlite-user-data.sql:
* data/services/file.metadata:
* src/libtracker-data/tracker-data-query.c:
* src/libtracker-data/tracker-data-schema.c:
* src/libtracker-data/tracker-data-search.c:
* src/libtracker-data/tracker-data-search.h:
* src/libtracker-data/tracker-data-update.c:
* src/libtracker-data/tracker-rdf-query.c:
* src/libtracker-gtk/tracker-metadata-tile.c:
* src/tracker-indexer/modules/evolution.c:
* src/tracker-indexer/modules/files.c:
* src/tracker-indexer/tracker-metadata-utils.c:
* src/trackerd/tracker-files.c:
* src/trackerd/tracker-search.c:
* tests/scripts/data/common.sql:
Replace Path column in Services table by Uri column storing the
full path or URI, not just the parent path
Modified:
branches/uri/ChangeLog
branches/uri/data/db/sqlite-service.sql
branches/uri/data/db/sqlite-stored-procs.sql
branches/uri/data/db/sqlite-tracker.sql
branches/uri/data/db/sqlite-user-data.sql
branches/uri/data/services/file.metadata
branches/uri/src/libtracker-data/tracker-data-query.c
branches/uri/src/libtracker-data/tracker-data-schema.c
branches/uri/src/libtracker-data/tracker-data-search.c
branches/uri/src/libtracker-data/tracker-data-search.h
branches/uri/src/libtracker-data/tracker-data-update.c
branches/uri/src/libtracker-data/tracker-rdf-query.c
branches/uri/src/libtracker-gtk/tracker-metadata-tile.c
branches/uri/src/tracker-indexer/modules/evolution.c
branches/uri/src/tracker-indexer/modules/files.c
branches/uri/src/tracker-indexer/tracker-metadata-utils.c
branches/uri/src/trackerd/tracker-files.c
branches/uri/src/trackerd/tracker-search.c
branches/uri/tests/scripts/data/common.sql
Modified: branches/uri/data/db/sqlite-service.sql
==============================================================================
--- branches/uri/data/db/sqlite-service.sql (original)
+++ branches/uri/data/db/sqlite-service.sql Mon Nov 17 15:14:51 2008
@@ -3,8 +3,8 @@
(
ID Integer primary key not null,
ServiceTypeID Integer default 0, /* see ServiceTypes table above for ID values. A value of 0 indicates a group resource rather than a service */
- Path Text not null COLLATE UTF8, /* non-file objects should use service name here */
- Name Text default ' ' COLLATE UTF8, /* name of file or object - the combination path and name must be unique for all objects */
+ Uri Text not null COLLATE UTF8, /* URI of file or object */
+ Name Text default ' ' COLLATE UTF8, /* name of file or object */
Enabled Integer default 1,
Mime Text default ' ',
Size Integer default 0,
@@ -36,7 +36,7 @@
Offset Integer default 0, /* last used disk offset for indexable files that always grow (like chat logs) or email offset */
MD5 Text,
- unique (Path, Name)
+ unique (Uri)
);
Modified: branches/uri/data/db/sqlite-stored-procs.sql
==============================================================================
--- branches/uri/data/db/sqlite-stored-procs.sql (original)
+++ branches/uri/data/db/sqlite-stored-procs.sql Mon Nov 17 15:14:51 2008
@@ -6,12 +6,12 @@
/*
* Metadata queries
*/
-GetApplicationByID SELECT (S.Path || '/' || S.Name) AS uri, 'Applications', 'Application', S.KeyMetadata1, S.KeyMetadata2, S.KeyMetadata3 FROM Services S WHERE S.ID = ?;
+GetApplicationByID SELECT S.Uri, 'Applications', 'Application', S.KeyMetadata1, S.KeyMetadata2, S.KeyMetadata3 FROM Services S WHERE S.ID = ?;
GetAllServices SELECT TypeID, TypeName, Parent, PropertyPrefix, Enabled, Embedded, HasMetadata, HasFullText, HasThumbs, ContentMetadata, Database, ShowServiceFiles, ShowServiceDirectories, KeyMetadata1, KeyMetadata2, KeyMetadata3, KeyMetadata4, KeyMetadata5, KeyMetadata6, KeyMetadata7, KeyMetadata8, KeyMetadata9, KeyMetadata10, KeyMetadata11 FROM ServiceTypes;
-GetEmailByID SELECT (S.Path || '/' || S.Name) AS uri, 'Emails', S.Mime, S.KeyMetadata1, S.KeyMetadata2, S.KeyMetadata3 FROM Services S WHERE S.ID = ?;
-GetFileByID SELECT Path, Name, Mime, ServiceTypeID FROM Services WHERE ID = ? AND Enabled = 1;
-GetFileByID2 SELECT (Path || '/' || Name) AS uri, GetServiceName (ServiceTypeID), Mime FROM Services WHERE ID = ? AND Enabled = 1;
-GetFileMTime SELECT M.MetaDataValue FROM Services F inner join ServiceNumericMetaData M ON F.ID = M.ServiceID WHERE F.Path = ? AND F.Name = ? AND M.MetaDataID = (SELECT ID FROM MetaDataTypes WHERE MetaName ='File:Modified');
+GetEmailByID SELECT S.Uri, 'Emails', S.Mime, S.KeyMetadata1, S.KeyMetadata2, S.KeyMetadata3 FROM Services S WHERE S.ID = ?;
+GetFileByID SELECT Uri, Name, Mime, ServiceTypeID FROM Services WHERE ID = ? AND Enabled = 1;
+GetFileByID2 SELECT Uri, GetServiceName (ServiceTypeID), Mime FROM Services WHERE ID = ? AND Enabled = 1;
+GetFileMTime SELECT M.MetaDataValue FROM Services F inner join ServiceNumericMetaData M ON F.ID = M.ServiceID WHERE F.Uri = ? AND M.MetaDataID = (SELECT ID FROM MetaDataTypes WHERE MetaName ='File:Modified');
GetServices SELECT TypeName, Description, Parent FROM ServiceTypes ORDER BY TypeID;
/*
@@ -36,22 +36,20 @@
/*
* File queries
*/
-CreateService INSERT INTO Services (ID, Path, Name, ServiceTypeID, Mime, Size, IsDirectory, IsLink, Offset, IndexTime, AuxilaryID) VALUES (?,?,?,?,?,?,?,?,?,?,?);
+CreateService INSERT INTO Services (ID, Uri, Name, ServiceTypeID, Mime, Size, IsDirectory, IsLink, Offset, IndexTime, AuxilaryID) VALUES (?,?,?,?,?,?,?,?,?,?,?);
-MoveService UPDATE Services SET Path = ?, Name = ? WHERE Path = ? AND Name = ?;
-MoveServiceChildren UPDATE Services SET Path = replace (Path, ?, ?);
-
-SelectFileChild SELECT ID, Path, Name, IsDirectory FROM Services WHERE Path = ?;
+MoveService UPDATE Services SET Uri = ?, Name = ? WHERE Uri = ?;
+MoveServiceChildren UPDATE Services SET Uri = replace (Uri, ?, ?);
DeleteContent DELETE FROM ServiceContents WHERE ServiceID = ? AND MetadataId = ?;
DeleteService1 DELETE FROM Services WHERE ID = ?;
-DeleteServiceRecursively DELETE FROM Services WHERE Path = ? OR Path LIKE ?;
+DeleteServiceRecursively DELETE FROM Services WHERE Uri LIKE ?;
DeleteServiceMetadata DELETE FROM ServiceMetaData WHERE ServiceID = ?;
DeleteServiceKeywordMetadata DELETE FROM ServiceMetaData WHERE ServiceID = ?;
DeleteServiceNumericMetadata DELETE FROM ServiceMetaData WHERE ServiceID = ?;
-GetServiceID SELECT ID, IndexTime, IsDirectory, ServiceTypeID FROM Services WHERE Path = ? AND Name = ?;
-GetByServiceType SELECT DISTINCT F.Path || '/' || F.Name AS uri FROM Services F WHERE F.ServiceTypeID IN (SELECT TypeId FROM ServiceTypes WHERE TypeName = ? OR Parent = ?) LIMIT ?,?;
+GetServiceID SELECT ID, IndexTime, IsDirectory, ServiceTypeID FROM Services WHERE Uri = ?;
+GetByServiceType SELECT DISTINCT F.Uri FROM Services F WHERE F.ServiceTypeID IN (SELECT TypeId FROM ServiceTypes WHERE TypeName = ? OR Parent = ?) LIMIT ?,?;
GetContents SELECT uncompress (Content) FROM ServiceContents WHERE ServiceID = ? AND MetadataID = ? AND Content is not null;
GetFileContents SELECT substr(uncompress (Content), ?, ?) FROM ServiceContents WHERE ServiceID = ?;
GetAllContents SELECT uncompress (Content) FROM ServiceContents WHERE ServiceID = ? AND Content is not null;
Modified: branches/uri/data/db/sqlite-tracker.sql
==============================================================================
--- branches/uri/data/db/sqlite-tracker.sql (original)
+++ branches/uri/data/db/sqlite-tracker.sql Mon Nov 17 15:14:51 2008
@@ -27,9 +27,9 @@
(
ID Integer primary key AUTOINCREMENT not null,
MetadataID Integer not null,
- SourcePath Text,
+ SourceUri Text,
SourceName Text,
- DestPath Text,
+ DestUri Text,
DestName Text
);
@@ -39,10 +39,10 @@
CREATE TABLE BackupServices
(
ID Integer primary key AUTOINCREMENT not null,
- Path Text not null,
+ Uri Text not null,
Name Text,
- unique (Path, Name)
+ unique (Uri)
);
@@ -71,13 +71,13 @@
/* allow aliasing of VFolders with nice names */
CREATE TABLE VFolders
(
- Path Text not null,
+ Uri Text not null,
Name Text not null,
Query text not null,
RDF text,
Type Integer default 0,
active Integer,
- primary key (Path, Name)
+ primary key (Uri)
);
Modified: branches/uri/data/db/sqlite-user-data.sql
==============================================================================
--- branches/uri/data/db/sqlite-user-data.sql (original)
+++ branches/uri/data/db/sqlite-user-data.sql Mon Nov 17 15:14:51 2008
@@ -2,10 +2,10 @@
CREATE TABLE UserServices
(
ID Integer primary key not null,
- Path Text not null,
+ Uri Text not null,
Name Text,
- unique (Path, Name)
+ unique (Uri)
);
Modified: branches/uri/data/services/file.metadata
==============================================================================
--- branches/uri/data/services/file.metadata (original)
+++ branches/uri/data/services/file.metadata Mon Nov 17 15:14:51 2008
@@ -14,11 +14,11 @@
Weight=15
Filtered=false
-[File:Path]
-DisplayName=Path
-Description=File Path
+[File:Uri]
+DisplayName=URI
+Description=File URI
DataType=index
-FieldName=Path
+FieldName=Uri
Parent=DC:Identifier
Weight=1
Filtered=false
Modified: branches/uri/src/libtracker-data/tracker-data-query.c
==============================================================================
--- branches/uri/src/libtracker-data/tracker-data-query.c (original)
+++ branches/uri/src/libtracker-data/tracker-data-query.c Mon Nov 17 15:14:51 2008
@@ -255,7 +255,6 @@
{
TrackerDBResultSet *result_set;
TrackerDBInterface *iface;
- gchar *dir, *name;
guint32 id = 0;
g_return_val_if_fail (path != NULL, 0);
@@ -268,17 +267,11 @@
return 0;
}
- tracker_file_get_path_and_name (path, &dir, &name);
-
result_set = tracker_data_manager_exec_proc (iface,
"GetServiceID",
- dir,
- name,
+ path,
NULL);
- g_free (dir);
- g_free (name);
-
if (result_set) {
tracker_db_result_set_get (result_set, 0, &id, -1);
g_object_unref (result_set);
@@ -313,6 +306,7 @@
{
TrackerDBInterface *iface;
TrackerDBResultSet *result_set;
+ gchar *path;
gchar *db_mtime_str;
guint db_id;
guint db_mtime;
@@ -320,13 +314,14 @@
db_id = db_mtime = 0;
+ path = g_build_path (G_DIR_SEPARATOR_S, dirname, basename, NULL);
+
iface = tracker_db_manager_get_db_interface_by_type (tracker_service_get_name (service),
TRACKER_DB_CONTENT_TYPE_METADATA);
result_set = tracker_db_interface_execute_procedure (iface, NULL,
"GetServiceID",
- dirname,
- basename,
+ path,
NULL);
if (result_set) {
tracker_db_result_set_get (result_set,
@@ -359,16 +354,18 @@
{
TrackerDBInterface *iface;
TrackerDBResultSet *result_set;
+ gchar *path;
guint service_type_id;
+ path = g_build_path (G_DIR_SEPARATOR_S, dirname, basename, NULL);
+
/* We are asking this because the module cannot assign service_type -> probably it is files */
iface = tracker_db_manager_get_db_interface_by_type ("Files",
TRACKER_DB_CONTENT_TYPE_METADATA);
result_set = tracker_db_interface_execute_procedure (iface, NULL,
"GetServiceID",
- dirname,
- basename,
+ path,
NULL);
if (!result_set) {
return 0;
Modified: branches/uri/src/libtracker-data/tracker-data-schema.c
==============================================================================
--- branches/uri/src/libtracker-data/tracker-data-schema.c (original)
+++ branches/uri/src/libtracker-data/tracker-data-schema.c Mon Nov 17 15:14:51 2008
@@ -71,7 +71,7 @@
return g_strdup_printf ("KeyMetadata%d", key_field);
}
- if (strcasecmp (meta_name, "File:Path") == 0) return g_strdup ("Path");
+ if (strcasecmp (meta_name, "File:Uri") == 0) return g_strdup ("Uri");
if (strcasecmp (meta_name, "File:Name") == 0) return g_strdup ("Name");
if (strcasecmp (meta_name, "File:Mime") == 0) return g_strdup ("Mime");
if (strcasecmp (meta_name, "File:Size") == 0) return g_strdup ("Size");
Modified: branches/uri/src/libtracker-data/tracker-data-search.c
==============================================================================
--- branches/uri/src/libtracker-data/tracker-data-search.c (original)
+++ branches/uri/src/libtracker-data/tracker-data-search.c Mon Nov 17 15:14:51 2008
@@ -133,31 +133,27 @@
g_free (str_id);
if (result_set) {
- gchar *path;
guint columns, i;
- tracker_db_result_set_get (result_set, 0, &path, -1);
+ columns = tracker_db_result_set_get_n_columns (result_set);
- columns = tracker_db_result_set_get_n_columns (result_set);
-
- if (G_UNLIKELY (!result)) {
- guint columns;
+ if (G_UNLIKELY (!result)) {
+ guint columns;
- columns = tracker_db_result_set_get_n_columns (result_set);
- result = _tracker_db_result_set_new (columns);
- }
+ columns = tracker_db_result_set_get_n_columns (result_set);
+ result = _tracker_db_result_set_new (columns);
+ }
- _tracker_db_result_set_append (result);
+ _tracker_db_result_set_append (result);
- for (i = 0; i < columns; i++) {
- GValue value = { 0, };
+ for (i = 0; i < columns; i++) {
+ GValue value = { 0, };
- _tracker_db_result_set_get_value (result_set, i, &value);
- _tracker_db_result_set_set_value (result, i, &value);
- g_value_unset (&value);
- }
+ _tracker_db_result_set_get_value (result_set, i, &value);
+ _tracker_db_result_set_set_value (result, i, &value);
+ g_value_unset (&value);
+ }
- g_free (path);
g_object_unref (result_set);
} else {
g_message ("Dud hit for search detected");
@@ -331,7 +327,7 @@
for (i = 0, count = 0; i < hits->len; i++) {
TrackerDBResultSet *result_set2;
TrackerDBIndexItemRank rank;
- gchar *str_id, *path;
+ gchar *str_id, *uri;
rank = g_array_index (hits, TrackerDBIndexItemRank, i);
@@ -343,10 +339,9 @@
g_free (str_id);
if (result_set2) {
- tracker_db_result_set_get (result_set2, 0, &path, -1);
+ tracker_db_result_set_get (result_set2, 0, &uri, -1);
- if (g_str_has_prefix (path, location_prefix) ||
- strcmp (path, location) == 0) {
+ if (g_str_has_prefix (uri, location_prefix)) {
GValue value = { 0, };
if (G_UNLIKELY (!result_set1)) {
@@ -427,7 +422,7 @@
for (i = 0, count = 0; i < hits->len; i++) {
TrackerDBResultSet *result_set2;
TrackerDBIndexItemRank rank;
- gchar *str_id, *path, *mimetype;
+ gchar *str_id, *uri, *mimetype;
rank = g_array_index (hits, TrackerDBIndexItemRank, i);
@@ -440,12 +435,11 @@
if (result_set2) {
tracker_db_result_set_get (result_set2,
- 0, &path,
+ 0, &uri,
2, &mimetype,
-1);
- if ((g_str_has_prefix (path, location_prefix) ||
- strcmp (path, location) == 0) &&
+ if (g_str_has_prefix (uri, location_prefix) &&
tracker_string_in_string_list (mimetype, mime_array) != -1) {
GValue value = { 0, };
@@ -468,7 +462,7 @@
count++;
}
- g_free (path);
+ g_free (uri);
g_free (mimetype);
g_object_unref (result_set2);
}
@@ -498,47 +492,6 @@
return result_set1;
}
-gchar **
-tracker_data_search_files_get (TrackerDBInterface *iface,
- const gchar *folder_path)
-{
- TrackerDBResultSet *result_set;
- GPtrArray *array;
-
- g_return_val_if_fail (TRACKER_IS_DB_INTERFACE (iface), NULL);
- g_return_val_if_fail (folder_path != NULL, NULL);
-
- result_set = tracker_data_manager_exec_proc (iface,
- "SelectFileChild",
- folder_path,
- NULL);
- array = g_ptr_array_new ();
-
- if (result_set) {
- gchar *name, *prefix;
- gboolean valid = TRUE;
-
- while (valid) {
- tracker_db_result_set_get (result_set,
- 1, &prefix,
- 2, &name,
- -1);
-
- g_ptr_array_add (array, g_build_filename (prefix, name, NULL));
-
- g_free (prefix);
- g_free (name);
- valid = tracker_db_result_set_iter_next (result_set);
- }
-
- g_object_unref (result_set);
- }
-
- g_ptr_array_add (array, NULL);
-
- return (gchar**) g_ptr_array_free (array, FALSE);
-}
-
TrackerDBResultSet *
tracker_data_search_files_get_by_service (TrackerDBInterface *iface,
const gchar *service,
@@ -593,7 +546,7 @@
service = "Files";
}
- str = g_string_new ("SELECT DISTINCT F.Path || '/' || F.Name AS uri FROM Services F INNER JOIN ServiceKeywordMetaData M ON F.ID = M.ServiceID WHERE M.MetaDataID = (SELECT ID FROM MetaDataTypes WHERE MetaName ='File:Mime') AND (M.MetaDataValue IN ");
+ str = g_string_new ("SELECT DISTINCT F.Uri FROM Services F INNER JOIN ServiceKeywordMetaData M ON F.ID = M.ServiceID WHERE M.MetaDataID = (SELECT ID FROM MetaDataTypes WHERE MetaName ='File:Mime') AND (M.MetaDataValue IN ");
g_string_append_printf (str, "('%s'", mimes[0]);
@@ -1424,8 +1377,7 @@
/* Build SELECT clause */
sql = g_string_new (" ");
g_string_append_printf (sql,
- "SELECT (F.Path || '%s' || F.Name) as PathName ",
- G_DIR_SEPARATOR_S);
+ "SELECT F.Uri as PathName ");
for (i = 1; i <= g_strv_length (fields); i++) {
gchar *field;
@@ -1472,7 +1424,7 @@
/* Build WHERE clause */
g_string_append_printf (sql,
- " WHERE F.Path = '%s' ",
+ " WHERE F.Uri LIKE '%s/%%' ",
uri_filtered);
g_free (uri_filtered);
Modified: branches/uri/src/libtracker-data/tracker-data-search.h
==============================================================================
--- branches/uri/src/libtracker-data/tracker-data-search.h (original)
+++ branches/uri/src/libtracker-data/tracker-data-search.h Mon Nov 17 15:14:51 2008
@@ -57,8 +57,6 @@
const gchar *location);
/* Files API */
-gchar ** tracker_data_search_files_get (TrackerDBInterface *iface,
- const gchar *folder_path);
TrackerDBResultSet *tracker_data_search_files_get_by_service (TrackerDBInterface *iface,
const gchar *service,
gint offset,
Modified: branches/uri/src/libtracker-data/tracker-data-update.c
==============================================================================
--- branches/uri/src/libtracker-data/tracker-data-update.c (original)
+++ branches/uri/src/libtracker-data/tracker-data-update.c Mon Nov 17 15:14:51 2008
@@ -172,7 +172,7 @@
/* FIXME: do not hardcode arguments */
tracker_db_interface_execute_procedure (iface, NULL, "CreateService",
id_str,
- dirname,
+ path,
basename,
service_type_id_str,
is_dir ? "Folder" : tracker_data_metadata_lookup (metadata, "File:Mime"),
@@ -251,7 +251,6 @@
tracker_db_interface_execute_procedure (iface,
NULL,
"DeleteServiceRecursively",
- service_path,
str,
NULL);
@@ -265,8 +264,6 @@
{
TrackerDBInterface *iface;
GError *error = NULL;
- gchar *from_dirname;
- gchar *from_basename;
gchar *to_dirname;
gchar *to_basename;
@@ -277,18 +274,15 @@
iface = tracker_db_manager_get_db_interface_by_type (tracker_service_get_name (service),
TRACKER_DB_CONTENT_TYPE_METADATA);
- tracker_file_get_path_and_name (from,
- &from_dirname,
- &from_basename);
tracker_file_get_path_and_name (to,
- &to_dirname,
- &to_basename);
+ &to_dirname,
+ &to_basename);
tracker_db_interface_execute_procedure (iface,
NULL,
"MoveService",
- to_dirname, to_basename,
- from_dirname, from_basename,
+ to, to_basename,
+ from,
NULL);
/* FIXME: This procedure should use LIKE statement */
@@ -302,8 +296,6 @@
g_free (to_dirname);
g_free (to_basename);
- g_free (from_dirname);
- g_free (from_basename);
}
void
Modified: branches/uri/src/libtracker-data/tracker-rdf-query.c
==============================================================================
--- branches/uri/src/libtracker-data/tracker-rdf-query.c (original)
+++ branches/uri/src/libtracker-data/tracker-rdf-query.c Mon Nov 17 15:14:51 2008
@@ -1112,11 +1112,11 @@
case 6:
case 7:
case 8:
- g_string_append_printf (result, " Select DISTINCT S.ID, (S.Path || '%s' || S.Name) as uri, GetServiceName(S.ServiceTypeID) as stype ", G_DIR_SEPARATOR_S);
+ g_string_append (result, " Select DISTINCT S.ID, S.Uri, GetServiceName(S.ServiceTypeID) as stype ");
break;
default :
- g_string_append_printf (result, " Select DISTINCT S.ID, (S.Path || '%s' || S.Name) as uri, GetServiceName(S.ServiceTypeID) as stype ", G_DIR_SEPARATOR_S);
+ g_string_append (result, " Select DISTINCT S.ID, S.Uri, GetServiceName(S.ServiceTypeID) as stype ");
break;
}
Modified: branches/uri/src/libtracker-gtk/tracker-metadata-tile.c
==============================================================================
--- branches/uri/src/libtracker-gtk/tracker-metadata-tile.c (original)
+++ branches/uri/src/libtracker-gtk/tracker-metadata-tile.c Mon Nov 17 15:14:51 2008
@@ -95,7 +95,7 @@
static char *default_keys[] =
{
"File:Name",
- "File:Path",
+ "File:Uri",
"File:Modified",
"File:Size",
"File:Accessed",
@@ -105,7 +105,7 @@
enum {
DEFAULT_NAME,
- DEFAULT_PATH,
+ DEFAULT_URI,
DEFAULT_MODIFIED,
DEFAULT_SIZE,
DEFAULT_ACCESSED,
@@ -329,7 +329,7 @@
_property_to_label ( priv->title, array[DEFAULT_NAME] , "<span size='large'><b>%s</b></span>");
/* then set the remaining properties */
- _property_to_label ( priv->info1, array[DEFAULT_PATH] , _("Path : <b>%s</b>"));
+ _property_to_label ( priv->info1, array[DEFAULT_URI] , _("URI : <b>%s</b>"));
_date_to_label ( priv->info2, array[DEFAULT_MODIFIED] , _("Modified : <b>%s</b>"));
_size_to_label ( priv->info3, array[DEFAULT_SIZE] , _("Size : <b>%s</b>"));
_date_to_label ( priv->info4, array[DEFAULT_ACCESSED] , _("Accessed : <b>%s</b>"));
Modified: branches/uri/src/tracker-indexer/modules/evolution.c
==============================================================================
--- branches/uri/src/tracker-indexer/modules/evolution.c (original)
+++ branches/uri/src/tracker-indexer/modules/evolution.c Mon Nov 17 15:14:51 2008
@@ -33,7 +33,7 @@
#include <libtracker-common/tracker-file-utils.h>
#include <libtracker-common/tracker-type-utils.h>
-#define METADATA_FILE_PATH "File:Path"
+#define METADATA_FILE_URI "File:Uri"
#define METADATA_FILE_NAME "File:Name"
#define METADATA_EMAIL_RECIPIENT "Email:Recipient"
#define METADATA_EMAIL_DATE "Email:Date"
@@ -776,13 +776,16 @@
metadata = get_metadata_for_data_wrapper (content);
if (metadata) {
- gchar *dirname, *basename;
+ gchar *dirname, *basename, *uri;
get_mbox_attachment_uri (file, message, part,
&dirname, &basename);
+ uri = g_build_path (G_DIR_SEPARATOR_S, dirname, basename, NULL);
- tracker_data_metadata_insert (metadata, METADATA_FILE_PATH, dirname);
+ tracker_data_metadata_insert (metadata, METADATA_FILE_URI, uri);
tracker_data_metadata_insert (metadata, METADATA_FILE_NAME, basename);
+
+ g_free (dirname);
}
g_object_unref (content);
@@ -796,7 +799,7 @@
EvolutionLocalData *data;
GMimeMessage *message;
TrackerDataMetadata *metadata;
- gchar *dirname, *basename;
+ gchar *dirname, *basename, *uri;
time_t date;
GList *list;
guint flags;
@@ -823,7 +826,8 @@
metadata = tracker_data_metadata_new ();
get_mbox_uri (file, message, &dirname, &basename);
- tracker_data_metadata_insert (metadata, METADATA_FILE_PATH, dirname);
+ uri = g_build_path (G_DIR_SEPARATOR_S, dirname, basename, NULL);
+ tracker_data_metadata_insert (metadata, METADATA_FILE_URI, uri);
tracker_data_metadata_insert (metadata, METADATA_FILE_NAME, basename);
g_mime_message_get_date (message, &date, NULL);
@@ -841,6 +845,8 @@
list = get_mbox_recipient_list (message, GMIME_RECIPIENT_TYPE_CC);
tracker_data_metadata_insert_values (metadata, METADATA_EMAIL_CC, list);
+ g_free (dirname);
+
return metadata;
}
@@ -1130,8 +1136,8 @@
&dirname, &basename);
tracker_data_metadata_insert (metadata, METADATA_FILE_NAME, g_strdup (name));
- tracker_data_metadata_insert (metadata, METADATA_FILE_PATH,
- g_strdup_printf ("%s/%s", dirname, basename));
+ tracker_data_metadata_insert (metadata, METADATA_FILE_URI,
+ g_strdup_printf ("%s/%s/%s", dirname, basename, name));
g_free (dirname);
g_free (basename);
@@ -1150,7 +1156,7 @@
{
EvolutionImapData *data;
TrackerDataMetadata *metadata = NULL;
- gchar *dirname, *basename;
+ gchar *dirname, *basename, *uri;
gchar *subject, *from, *to, *cc;
gint32 i, count, flags;
time_t date;
@@ -1201,8 +1207,9 @@
if (!deleted) {
metadata = tracker_data_metadata_new ();
get_imap_uri (file, data->cur_message_uid, &dirname, &basename);
+ uri = g_build_path (G_DIR_SEPARATOR_S, dirname, basename, NULL);
- tracker_data_metadata_insert (metadata, METADATA_FILE_PATH, dirname);
+ tracker_data_metadata_insert (metadata, METADATA_FILE_URI, uri);
tracker_data_metadata_insert (metadata, METADATA_FILE_NAME, basename);
tracker_data_metadata_insert (metadata, METADATA_EMAIL_DATE,
@@ -1216,6 +1223,8 @@
list = get_imap_recipient_list (cc);
tracker_data_metadata_insert_values (metadata, METADATA_EMAIL_CC, list);
+
+ g_free (dirname);
}
g_free (to);
Modified: branches/uri/src/tracker-indexer/modules/files.c
==============================================================================
--- branches/uri/src/tracker-indexer/modules/files.c (original)
+++ branches/uri/src/tracker-indexer/modules/files.c Mon Nov 17 15:14:51 2008
@@ -34,7 +34,7 @@
#define METADATA_FILE_NAME_DELIMITED "File:NameDelimited"
#define METADATA_FILE_EXT "File:Ext"
-#define METADATA_FILE_PATH "File:Path"
+#define METADATA_FILE_URI "File:Uri"
#define METADATA_FILE_NAME "File:Name"
#define METADATA_FILE_LINK "File:Link"
#define METADATA_FILE_MIMETYPE "File:Mime"
Modified: branches/uri/src/tracker-indexer/tracker-metadata-utils.c
==============================================================================
--- branches/uri/src/tracker-indexer/tracker-metadata-utils.c (original)
+++ branches/uri/src/tracker-indexer/tracker-metadata-utils.c Mon Nov 17 15:14:51 2008
@@ -38,7 +38,7 @@
#define METADATA_FILE_NAME_DELIMITED "File:NameDelimited"
#define METADATA_FILE_EXT "File:Ext"
-#define METADATA_FILE_PATH "File:Path"
+#define METADATA_FILE_URI "File:Uri"
#define METADATA_FILE_NAME "File:Name"
#define METADATA_FILE_LINK "File:Link"
#define METADATA_FILE_MIMETYPE "File:Mime"
@@ -940,8 +940,8 @@
tracker_data_metadata_insert (metadata, METADATA_FILE_NAME,
g_filename_display_basename (path));
- tracker_data_metadata_insert (metadata, METADATA_FILE_PATH,
- g_path_get_dirname (path));
+ tracker_data_metadata_insert (metadata, METADATA_FILE_URI,
+ g_strdup (path));
tracker_data_metadata_insert (metadata, METADATA_FILE_NAME_DELIMITED,
g_filename_to_utf8 (path, -1, NULL, NULL, NULL));
tracker_data_metadata_insert (metadata, METADATA_FILE_MIMETYPE,
Modified: branches/uri/src/trackerd/tracker-files.c
==============================================================================
--- branches/uri/src/trackerd/tracker-files.c (original)
+++ branches/uri/src/trackerd/tracker-files.c Mon Nov 17 15:14:51 2008
@@ -665,8 +665,6 @@
TrackerDBInterface *iface;
TrackerDBResultSet *result_set;
guint request_id;
- gchar *path = NULL;
- gchar *name = NULL;
gint mtime;
GError *actual_error = NULL;
@@ -681,15 +679,10 @@
iface = tracker_db_manager_get_db_interface_by_service (TRACKER_DB_FOR_FILE_SERVICE);
- tracker_file_get_path_and_name (uri, &path, &name);
-
result_set = tracker_data_manager_exec_proc (iface,
"GetFileMTime",
- path,
- name,
+ uri,
NULL);
- g_free (path);
- g_free (name);
if (!result_set) {
tracker_dbus_request_failed (request_id,
@@ -787,7 +780,7 @@
if (result_set) {
gboolean valid = TRUE;
- gchar *prefix, *name;
+ gchar *uri;
gint row_count = 0;
gint i = 0;
@@ -796,15 +789,11 @@
while (valid) {
tracker_db_result_set_get (result_set,
- 0, &prefix,
- 1, &name,
+ 0, &uri,
-1);
- values[i++] = g_build_filename (prefix, name, NULL);
+ values[i++] = uri;
valid = tracker_db_result_set_iter_next (result_set);
-
- g_free (prefix);
- g_free (name);
}
g_object_unref (result_set);
@@ -823,7 +812,7 @@
void
tracker_files_search_by_text_and_location (TrackerFiles *object,
const gchar *text,
- const gchar *uri,
+ const gchar *location,
DBusGMethodInvocation *context,
GError **error)
{
@@ -835,21 +824,21 @@
request_id = tracker_dbus_get_next_request_id ();
tracker_dbus_async_return_if_fail (text != NULL, context);
- tracker_dbus_async_return_if_fail (uri != NULL, context);
+ tracker_dbus_async_return_if_fail (location != NULL, context);
tracker_dbus_request_new (request_id,
"DBus request to search files by text & location, "
"text:'%s', uri:'%s'",
text,
- uri);
+ location);
iface = tracker_db_manager_get_db_interface_by_service (TRACKER_DB_FOR_FILE_SERVICE);
- result_set = tracker_data_search_text_and_location (iface, text, uri);
+ result_set = tracker_data_search_text_and_location (iface, text, location);
if (result_set) {
gboolean valid = TRUE;
- gchar *prefix, *name;
+ gchar *uri;
gint row_count;
gint i = 0;
@@ -858,15 +847,11 @@
while (valid) {
tracker_db_result_set_get (result_set,
- 0, &prefix,
- 1, &name,
+ 0, &uri,
-1);
- values[i++] = g_build_filename (prefix, name, NULL);
+ values[i++] = uri;
valid = tracker_db_result_set_iter_next (result_set);
-
- g_free (prefix);
- g_free (name);
}
g_object_unref (result_set);
@@ -886,7 +871,7 @@
tracker_files_search_by_text_and_mime_and_location (TrackerFiles *object,
const gchar *text,
gchar **mime_types,
- const gchar *uri,
+ const gchar *location,
DBusGMethodInvocation *context,
GError **error)
{
@@ -900,22 +885,22 @@
tracker_dbus_async_return_if_fail (text != NULL, context);
tracker_dbus_async_return_if_fail (mime_types != NULL, context);
tracker_dbus_async_return_if_fail (g_strv_length (mime_types) > 0, context);
- tracker_dbus_async_return_if_fail (uri != NULL, context);
+ tracker_dbus_async_return_if_fail (location != NULL, context);
tracker_dbus_request_new (request_id,
"DBus request to search files by text & mime types & location, "
"text:'%s', mime types:%d, uri:'%s'",
text,
g_strv_length (mime_types),
- uri);
+ location);
iface = tracker_db_manager_get_db_interface_by_service (TRACKER_DB_FOR_FILE_SERVICE);
- result_set = tracker_data_search_text_and_mime_and_location (iface, text, mime_types, uri);
+ result_set = tracker_data_search_text_and_mime_and_location (iface, text, mime_types, location);
if (result_set) {
gboolean valid = TRUE;
- gchar *prefix, *name;
+ gchar *uri;
gint row_count;
gint i = 0;
@@ -924,15 +909,11 @@
while (valid) {
tracker_db_result_set_get (result_set,
- 0, &prefix,
- 1, &name,
+ 0, &uri,
-1);
- values[i++] = g_build_filename (prefix, name, NULL);
+ values[i++] = uri;
valid = tracker_db_result_set_iter_next (result_set);
-
- g_free (prefix);
- g_free (name);
}
g_object_unref (result_set);
Modified: branches/uri/src/trackerd/tracker-search.c
==============================================================================
--- branches/uri/src/trackerd/tracker-search.c (original)
+++ branches/uri/src/trackerd/tracker-search.c Mon Nov 17 15:14:51 2008
@@ -712,7 +712,7 @@
FALSE);
if (result_set) {
- gchar *prefix, *name;
+ gchar *uri;
gboolean valid = TRUE;
gint row_count;
gint i;
@@ -723,15 +723,11 @@
while (valid) {
tracker_db_result_set_get (result_set,
- 0, &prefix,
- 1, &name,
+ 0, &uri,
-1);
- strv[i++] = g_build_filename (prefix, name, NULL);
+ strv[i++] = uri;
valid = tracker_db_result_set_iter_next (result_set);
-
- g_free (prefix);
- g_free (name);
}
strv[i] = NULL;
Modified: branches/uri/tests/scripts/data/common.sql
==============================================================================
--- branches/uri/tests/scripts/data/common.sql (original)
+++ branches/uri/tests/scripts/data/common.sql Mon Nov 17 15:14:51 2008
@@ -26,18 +26,18 @@
(
ID Integer primary key AUTOINCREMENT not null,
MetadataID Integer not null,
- SourcePath Text,
+ SourceUri Text,
SourceName Text,
- DestPath Text,
+ DestUri Text,
DestName Text
);
CREATE TABLE BackupServices
(
ID Integer primary key AUTOINCREMENT not null,
- Path Text not null,
+ Uri Text not null,
Name Text,
- unique (Path, Name)
+ unique (Uri)
);
CREATE TABLE BackupMetaData
@@ -56,14 +56,14 @@
);
CREATE TABLE VFolders
(
- Path Text not null,
+ Uri Text not null,
Name Text not null,
Query text not null,
RDF text,
Type Integer default 0,
active Integer,
- primary key (Path, Name)
+ primary key (Uri)
);
CREATE TABLE MetaDataTypes
@@ -111,7 +111,7 @@
INSERT INTO "MetaDataTypes" VALUES(19,'User:Keywords',0,'Keywords','User settable keywords which are used to tag a resource',1,0,' ',' ',' ',50,0,1,0,1,0,1,0,' ');
INSERT INTO "MetaDataTypes" VALUES(20,'File:Name',1,'Filename','Name of File',1,0,' ',' ','Name',10,1,0,0,0,0,1,0,' ');
INSERT INTO "MetaDataTypes" VALUES(21,'File:Ext',1,'Extension','File extension',1,0,' ',' ',' ',15,1,0,0,0,0,1,0,' ');
-INSERT INTO "MetaDataTypes" VALUES(22,'File:Path',1,'Path','File Path',1,0,' ',' ','Path',1,1,0,0,0,0,1,0,' ');
+INSERT INTO "MetaDataTypes" VALUES(22,'File:Uri',1,'URI','File URI',1,0,' ',' ','Uri',1,1,0,0,0,0,1,0,' ');
INSERT INTO "MetaDataTypes" VALUES(23,'File:NameDelimited',1,'Keywords','Name of File',1,0,' ',' ',' ',5,1,0,1,0,0,1,0,' ');
INSERT INTO "MetaDataTypes" VALUES(24,'File:Contents',2,'Contents','File Contents',1,0,' ',' ',' ',1,1,0,0,1,0,1,0,' ');
INSERT INTO "MetaDataTypes" VALUES(25,'File:Link',1,'Link','File Link',1,0,' ',' ',' ',1,1,0,0,1,0,1,0,' ');
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]