8000 Feature/refactor search snapshots (#17969) · cloudhub-js/arangodb@865bd5e · GitHub
[go: up one dir, main page]

Skip to content

Commit 865bd5e

Browse files
authored
Feature/refactor search snapshots (arangodb#17969)
* Update iresearch * Adjust codebase * wip * wip * Adjust tests * wip * wip * wip * wip * Address review suggestions * wip * Address review comments
1 parent 430ca1a commit 865bd5e

File tree

56 files changed

+561
-565
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+561
-565
lines changed

3rdParty/iresearch

Submodule iresearch updated 209 files

CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -686,7 +686,8 @@ option(USE_MAINTAINER_MODE
686686
)
687687

688688
if (USE_MAINTAINER_MODE)
689-
set(IRESEARCH_DEBUG ON)
689+
add_definitions("-DIRESEARCH_DEBUG")
690+
690691
add_definitions("-DARANGODB_ENABLE_MAINTAINER_MODE=1")
691692
if (CMAKE_COMPILER_IS_GNUCC AND NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
692693
add_definitions("-D_FORTIFY_SOURCE=2")

arangod/Aql/IResearchViewExecutor.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,14 +119,14 @@ lookupCollection(arangodb::transaction::Methods& trx, DataSourceId cid,
119119
}
120120

121121
[[maybe_unused]] inline irs::doc_iterator::ptr pkColumn(
122-
irs::sub_reader const& segment) {
122+
irs::SubReader const& segment) {
123123
auto const* reader = segment.column(DocumentPrimaryKey::PK());
124124

125125
return reader ? reader->iterator(irs::ColumnHint::kNormal) : nullptr;
126126
}
127127

128128
[[maybe_unused]] inline irs::doc_iterator::ptr sortColumn(
129-
irs::sub_reader const& segment) {
129+
irs::SubReader const& segment) {
130130
auto const* reader = segment.sort();
131131

132132
return reader ? reader->iterator(irs::ColumnHint::kNormal) : nullptr;
@@ -969,7 +969,7 @@ void IResearchViewExecutorBase<Impl, ExecutionTraits>::pushStoredValues(
969969

970970
template<typename Impl, typename ExecutionTraits>
971971
bool IResearchViewExecutorBase<Impl, ExecutionTraits>::getStoredValuesReaders(
972-
irs::sub_reader const& segmentReader, size_t storedValuesIndex /*= 0*/) {
972+
irs::SubReader const& segmentReader, size_t storedValuesIndex /*= 0*/) {
973973
auto const& columnsFieldsRegs = _infos.getOutNonMaterializedViewRegs();
974974
if (!columnsFieldsRegs.empty()) {
975975
auto columnFieldsRegs = columnsFieldsRegs.cbegin();

arangod/Aql/IResearchViewExecutor.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ class IndexReadBuffer {
272272
template<typename... Args>
273273
void pushValue(Args&&... args);
274274

275-
void pushSearchDoc(irs::sub_reader const& segment, irs::doc_id_t docId) {
275+
void pushSearchDoc(irs::SubReader const& segment, irs::doc_id_t docId) {
276276
_searchDocs.emplace_back(segment, docId);
277277
}
278278

@@ -541,7 +541,7 @@ class IResearchViewExecutorBase {
541541

542542
void pushStoredValues(irs::document const& doc, size_t storedValuesIndex = 0);
543543

544-
bool getStoredValuesReaders(irs::sub_reader const& segmentReader,
544+
bool getStoredValuesReaders(irs::SubReader const& segmentReader,
545545
size_t storedValuesIndex = 0);
546546

547547
private:

arangod/IResearch/ExpressionFilter.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ class NondeterministicExpressionIterator final
116116

117117
class ExpressionQuery : public irs::filter::prepared {
118118
public:
119-
void visit(irs::sub_reader const& segment, irs::PreparedStateVisitor& visitor,
119+
void visit(irs::SubReader const& segment, irs::PreparedStateVisitor& visitor,
120120
irs::score_t boost) const final {
121121
return _allQuery->visit(segment, visitor, boost);
122122
}
@@ -230,7 +230,7 @@ bool ByExpression::equals(irs::filter const& rhs) const noexcept {
230230
size_t ByExpression::hash() const noexcept { return _ctx.hash(); }
231231

232232
irs::filter::prepared::ptr ByExpression::prepare(
233-
irs::index_reader const& index, irs::Order const& order,
233+
irs::IndexReader const& index, irs::Order const& order,
234234
irs::score_t filter_boost, irs::attribute_provider const* ctx) const {
235235
if (!bool(*this)) {
236236
// uninitialized filter

arangod/IResearch/ExpressionFilter.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ class ByExpression final : public irs::filter {
9393
using irs::filter::prepare;
9494

9595
virtual irs::filter::prepared::ptr prepare(
96-
irs::index_reader const& index, irs::Order const& ord, irs::score_t boost,
96+
irs::IndexReader const& index, irs::Order const& ord, irs::score_t boost,
9797
irs::attribute_provider const* ctx) const override;
9898

9999
virtual size_t hash() const noexcept override;

arangod/IResearch/GeoFilter.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ using Disjunction =
5555
irs::disjunction_iterator<irs::doc_iterator::ptr, irs::NoopAggregator>;
5656

5757
// Return a filter matching all documents with a given geo field
58-
irs::filter::prepared::ptr match_all(irs::index_reader const& index,
58+
irs::filter::prepared::ptr match_all(irs::IndexReader const& index,
5959
irs::Order const& order,
6060
std::string_view field,
6161
irs::score_t boost) {
@@ -80,7 +80,7 @@ class GeoIterator final : public irs::doc_iterator {
8080

8181
public:
8282
GeoIterator(doc_iterator::ptr&& approx, doc_iterator::ptr&& columnIt,
83-
Parser& parser, Acceptor& acceptor, irs::sub_reader const& reader,
83+
Parser& parser, Acceptor& acceptor, irs::SubReader const& reader,
8484
irs::term_reader const& field, irs::byte_type const* query_stats,
8585
irs::Order const& order, irs::score_t boost)
8686
: _approx{std::move(approx)},
@@ -172,7 +172,7 @@ class GeoIterator final : public irs::doc_iterator {
172172
template<typename Parser, typename Acceptor>
173173
irs::doc_iterator::ptr makeIterator(
174174
typename Disjunction::doc_iterators_t&& itrs,
175-
irs::doc_iterator::ptr&& columnIt, irs::sub_reader const& reader,
175+
irs::doc_iterator::ptr&& columnIt, irs::SubReader const& reader,
176176
irs::term_reader const& field, irs::byte_type const* query_stats,
177177
irs::Order const& order, irs::score_t boost, Parser& parser,
178178
Acceptor& acceptor) {
@@ -198,7 +198,7 @@ struct GeoState {
198198
std::vector<irs::seek_cookie::ptr> states;
199199
};
200200

201-
using GeoStates = irs::states_cache<GeoState>;
201+
using GeoStates = irs::StatesCache<GeoState>;
202202

203203
// Compiled GeoFilter
204204
template<typename Parser, typename Acceptor>
@@ -247,7 +247,7 @@ class GeoQuery final : public irs::filter::prepared {
247247
_parser, _acceptor);
248248
}
249249

250-
void visit(irs::sub_reader const&, irs::PreparedStateVisitor&,
250+
void visit(irs::SubReader const&, irs::PreparedStateVisitor&,
251251
irs::score_t) const final {
252252
// NOOP
253253
}
@@ -350,7 +350,7 @@ irs::filter::prepared::ptr makeQuery(GeoStates&& states, irs::bstring&& stats,
350350
}
351351

352352
std::pair<GeoStates, irs::bstring> prepareStates(
353-
irs::index_reader const& index, irs::Order const& order,
353+
irs::IndexReader const& index, irs::Order const& order,
354354
std::span<const std::string> geoTerms, std::string_view field) {
355355
TRI_ASSERT(!geoTerms.empty());
356356

@@ -360,7 +360,7 @@ std::pair<GeoStates, irs::bstring> prepareStates(
360360
sortedTerms.end());
361361

362362
std::pair<GeoStates, irs::bstring> res{
363-
std::piecewise_construct, std::forward_as_tuple(index),
363+
std::piecewise_construct, std::forward_as_tuple(index.size()),
364364
std::forward_as_tuple(order.stats_size(), 0)};
365365

366366
auto const size = sortedTerms.size();
@@ -422,7 +422,7 @@ std::pair<S2Cap, bool> getBound(irs::BoundType type, S2Point origin,
422422
}
423423

424424
irs::filter::prepared::ptr prepareOpenInterval(
425-
irs::index_reader const& index, irs::Order const& order, irs::score_t boost,
425+
irs::IndexReader const& index, irs::Order const& order, irs::score_t boost,
426426
std::string_view field, GeoDistanceFilterOptions const& options,
427427
bool greater) {
428428
auto const& range = options.range;
@@ -527,7 +527,7 @@ irs::filter::prepared::ptr prepareOpenInterval(
527527
}
528528

529529
irs::filter::prepared::ptr prepareInterval(
530-
irs::index_reader const& index, irs::Order const& order, irs::score_t boost,
530+
irs::IndexReader const& index, irs::Order const& order, irs::score_t boost,
531531
std::string_view field, GeoDistanceFilterOptions const& options) {
532532
auto const& range = options.range;
533533
TRI_ASSERT(irs::BoundType::UNBOUNDED != range.min_type);
@@ -626,7 +626,7 @@ irs::filter::prepared::ptr prepareInterval(
626626
} // namespace
627627

628628
irs::filter::prepared::ptr GeoFilter::prepare(
629-
irs::index_reader const& index, irs::Order const& order, irs::score_t boost,
629+
irs::IndexReader const& index, irs::Order const& order, irs::score_t boost,
630630
irs::attribute_provider const* /*ctx*/) const {
631631
auto& shape = const_cast<geo::ShapeContainer&>(options().shape);
632632
if (shape.empty()) {
@@ -690,7 +690,7 @@ irs::filter::prepared::ptr GeoFilter::prepare(
690690
}
691691

692692
irs::filter::prepared::ptr GeoDistanceFilter::prepare(
693-
irs::index_reader const& index, irs::Order const& order, irs::score_t boost,
693+
irs::IndexReader const& index, irs::Order const& order, irs::score_t boost,
694694
irs::attribute_provider const* /*ctx*/) const {
695695
auto const& options = this->options();
696696
auto const& range = options.range;

arangod/IResearch/GeoFilter.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ class GeoFilter final : public irs::filter_base<GeoFilterOptions> {
9595

9696
using filter::prepare;
9797

98-
prepared::ptr prepare(irs::index_reader const& rdr, irs::Order const& ord,
98+
prepared::ptr prepare(irs::IndexReader const& rdr, irs::Order const& ord,
9999
irs::score_t boost,
100100
irs::attribute_provider const* /*ctx*/) const override;
101101
};
@@ -133,7 +133,7 @@ class GeoDistanceFilter final
133133

134134
using filter::prepare;
135135

136-
prepared::ptr prepare(irs::index_reader const& rdr, irs::Order const& ord,
136+
prepared::ptr prepare(irs::IndexReader const& rdr, irs::Order const& ord,
137137
irs::score_t boost,
138138
irs::attribute_provider const* /*ctx*/) const final;
139139
};

0 commit comments

Comments
 (0)
0