diff options
| author | Michal Hruby <michal.mhr@gmail.com> | 2012-03-19 22:33:59 +0100 |
|---|---|---|
| committer | Michal Hruby <michal.mhr@gmail.com> | 2012-03-19 22:33:59 +0100 |
| commit | 660d721bf37a60b39f50b0de315104a1111fec8c (patch) | |
| tree | 0aab9362a7bed608109ac8b9f7226e8775fff7a1 | |
| parent | 0a1a2e66fe67b3174188e7362d6290382082e245 (diff) | |
| download | zeitgeist-660d721bf37a60b39f50b0de315104a1111fec8c.tar.gz | |
Clean up
| -rw-r--r-- | extensions/fts++/indexer.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/extensions/fts++/indexer.cpp b/extensions/fts++/indexer.cpp index 9b65ac5f..6fee9eb0 100644 --- a/extensions/fts++/indexer.cpp +++ b/extensions/fts++/indexer.cpp @@ -1281,6 +1281,7 @@ get_digest_for_uri (GChecksum *checksum, const gchar *uri, g_checksum_update (checksum, (guchar *) uri, -1); g_checksum_get_digest (checksum, digest, digest_size); g_checksum_reset (checksum); + g_assert (digest_size == NULL || *digest_size == HASH_LENGTH); } void Indexer::IndexEvent (ZeitgeistEvent *event) @@ -1333,16 +1334,15 @@ void Indexer::IndexEvent (ZeitgeistEvent *event) return; // ignore this event completely... } + guint8 uri_hash[HASH_LENGTH + 1]; + gsize hash_size = HASH_LENGTH; + // We need the subject URI so we can use Xapian's collapse key feature // for *_SUBJECT grouping. However, to save space, we'll just save a hash. // A better option would be using URI's id, but for that we'd need a SQL // query that'd be subject to races. // FIXME(?): This doesn't work for events with multiple subjects. - guint8 uri_hash[HASH_LENGTH + 1]; - gsize hash_size = HASH_LENGTH; - get_digest_for_uri (checksum, uri.c_str (), uri_hash, &hash_size); - g_assert (hash_size == HASH_LENGTH); doc.add_value (VALUE_URI_HASH, std::string((char *) uri_hash, hash_size)); size_t colon_pos = uri.find (':'); @@ -1353,7 +1353,6 @@ void Indexer::IndexEvent (ZeitgeistEvent *event) { hash_size = HASH_LENGTH; get_digest_for_uri (checksum, val, uri_hash, &hash_size); - g_assert (hash_size == HASH_LENGTH); doc.add_value (VALUE_ORIGIN_HASH, std::string((char *) uri_hash, hash_size)); } |
