diff options
Diffstat (limited to 'src/libtracker-data')
-rw-r--r-- | src/libtracker-data/tracker-data-manager.c | 42 | ||||
-rw-r--r-- | src/libtracker-data/tracker-property.c | 26 | ||||
-rw-r--r-- | src/libtracker-data/tracker-property.h | 3 |
3 files changed, 43 insertions, 28 deletions
diff --git a/src/libtracker-data/tracker-data-manager.c b/src/libtracker-data/tracker-data-manager.c index c8dab4a8a..b7d2ffea2 100644 --- a/src/libtracker-data/tracker-data-manager.c +++ b/src/libtracker-data/tracker-data-manager.c @@ -650,6 +650,7 @@ tracker_data_ontology_load_statement (const gchar *ontology_path, tracker_property_set_is_inverse_functional_property (property, FALSE); tracker_property_set_default_value (property, NULL); tracker_property_set_multiple_values (property, TRUE); + tracker_property_set_fulltext_indexed (property, FALSE); } return; } @@ -1140,29 +1141,8 @@ tracker_data_ontology_load_statement (const gchar *ontology_path, return; } - is_new = tracker_property_get_is_new (property); - if (is_new != in_update) { - /* Detect unsupported ontology change (this needs a journal replay) */ - if (in_update == TRUE && is_new == FALSE) { - if (check_unsupported_property_value_change (ontology_path, - "tracker:fulltextIndexed", - subject, - predicate, - object)) { - handle_unsupported_ontology_change (ontology_path, - tracker_property_get_name (property), - "tracker:fulltextIndexed", - tracker_property_get_fulltext_indexed (property) ? "true" : "false", - g_strcmp0 (object, "true") == 0 ? "true" : "false", - error); - } - } - return; - } - - if (strcmp (object, "true") == 0) { - tracker_property_set_fulltext_indexed (property, TRUE); - } + tracker_property_set_fulltext_indexed (property, + strcmp (object, "true") == 0); } else if (g_strcmp0 (predicate, TRACKER_PREFIX_TRACKER "defaultValue") == 0) { TrackerProperty *property; @@ -2436,6 +2416,7 @@ db_get_static_data (TrackerDBInterface *iface, tracker_property_set_secondary_index (property, tracker_ontologies_get_property_by_uri (secondary_index_uri)); } + tracker_property_set_orig_fulltext_indexed (property, fulltext_indexed); tracker_property_set_fulltext_indexed (property, fulltext_indexed); tracker_property_set_is_inverse_functional_property (property, is_inverse_functional_property); @@ -3614,11 +3595,11 @@ load_ontologies_gvdb (GError **error) #if HAVE_TRACKER_FTS static gboolean ontology_get_fts_properties (gboolean only_new, - GHashTable **fts_properties, - GHashTable **multivalued) + GHashTable **fts_properties, + GHashTable **multivalued) { TrackerProperty **properties; - gboolean has_new = FALSE; + gboolean has_changed = FALSE; guint i, len; properties = tracker_ontologies_get_properties (&len); @@ -3630,11 +3611,16 @@ ontology_get_fts_properties (gboolean only_new, const gchar *name, *table_name; GList *list; + if (tracker_property_get_fulltext_indexed (properties[i]) != + tracker_property_get_orig_fulltext_indexed (properties[i])) { + has_changed |= TRUE; + } + if (!tracker_property_get_fulltext_indexed (properties[i])) { continue; } - has_new |= tracker_property_get_is_new (properties[i]); + has_changed |= tracker_property_get_is_new (properties[i]); table_name = tracker_property_get_table_name (properties[i]); name = tracker_property_get_name (properties[i]); list = g_hash_table_lookup (*fts_properties, table_name); @@ -3652,7 +3638,7 @@ ontology_get_fts_properties (gboolean only_new, } } - return has_new; + return has_changed; } static void diff --git a/src/libtracker-data/tracker-property.c b/src/libtracker-data/tracker-property.c index 1d19ee2ec..3f14c3881 100644 --- a/src/libtracker-data/tracker-property.c +++ b/src/libtracker-data/tracker-property.c @@ -55,6 +55,7 @@ struct _TrackerPropertyPrivate { gint id; gboolean indexed; TrackerProperty *secondary_index; + gboolean orig_fulltext_indexed; gboolean fulltext_indexed; gboolean multiple_values; gboolean last_multiple_values; @@ -491,6 +492,18 @@ tracker_property_get_fulltext_indexed (TrackerProperty *property) } gboolean +tracker_property_get_orig_fulltext_indexed (TrackerProperty *property) +{ + TrackerPropertyPrivate *priv; + + g_return_val_if_fail (property != NULL, FALSE); + + priv = GET_PRIV (property); + + return priv->orig_fulltext_indexed; +} + +gboolean tracker_property_get_is_new (TrackerProperty *property) { TrackerPropertyPrivate *priv; @@ -999,6 +1012,19 @@ tracker_property_set_cardinality_changed (TrackerProperty *property, } void +tracker_property_set_orig_fulltext_indexed (TrackerProperty *property, + gboolean value) +{ + TrackerPropertyPrivate *priv; + + g_return_if_fail (TRACKER_IS_PROPERTY (property)); + + priv = GET_PRIV (property); + + priv->orig_fulltext_indexed = value; +} + +void tracker_property_set_fulltext_indexed (TrackerProperty *property, gboolean value) { diff --git a/src/libtracker-data/tracker-property.h b/src/libtracker-data/tracker-property.h index 328d130ee..fdc6883b2 100644 --- a/src/libtracker-data/tracker-property.h +++ b/src/libtracker-data/tracker-property.h @@ -85,6 +85,7 @@ gint tracker_property_get_weight (TrackerProperty gint tracker_property_get_id (TrackerProperty *property); gboolean tracker_property_get_indexed (TrackerProperty *property); TrackerProperty * tracker_property_get_secondary_index (TrackerProperty *property); +gboolean tracker_property_get_orig_fulltext_indexed(TrackerProperty *property); gboolean tracker_property_get_fulltext_indexed (TrackerProperty *property); gboolean tracker_property_get_multiple_values (TrackerProperty *property); gboolean tracker_property_get_last_multiple_values(TrackerProperty *property); @@ -120,6 +121,8 @@ void tracker_property_set_indexed (TrackerProperty gboolean value); void tracker_property_set_secondary_index (TrackerProperty *property, TrackerProperty *value); +void tracker_property_set_orig_fulltext_indexed(TrackerProperty *property, + gboolean value); void tracker_property_set_fulltext_indexed (TrackerProperty *property, gboolean value); void tracker_property_set_multiple_values (TrackerProperty *property, |