Changeset View
Changeset View
Standalone View
Standalone View
src/engine/writetransaction.cpp
Show First 20 Lines • Show All 167 Lines • ▼ Show 20 Line(s) | |||||
168 | 168 | | |||
169 | void WriteTransaction::replaceDocument(const Document& doc, DocumentOperations operations) | 169 | void WriteTransaction::replaceDocument(const Document& doc, DocumentOperations operations) | ||
170 | { | 170 | { | ||
171 | DocumentDB documentTermsDB(m_dbis.docTermsDbi, m_txn); | 171 | DocumentDB documentTermsDB(m_dbis.docTermsDbi, m_txn); | ||
172 | DocumentDB documentXattrTermsDB(m_dbis.docXattrTermsDbi, m_txn); | 172 | DocumentDB documentXattrTermsDB(m_dbis.docXattrTermsDbi, m_txn); | ||
173 | DocumentDB documentFileNameTermsDB(m_dbis.docFilenameTermsDbi, m_txn); | 173 | DocumentDB documentFileNameTermsDB(m_dbis.docFilenameTermsDbi, m_txn); | ||
174 | DocumentTimeDB docTimeDB(m_dbis.docTimeDbi, m_txn); | 174 | DocumentTimeDB docTimeDB(m_dbis.docTimeDbi, m_txn); | ||
175 | DocumentDataDB docDataDB(m_dbis.docDataDbi, m_txn); | 175 | DocumentDataDB docDataDB(m_dbis.docDataDbi, m_txn); | ||
176 | DocumentIdDB contentIndexingDB(m_dbis.contentIndexingDbi, m_txn); | ||||
176 | MTimeDB mtimeDB(m_dbis.mtimeDbi, m_txn); | 177 | MTimeDB mtimeDB(m_dbis.mtimeDbi, m_txn); | ||
177 | DocumentUrlDB docUrlDB(m_dbis.idTreeDbi, m_dbis.idFilenameDbi, m_txn); | 178 | DocumentUrlDB docUrlDB(m_dbis.idTreeDbi, m_dbis.idFilenameDbi, m_txn); | ||
178 | 179 | | |||
179 | const quint64 id = doc.id(); | 180 | const quint64 id = doc.id(); | ||
180 | 181 | | |||
181 | if (operations & DocumentTerms) { | 182 | if (operations & DocumentTerms) { | ||
182 | Q_ASSERT(!doc.m_terms.isEmpty()); | 183 | Q_ASSERT(!doc.m_terms.isEmpty()); | ||
183 | QVector<QByteArray> prevTerms = documentTermsDB.get(id); | 184 | QVector<QByteArray> prevTerms = documentTermsDB.get(id); | ||
Show All 17 Lines | 200 | if (operations & FileNameTerms) { | |||
201 | QVector<QByteArray> docFileNameTerms = replaceTerms(id, prevTerms, doc.m_fileNameTerms); | 202 | QVector<QByteArray> docFileNameTerms = replaceTerms(id, prevTerms, doc.m_fileNameTerms); | ||
202 | 203 | | |||
203 | if (!docFileNameTerms.isEmpty()) | 204 | if (!docFileNameTerms.isEmpty()) | ||
204 | documentFileNameTermsDB.put(id, docFileNameTerms); | 205 | documentFileNameTermsDB.put(id, docFileNameTerms); | ||
205 | else | 206 | else | ||
206 | documentFileNameTermsDB.del(id); | 207 | documentFileNameTermsDB.del(id); | ||
207 | } | 208 | } | ||
208 | 209 | | |||
210 | if (doc.contentIndexing()) { | ||||
211 | contentIndexingDB.put(doc.id()); | ||||
212 | } | ||||
213 | | ||||
209 | if (operations & DocumentTime) { | 214 | if (operations & DocumentTime) { | ||
210 | DocumentTimeDB::TimeInfo info; | 215 | DocumentTimeDB::TimeInfo info; | ||
211 | info.mTime = doc.m_mTime; | 216 | info.mTime = doc.m_mTime; | ||
212 | info.cTime = doc.m_cTime; | 217 | info.cTime = doc.m_cTime; | ||
213 | 218 | | |||
214 | docTimeDB.put(id, info); | 219 | docTimeDB.put(id, info); | ||
215 | mtimeDB.put(doc.m_mTime, id); | 220 | mtimeDB.put(doc.m_mTime, id); | ||
216 | } | 221 | } | ||
▲ Show 20 Lines • Show All 88 Lines • Show Last 20 Lines |