index: generalize pre-fetch paths
We already pre-fetched db file paths for the cleanup-case (since
cdb619e4f), now let's generalize this to all indexing.
For now this is mostly performance-neutral (lazy-rescan is slightly
faster); however, this simplifies the code.
This commit is contained in:
@ -756,28 +756,6 @@ Store::label_map() const
|
||||
return priv_->labels_cache_.label_map();
|
||||
}
|
||||
|
||||
std::size_t
|
||||
Store::for_each_message_path(Store::ForEachMessageFunc msg_func) const
|
||||
{
|
||||
size_t n{};
|
||||
|
||||
xapian_try([&] {
|
||||
std::lock_guard guard{priv_->lock_};
|
||||
auto enq{xapian_db().enquire()};
|
||||
|
||||
enq.set_query(Xapian::Query::MatchAll);
|
||||
enq.set_cutoff(0, 0);
|
||||
|
||||
Xapian::MSet matches(enq.get_mset(0, xapian_db().size()));
|
||||
constexpr auto path_no{field_from_id(Field::Id::Path).value_no()};
|
||||
for (auto&& it = matches.begin(); it != matches.end(); ++it, ++n)
|
||||
if (!msg_func(*it, it.get_document().get_value(path_no)))
|
||||
break;
|
||||
});
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
std::size_t
|
||||
Store::for_each_term(Field::Id field_id, Store::ForEachTermFunc func) const
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user