diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-10-20 13:34:38 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-10-21 09:18:50 +0200 |
commit | da0c37dbad121252effa85941de4d49222176179 (patch) | |
tree | 6ea9831e80fc18dcae00cdf2788680bb8f4d1935 /common/typeindex.cpp | |
parent | 0dcc8e2985acbff52c497648e4fbb54e47bf3b51 (diff) | |
download | sink-da0c37dbad121252effa85941de4d49222176179.tar.gz sink-da0c37dbad121252effa85941de4d49222176179.zip |
A new indexer subsystem that can be used for indexes that are more
complex than a simple key-value pair.
Diffstat (limited to 'common/typeindex.cpp')
-rw-r--r-- | common/typeindex.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/common/typeindex.cpp b/common/typeindex.cpp index 7920efc..8f5de4f 100644 --- a/common/typeindex.cpp +++ b/common/typeindex.cpp | |||
@@ -121,6 +121,10 @@ void TypeIndex::add(const QByteArray &identifier, const Sink::ApplicationDomain: | |||
121 | auto indexer = mSortIndexer.value(it.key() + it.value()); | 121 | auto indexer = mSortIndexer.value(it.key() + it.value()); |
122 | indexer(identifier, value, sortValue, transaction); | 122 | indexer(identifier, value, sortValue, transaction); |
123 | } | 123 | } |
124 | for (const auto &indexer : mCustomIndexer) { | ||
125 | indexer->setup(this, &transaction); | ||
126 | indexer->add(entity); | ||
127 | } | ||
124 | } | 128 | } |
125 | 129 | ||
126 | void TypeIndex::remove(const QByteArray &identifier, const Sink::ApplicationDomain::ApplicationDomainType &entity, Sink::Storage::DataStore::Transaction &transaction) | 130 | void TypeIndex::remove(const QByteArray &identifier, const Sink::ApplicationDomain::ApplicationDomainType &entity, Sink::Storage::DataStore::Transaction &transaction) |
@@ -138,6 +142,10 @@ void TypeIndex::remove(const QByteArray &identifier, const Sink::ApplicationDoma | |||
138 | Index(indexName(it.key(), it.value()), transaction).remove(propertyValue.toByteArray() + sortValue.toByteArray(), identifier); | 142 | Index(indexName(it.key(), it.value()), transaction).remove(propertyValue.toByteArray() + sortValue.toByteArray(), identifier); |
139 | } | 143 | } |
140 | } | 144 | } |
145 | for (const auto &indexer : mCustomIndexer) { | ||
146 | indexer->setup(this, &transaction); | ||
147 | indexer->remove(entity); | ||
148 | } | ||
141 | } | 149 | } |
142 | 150 | ||
143 | static QVector<QByteArray> indexLookup(Index &index, Query::Comparator filter) | 151 | static QVector<QByteArray> indexLookup(Index &index, Query::Comparator filter) |