mirror of https://gitee.com/bigwinds/arangodb
Hide Links from getIndexes() (#6325)
This commit is contained in:
parent
06b89a2c24
commit
0661a4c1fe
|
@ -0,0 +1 @@
|
|||
Subproject commit 309c076fc267ba7d1ad7a7aebf27f1238358fbb8
|
|
@ -88,7 +88,7 @@ void CollectionAccessingNode::toVelocyPack(arangodb::velocypack::Builder& builde
|
|||
void CollectionAccessingNode::toVelocyPackHelperPrimaryIndex(arangodb::velocypack::Builder& builder) const {
|
||||
auto col = _collection->getCollection();
|
||||
builder.add(VPackValue("indexes"));
|
||||
col->getIndexesVPack(builder, Index::SERIALIZE_BASICS, [](arangodb::Index const* idx) {
|
||||
col->getIndexesVPack(builder, Index::makeFlags(Index::Serialize::Basics), [](arangodb::Index const* idx) {
|
||||
return (idx->type() == arangodb::Index::TRI_IDX_TYPE_PRIMARY_INDEX);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -181,7 +181,7 @@ void IndexNode::toVelocyPackHelper(VPackBuilder& builder, unsigned flags) const
|
|||
{
|
||||
VPackArrayBuilder guard(&builder);
|
||||
for (auto& index : _indexes) {
|
||||
index.toVelocyPack(builder, Index::SERIALIZE_ESTIMATES);
|
||||
index.toVelocyPack(builder, Index::makeFlags(Index::Serialize::Estimates));
|
||||
}
|
||||
}
|
||||
builder.add(VPackValue("condition"));
|
||||
|
|
|
@ -5754,7 +5754,7 @@ static bool distanceFuncArgCheck(ExecutionPlan* plan, AstNode const* latArg,
|
|||
std::vector<basics::AttributeName> fields2 = idx->fields()[0];
|
||||
|
||||
VPackBuilder builder;
|
||||
idx->toVelocyPack(builder, Index::SERIALIZE_BASICS);
|
||||
idx->toVelocyPack(builder, Index::makeFlags(Index::Serialize::Basics));
|
||||
bool geoJson = basics::VelocyPackHelper::getBooleanValue(builder.slice(), "geoJson", false);
|
||||
|
||||
fields1.back().name += geoJson ? "[1]" : "[0]";
|
||||
|
|
|
@ -212,7 +212,7 @@ std::pair<AstNode*, AstNode*> getAttributeAccessFromIndex(Ast* ast, AstNode* doc
|
|||
AstNode * base = ast->createNodeAttributeAccess(accessNodeLon, accessBase);
|
||||
|
||||
VPackBuilder builder;
|
||||
idx->toVelocyPack(builder, Index::SERIALIZE_BASICS);
|
||||
idx->toVelocyPack(builder, Index::makeFlags(Index::Serialize::Basics));
|
||||
bool geoJson = basics::VelocyPackHelper::getBooleanValue(builder.slice(), "geoJson", false);
|
||||
|
||||
accessNodeLat = ast->createNodeIndexedAccess(base, ast->createNodeValueInt(geoJson ? 1 : 0));
|
||||
|
@ -437,7 +437,7 @@ AstNode* replaceWithinRectangle(AstNode* funAstNode, ExecutionNode* calcNode, Ex
|
|||
fargs->addMember(arr);
|
||||
} else {
|
||||
VPackBuilder builder;
|
||||
index->toVelocyPack(builder, Index::SERIALIZE_BASICS);
|
||||
index->toVelocyPack(builder, Index::makeFlags(Index::Serialize::Basics));
|
||||
bool geoJson = basics::VelocyPackHelper::getBooleanValue(builder.slice(), "geoJson", false);
|
||||
if (geoJson) {
|
||||
fargs->addMember(ast->createNodeAccess(collVar, index->fields()[0]));
|
||||
|
|
|
@ -2414,7 +2414,7 @@ int ClusterInfo::ensureIndexCoordinator(
|
|||
oldPlanIndexes.reset(new VPackBuilder());
|
||||
|
||||
c = getCollection(databaseName, collectionID);
|
||||
c->getIndexesVPack(*(oldPlanIndexes.get()), Index::SERIALIZE_BASICS);
|
||||
c->getIndexesVPack(*(oldPlanIndexes.get()), Index::makeFlags(Index::Serialize::Basics));
|
||||
VPackSlice const planIndexes = oldPlanIndexes->slice();
|
||||
|
||||
if (planIndexes.isArray()) {
|
||||
|
@ -2505,7 +2505,7 @@ int ClusterInfo::ensureIndexCoordinatorWithoutRollback(
|
|||
std::shared_ptr<LogicalCollection> c =
|
||||
getCollection(databaseName, collectionID);
|
||||
std::shared_ptr<VPackBuilder> tmp = std::make_shared<VPackBuilder>();
|
||||
c->getIndexesVPack(*(tmp.get()), Index::SERIALIZE_BASICS);
|
||||
c->getIndexesVPack(*(tmp.get()), Index::makeFlags(Index::Serialize::Basics));
|
||||
{
|
||||
MUTEX_LOCKER(guard, *numberOfShardsMutex);
|
||||
*numberOfShards = static_cast<int>(c->numberOfShards());
|
||||
|
@ -2875,7 +2875,7 @@ int ClusterInfo::dropIndexCoordinator(std::string const& databaseName,
|
|||
|
||||
READ_LOCKER(readLocker, _planProt.lock);
|
||||
|
||||
c->getIndexesVPack(tmp, Index::SERIALIZE_BASICS);
|
||||
c->getIndexesVPack(tmp, Index::makeFlags(Index::Serialize::Basics));
|
||||
indexes = tmp.slice();
|
||||
|
||||
if (!indexes.isArray()) {
|
||||
|
|
|
@ -75,7 +75,8 @@ void ClusterIndex::toVelocyPackFigures(VPackBuilder& builder) const {
|
|||
// ========== below is cluster schmutz ============
|
||||
|
||||
/// @brief return a VelocyPack representation of the index
|
||||
void ClusterIndex::toVelocyPack(VPackBuilder& builder, unsigned flags) const {
|
||||
void ClusterIndex::toVelocyPack(VPackBuilder& builder,
|
||||
std::underlying_type<Index::Serialize>::type flags) const {
|
||||
builder.openObject();
|
||||
Index::toVelocyPack(builder, flags);
|
||||
builder.add(StaticStrings::IndexUnique, VPackValue(_unique));
|
||||
|
|
|
@ -46,7 +46,8 @@ class ClusterIndex : public Index {
|
|||
void toVelocyPackFigures(velocypack::Builder& builder) const override;
|
||||
|
||||
/// @brief return a VelocyPack representation of the index
|
||||
void toVelocyPack(velocypack::Builder& builder, unsigned flags) const override;
|
||||
void toVelocyPack(velocypack::Builder& builder,
|
||||
std::underlying_type<Index::Serialize>::type) const override;
|
||||
|
||||
IndexType type() const override { return _indexType; }
|
||||
|
||||
|
|
|
@ -128,7 +128,7 @@ void BaseOptions::LookupInfo::buildEngineInfo(VPackBuilder& result) const {
|
|||
// We only run toVelocyPack on Coordinator.
|
||||
TRI_ASSERT(idxHandles.size() == 1);
|
||||
|
||||
idxHandles[0].toVelocyPack(result, Index::SERIALIZE_BASICS);
|
||||
idxHandles[0].toVelocyPack(result, Index::makeFlags(Index::Serialize::Basics));
|
||||
|
||||
if (expression != nullptr) {
|
||||
result.add(VPackValue("expression"));
|
||||
|
@ -335,7 +335,7 @@ void BaseOptions::injectVelocyPackIndexes(VPackBuilder& builder) const {
|
|||
for (auto const& it : _baseLookupInfos) {
|
||||
for (auto const& it2 : it.idxHandles) {
|
||||
builder.openObject();
|
||||
it2.getIndex()->toVelocyPack(builder, Index::SERIALIZE_BASICS);
|
||||
it2.getIndex()->toVelocyPack(builder, Index::makeFlags(Index::Serialize::Basics));
|
||||
builder.close();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -152,7 +152,7 @@ void ShortestPathOptions::toVelocyPackIndexes(VPackBuilder& builder) const {
|
|||
builder.add("base", VPackValue(VPackValueType::Array));
|
||||
for (auto const& it : _baseLookupInfos) {
|
||||
for (auto const& it2 : it.idxHandles) {
|
||||
it2.getIndex()->toVelocyPack(builder, Index::SERIALIZE_BASICS);
|
||||
it2.getIndex()->toVelocyPack(builder, Index::makeFlags(Index::Serialize::Basics));
|
||||
}
|
||||
}
|
||||
builder.close();
|
||||
|
|
|
@ -306,7 +306,7 @@ void TraverserOptions::toVelocyPackIndexes(VPackBuilder& builder) const {
|
|||
builder.add("base", VPackValue(VPackValueType::Array));
|
||||
for (auto const& it : _baseLookupInfos) {
|
||||
for (auto const& it2 : it.idxHandles) {
|
||||
it2.getIndex()->toVelocyPack(builder, Index::SERIALIZE_BASICS);
|
||||
it2.getIndex()->toVelocyPack(builder, Index::makeFlags(Index::Serialize::Basics));
|
||||
}
|
||||
}
|
||||
builder.close();
|
||||
|
@ -318,7 +318,7 @@ void TraverserOptions::toVelocyPackIndexes(VPackBuilder& builder) const {
|
|||
builder.add(VPackValue(VPackValueType::Array));
|
||||
for (auto const& it2 : it.second) {
|
||||
for (auto const& it3 : it2.idxHandles) {
|
||||
it3.getIndex()->toVelocyPack(builder, Index::SERIALIZE_BASICS);
|
||||
it3.getIndex()->toVelocyPack(builder, Index::makeFlags(Index::Serialize::Basics));
|
||||
}
|
||||
}
|
||||
builder.close();
|
||||
|
|
|
@ -175,7 +175,7 @@ bool IResearchLinkCoordinator::matchesDefinition(VPackSlice const& slice) const
|
|||
|
||||
void IResearchLinkCoordinator::toVelocyPack(
|
||||
arangodb::velocypack::Builder& builder,
|
||||
unsigned flags
|
||||
std::underlying_type<arangodb::Index::Serialize>::type flags
|
||||
) const {
|
||||
TRI_ASSERT(_view);
|
||||
TRI_ASSERT(!builder.isOpenObject());
|
||||
|
@ -197,7 +197,7 @@ void IResearchLinkCoordinator::toVelocyPack(
|
|||
arangodb::velocypack::Value(_view->guid())
|
||||
);
|
||||
|
||||
if (flags & arangodb::Index::SERIALIZE_FIGURES) {
|
||||
if (arangodb::Index::hasFlag(flags, arangodb::Index::Serialize::Figures)) {
|
||||
builder.add(
|
||||
"figures",
|
||||
arangodb::velocypack::Value(arangodb::velocypack::ValueType::Object)
|
||||
|
|
|
@ -142,7 +142,7 @@ class IResearchLinkCoordinator final: public arangodb::Index {
|
|||
using Index::toVelocyPack; // for Index::toVelocyPack(bool, unsigned)
|
||||
virtual void toVelocyPack(
|
||||
arangodb::velocypack::Builder& builder,
|
||||
unsigned flags
|
||||
std::underlying_type<arangodb::Index::Serialize>::type flags
|
||||
) const override;
|
||||
|
||||
virtual IndexType type() const override {
|
||||
|
|
|
@ -80,7 +80,7 @@ IResearchMMFilesLink::~IResearchMMFilesLink() {
|
|||
|
||||
void IResearchMMFilesLink::toVelocyPack(
|
||||
arangodb::velocypack::Builder& builder,
|
||||
unsigned int flags
|
||||
std::underlying_type<arangodb::Index::Serialize>::type flags
|
||||
) const {
|
||||
if (builder.isOpenObject()) {
|
||||
THROW_ARANGO_EXCEPTION(arangodb::Result(
|
||||
|
@ -98,7 +98,7 @@ void IResearchMMFilesLink::toVelocyPack(
|
|||
));
|
||||
}
|
||||
|
||||
if (flags & arangodb::Index::SERIALIZE_FIGURES) {
|
||||
if (arangodb::Index::hasFlag(flags, arangodb::Index::Serialize::Figures)) {
|
||||
VPackBuilder figuresBuilder;
|
||||
|
||||
figuresBuilder.openObject();
|
||||
|
@ -115,4 +115,4 @@ NS_END // arangodb
|
|||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- END-OF-FILE
|
||||
// -----------------------------------------------------------------------------
|
||||
// -----------------------------------------------------------------------------
|
||||
|
|
|
@ -124,7 +124,7 @@ class IResearchMMFilesLink final
|
|||
using Index::toVelocyPack; // for Index::toVelocyPack(bool, unsigned)
|
||||
virtual void toVelocyPack(
|
||||
arangodb::velocypack::Builder& builder,
|
||||
unsigned int flags
|
||||
std::underlying_type<arangodb::Index::Serialize>::type
|
||||
) const override;
|
||||
|
||||
virtual IndexType type() const override {
|
||||
|
@ -152,4 +152,4 @@ class IResearchMMFilesLink final
|
|||
NS_END // iresearch
|
||||
NS_END // arangodb
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -89,7 +89,7 @@ IResearchRocksDBLink::~IResearchRocksDBLink() {
|
|||
|
||||
void IResearchRocksDBLink::toVelocyPack(
|
||||
arangodb::velocypack::Builder& builder,
|
||||
unsigned int flags
|
||||
std::underlying_type<arangodb::Index::Serialize>::type flags
|
||||
) const {
|
||||
if (builder.isOpenObject()) {
|
||||
THROW_ARANGO_EXCEPTION(arangodb::Result(
|
||||
|
@ -107,7 +107,7 @@ void IResearchRocksDBLink::toVelocyPack(
|
|||
));
|
||||
}
|
||||
|
||||
if (flags & arangodb::Index::SERIALIZE_FIGURES) {
|
||||
if (arangodb::Index::hasFlag(flags, arangodb::Index::Serialize::Figures)) {
|
||||
VPackBuilder figuresBuilder;
|
||||
|
||||
figuresBuilder.openObject();
|
||||
|
@ -144,4 +144,4 @@ NS_END // arangodb
|
|||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- END-OF-FILE
|
||||
// -----------------------------------------------------------------------------
|
||||
// -----------------------------------------------------------------------------
|
||||
|
|
|
@ -123,7 +123,7 @@ class IResearchRocksDBLink final
|
|||
using Index::toVelocyPack; // for Index::toVelocyPack(bool, unsigned)
|
||||
virtual void toVelocyPack(
|
||||
arangodb::velocypack::Builder& builder,
|
||||
unsigned int flags
|
||||
std::underlying_type<arangodb::Index::Serialize>::type flags
|
||||
) const override;
|
||||
|
||||
virtual IndexType type() const override {
|
||||
|
@ -152,4 +152,4 @@ class IResearchRocksDBLink final
|
|||
NS_END // iresearch
|
||||
NS_END // arangodb
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -484,7 +484,7 @@ std::string Index::context() const {
|
|||
|
||||
/// @brief create a VelocyPack representation of the index
|
||||
/// base functionality (called from derived classes)
|
||||
std::shared_ptr<VPackBuilder> Index::toVelocyPack(unsigned flags) const {
|
||||
std::shared_ptr<VPackBuilder> Index::toVelocyPack(std::underlying_type<Index::Serialize>::type flags) const {
|
||||
auto builder = std::make_shared<VPackBuilder>();
|
||||
toVelocyPack(*builder, flags);
|
||||
return builder;
|
||||
|
@ -493,7 +493,8 @@ std::shared_ptr<VPackBuilder> Index::toVelocyPack(unsigned flags) const {
|
|||
/// @brief create a VelocyPack representation of the index
|
||||
/// base functionality (called from derived classes)
|
||||
/// note: needs an already-opened object as its input!
|
||||
void Index::toVelocyPack(VPackBuilder& builder, unsigned flags) const {
|
||||
void Index::toVelocyPack(VPackBuilder& builder,
|
||||
std::underlying_type<Index::Serialize>::type flags) const {
|
||||
TRI_ASSERT(builder.isOpenObject());
|
||||
builder.add(
|
||||
arangodb::StaticStrings::IndexId,
|
||||
|
@ -517,11 +518,12 @@ void Index::toVelocyPack(VPackBuilder& builder, unsigned flags) const {
|
|||
|
||||
builder.close();
|
||||
|
||||
if (hasSelectivityEstimate() && (flags & SERIALIZE_ESTIMATES)) {
|
||||
if (hasSelectivityEstimate() &&
|
||||
Index::hasFlag(flags, Index::Serialize::Estimates)) {
|
||||
builder.add("selectivityEstimate", VPackValue(selectivityEstimate()));
|
||||
}
|
||||
|
||||
if (flags & SERIALIZE_FIGURES) {
|
||||
if (Index::hasFlag(flags, Index::Serialize::Figures)) {
|
||||
builder.add("figures", VPackValue(VPackValueType::Object));
|
||||
toVelocyPackFigures(builder);
|
||||
builder.close();
|
||||
|
|
|
@ -266,20 +266,38 @@ class Index {
|
|||
|
||||
virtual size_t memory() const = 0;
|
||||
|
||||
// serialization flags for indexes
|
||||
|
||||
// serialize the basics. this cannot be turne off
|
||||
static constexpr unsigned SERIALIZE_BASICS = 0;
|
||||
// serialize figures for index
|
||||
static constexpr unsigned SERIALIZE_FIGURES = 1;
|
||||
// serialize object ids for persistence
|
||||
static constexpr unsigned SERIALIZE_OBJECTID = 1 << 1;
|
||||
// serialize selectivity estimates
|
||||
static constexpr unsigned SERIALIZE_ESTIMATES = 1 << 2;
|
||||
/// @brief serialization flags for indexes.
|
||||
/// note that these must be mutually exclusive when bit-ORed
|
||||
enum class Serialize : uint8_t {
|
||||
/// @brief serialize figures for index
|
||||
Basics = 0,
|
||||
/// @brief serialize figures for index
|
||||
Figures = 2,
|
||||
/// @brief serialize object ids for persistence
|
||||
ObjectId = 4,
|
||||
/// @brief serialize selectivity estimates
|
||||
Estimates = 8
|
||||
};
|
||||
|
||||
/// @brief helper for building flags
|
||||
template <typename... Args>
|
||||
static inline constexpr std::underlying_type<Serialize>::type makeFlags(Serialize flag, Args... args) {
|
||||
return static_cast<std::underlying_type<Serialize>::type>(flag) + makeFlags(args...);
|
||||
}
|
||||
|
||||
static inline constexpr std::underlying_type<Serialize>::type makeFlags() {
|
||||
return static_cast<std::underlying_type<Serialize>::type>(Serialize::Basics);
|
||||
}
|
||||
|
||||
static inline constexpr bool hasFlag(std::underlying_type<Serialize>::type flags,
|
||||
Serialize aflag) {
|
||||
return (flags & static_cast<std::underlying_type<Serialize>::type>(aflag)) != 0;
|
||||
}
|
||||
|
||||
/// serialize an index to velocypack, using the serialization flags above
|
||||
virtual void toVelocyPack(arangodb::velocypack::Builder&, unsigned flags) const;
|
||||
std::shared_ptr<arangodb::velocypack::Builder> toVelocyPack(unsigned flags) const;
|
||||
virtual void toVelocyPack(arangodb::velocypack::Builder&,
|
||||
std::underlying_type<Index::Serialize>::type flags) const;
|
||||
std::shared_ptr<arangodb::velocypack::Builder> toVelocyPack(std::underlying_type<Serialize>::type flags) const;
|
||||
|
||||
virtual void toVelocyPackFigures(arangodb::velocypack::Builder&) const;
|
||||
std::shared_ptr<arangodb::velocypack::Builder> toVelocyPackFigures() const;
|
||||
|
|
|
@ -51,7 +51,7 @@ class IndexResult : public Result {
|
|||
|
||||
// build fields string
|
||||
VPackBuilder builder;
|
||||
index->toVelocyPack(builder, Index::SERIALIZE_BASICS);
|
||||
index->toVelocyPack(builder, Index::makeFlags());
|
||||
VPackSlice fields = builder.slice().get("fields");
|
||||
if (!fields.isNone()) {
|
||||
_errorMessage.append(" over ");
|
||||
|
|
|
@ -2187,7 +2187,7 @@ int MMFilesCollection::saveIndex(transaction::Methods* trx,
|
|||
|
||||
std::shared_ptr<VPackBuilder> builder;
|
||||
try {
|
||||
builder = idx->toVelocyPack(Index::SERIALIZE_OBJECTID);
|
||||
builder = idx->toVelocyPack(Index::makeFlags(Index::Serialize::ObjectId));
|
||||
} catch (arangodb::basics::Exception const& ex) {
|
||||
LOG_TOPIC(ERR, arangodb::Logger::FIXME) << "cannot save index definition: " << ex.what();
|
||||
return ex.code();
|
||||
|
|
|
@ -245,7 +245,8 @@ size_t MMFilesEdgeIndex::memory() const {
|
|||
}
|
||||
|
||||
/// @brief return a VelocyPack representation of the index
|
||||
void MMFilesEdgeIndex::toVelocyPack(VPackBuilder& builder, unsigned flags) const {
|
||||
void MMFilesEdgeIndex::toVelocyPack(VPackBuilder& builder,
|
||||
std::underlying_type<Index::Serialize>::type flags) const {
|
||||
builder.openObject();
|
||||
Index::toVelocyPack(builder, flags);
|
||||
// hard-coded
|
||||
|
|
|
@ -162,7 +162,8 @@ class MMFilesEdgeIndex final : public MMFilesIndex {
|
|||
|
||||
size_t memory() const override;
|
||||
|
||||
void toVelocyPack(VPackBuilder&, unsigned flags) const override;
|
||||
void toVelocyPack(VPackBuilder&,
|
||||
std::underlying_type<Index::Serialize>::type) const override;
|
||||
|
||||
void toVelocyPackFigures(VPackBuilder&) const override;
|
||||
|
||||
|
|
|
@ -119,7 +119,8 @@ size_t MMFilesFulltextIndex::memory() const {
|
|||
}
|
||||
|
||||
/// @brief return a VelocyPack representation of the index
|
||||
void MMFilesFulltextIndex::toVelocyPack(VPackBuilder& builder, unsigned flags) const {
|
||||
void MMFilesFulltextIndex::toVelocyPack(VPackBuilder& builder,
|
||||
std::underlying_type<Index::Serialize>::type flags) const {
|
||||
builder.openObject();
|
||||
Index::toVelocyPack(builder, flags);
|
||||
builder.add(
|
||||
|
|
|
@ -62,7 +62,7 @@ class MMFilesFulltextIndex final : public MMFilesIndex {
|
|||
|
||||
size_t memory() const override;
|
||||
|
||||
void toVelocyPack(VPackBuilder&, unsigned flags) const override;
|
||||
void toVelocyPack(VPackBuilder&, std::underlying_type<Serialize>::type) const override;
|
||||
|
||||
bool matchesDefinition(VPackSlice const&) const override;
|
||||
|
||||
|
|
|
@ -232,7 +232,8 @@ MMFilesGeoIndex::MMFilesGeoIndex(
|
|||
size_t MMFilesGeoIndex::memory() const { return _tree.bytes_used(); }
|
||||
|
||||
/// @brief return a JSON representation of the index
|
||||
void MMFilesGeoIndex::toVelocyPack(VPackBuilder& builder, unsigned flags) const {
|
||||
void MMFilesGeoIndex::toVelocyPack(VPackBuilder& builder,
|
||||
std::underlying_type<arangodb::Index::Serialize>::type flags) const {
|
||||
TRI_ASSERT(_variant != geo_index::Index::Variant::NONE);
|
||||
builder.openObject();
|
||||
// Basic index
|
||||
|
|
|
@ -80,7 +80,9 @@ class MMFilesGeoIndex final : public MMFilesIndex, public geo_index::Index {
|
|||
|
||||
size_t memory() const override;
|
||||
|
||||
void toVelocyPack(velocypack::Builder&, unsigned flags) const override;
|
||||
using arangodb::Index::toVelocyPack;
|
||||
void toVelocyPack(velocypack::Builder&,
|
||||
std::underlying_type<arangodb::Index::Serialize>::type) const override;
|
||||
|
||||
bool matchesDefinition(velocypack::Slice const& info) const override;
|
||||
|
||||
|
|
|
@ -73,7 +73,8 @@ void MMFilesPathBasedIndex::toVelocyPackFigures(VPackBuilder& builder) const {
|
|||
}
|
||||
|
||||
/// @brief return a VelocyPack representation of the index
|
||||
void MMFilesPathBasedIndex::toVelocyPack(VPackBuilder& builder, unsigned flags) const {
|
||||
void MMFilesPathBasedIndex::toVelocyPack(VPackBuilder& builder,
|
||||
std::underlying_type<Serialize>::type flags) const {
|
||||
builder.openObject();
|
||||
Index::toVelocyPack(builder, flags);
|
||||
builder.add(
|
||||
|
|
|
@ -53,7 +53,8 @@ class MMFilesPathBasedIndex : public MMFilesIndex {
|
|||
|
||||
void toVelocyPackFigures(arangodb::velocypack::Builder&) const override;
|
||||
|
||||
void toVelocyPack(arangodb::velocypack::Builder& builder, unsigned flags) const override;
|
||||
void toVelocyPack(arangodb::velocypack::Builder& builder,
|
||||
std::underlying_type<Index::Serialize>::type) const override;
|
||||
|
||||
/// @brief return the attribute paths
|
||||
std::vector<std::vector<std::string>> const& paths()
|
||||
|
|
|
@ -220,7 +220,8 @@ size_t MMFilesPrimaryIndex::memory() const {
|
|||
}
|
||||
|
||||
/// @brief return a VelocyPack representation of the index
|
||||
void MMFilesPrimaryIndex::toVelocyPack(VPackBuilder& builder, unsigned flags) const {
|
||||
void MMFilesPrimaryIndex::toVelocyPack(VPackBuilder& builder,
|
||||
std::underlying_type<Serialize>::type flags) const {
|
||||
builder.openObject();
|
||||
Index::toVelocyPack(builder, flags);
|
||||
// hard-coded
|
||||
|
|
|
@ -192,7 +192,8 @@ class MMFilesPrimaryIndex final : public MMFilesIndex {
|
|||
|
||||
size_t memory() const override;
|
||||
|
||||
void toVelocyPack(VPackBuilder&, unsigned flags) const override;
|
||||
void toVelocyPack(VPackBuilder&,
|
||||
std::underlying_type<Index::Serialize>::type) const override;
|
||||
void toVelocyPackFigures(VPackBuilder&) const override;
|
||||
|
||||
Result insert(transaction::Methods*, LocalDocumentId const& documentId,
|
||||
|
|
|
@ -96,10 +96,14 @@ RestStatus RestIndexHandler::getIndexes() {
|
|||
return RestStatus::DONE;
|
||||
}
|
||||
|
||||
bool withFigures = _request->parsedValue("withStats", false);
|
||||
|
||||
auto flags = Index::makeFlags(Index::Serialize::Estimates);
|
||||
if (_request->parsedValue("withStats", false)) {
|
||||
flags = Index::makeFlags(Index::Serialize::Estimates, Index::Serialize::Figures);
|
||||
}
|
||||
bool withLinks = _request->parsedValue("withLinks", false);
|
||||
|
||||
VPackBuilder indexes;
|
||||
Result res = methods::Indexes::getAll(coll, withFigures, indexes);
|
||||
Result res = methods::Indexes::getAll(coll, flags, withLinks, indexes);
|
||||
if (!res.ok()) {
|
||||
generateError(rest::ResponseCode::BAD, res.errorNumber(),
|
||||
res.errorMessage());
|
||||
|
|
|
@ -411,7 +411,7 @@ std::shared_ptr<Index> RocksDBCollection::createIndex(
|
|||
{"path", "statusString"}, true, /*forPersistence*/ true);
|
||||
VPackBuilder indexInfo;
|
||||
|
||||
idx->toVelocyPack(indexInfo, Index::SERIALIZE_OBJECTID);
|
||||
idx->toVelocyPack(indexInfo, Index::makeFlags(Index::Serialize::ObjectId));
|
||||
res = static_cast<RocksDBEngine*>(engine)->writeCreateCollectionMarker(
|
||||
_logicalCollection.vocbase().id(),
|
||||
_logicalCollection.id(),
|
||||
|
@ -501,7 +501,7 @@ int RocksDBCollection::restoreIndex(transaction::Methods* trx,
|
|||
{"path", "statusString"}, true, /*forPersistence*/ true);
|
||||
VPackBuilder indexInfo;
|
||||
|
||||
newIdx->toVelocyPack(indexInfo, Index::SERIALIZE_OBJECTID);
|
||||
newIdx->toVelocyPack(indexInfo, Index::makeFlags(Index::Serialize::ObjectId));
|
||||
|
||||
RocksDBEngine* engine =
|
||||
static_cast<RocksDBEngine*>(EngineSelectorFeature::ENGINE);
|
||||
|
|
|
@ -558,7 +558,8 @@ double RocksDBEdgeIndex::selectivityEstimate(
|
|||
}
|
||||
|
||||
/// @brief return a VelocyPack representation of the index
|
||||
void RocksDBEdgeIndex::toVelocyPack(VPackBuilder& builder, unsigned flags) const {
|
||||
void RocksDBEdgeIndex::toVelocyPack(VPackBuilder& builder,
|
||||
std::underlying_type<Serialize>::type flags) const {
|
||||
builder.openObject();
|
||||
RocksDBIndex::toVelocyPack(builder, flags);
|
||||
builder.add(
|
||||
|
|
|
@ -142,7 +142,8 @@ class RocksDBEdgeIndex final : public RocksDBIndex {
|
|||
RocksDBCuckooIndexEstimator<uint64_t>* estimator() override;
|
||||
bool needToPersistEstimate() const override;
|
||||
|
||||
void toVelocyPack(VPackBuilder&, unsigned flags) const override;
|
||||
void toVelocyPack(VPackBuilder&,
|
||||
std::underlying_type<Index::Serialize>::type) const override;
|
||||
|
||||
void batchInsert(
|
||||
transaction::Methods*,
|
||||
|
|
|
@ -85,7 +85,8 @@ RocksDBFulltextIndex::RocksDBFulltextIndex(
|
|||
}
|
||||
|
||||
/// @brief return a VelocyPack representation of the index
|
||||
void RocksDBFulltextIndex::toVelocyPack(VPackBuilder& builder, unsigned flags) const {
|
||||
void RocksDBFulltextIndex::toVelocyPack(VPackBuilder& builder,
|
||||
std::underlying_type<Serialize>::type flags) const {
|
||||
builder.openObject();
|
||||
RocksDBIndex::toVelocyPack(builder, flags);
|
||||
builder.add(
|
||||
|
|
|
@ -87,7 +87,8 @@ class RocksDBFulltextIndex final : public RocksDBIndex {
|
|||
|
||||
bool hasSelectivityEstimate() const override { return false; }
|
||||
|
||||
void toVelocyPack(VPackBuilder&, unsigned flags) const override;
|
||||
void toVelocyPack(VPackBuilder&,
|
||||
std::underlying_type<Index::Serialize>::type) const override;
|
||||
|
||||
bool matchesDefinition(VPackSlice const&) const override;
|
||||
|
||||
|
|
|
@ -255,7 +255,8 @@ RocksDBGeoIndex::RocksDBGeoIndex(
|
|||
}
|
||||
|
||||
/// @brief return a JSON representation of the index
|
||||
void RocksDBGeoIndex::toVelocyPack(VPackBuilder& builder, unsigned flags) const {
|
||||
void RocksDBGeoIndex::toVelocyPack(VPackBuilder& builder,
|
||||
std::underlying_type<arangodb::Index::Serialize>::type flags) const {
|
||||
TRI_ASSERT(_variant != geo_index::Index::Variant::NONE);
|
||||
builder.openObject();
|
||||
RocksDBIndex::toVelocyPack(builder, flags);
|
||||
|
|
|
@ -76,7 +76,8 @@ class RocksDBGeoIndex final : public RocksDBIndex, public geo_index::Index {
|
|||
|
||||
bool hasSelectivityEstimate() const override { return false; }
|
||||
|
||||
void toVelocyPack(velocypack::Builder&, unsigned flags) const override;
|
||||
void toVelocyPack(velocypack::Builder&,
|
||||
std::underlying_type<arangodb::Index::Serialize>::type) const override;
|
||||
|
||||
bool matchesDefinition(velocypack::Slice const& info) const override;
|
||||
|
||||
|
|
|
@ -158,9 +158,10 @@ void RocksDBIndex::unload() {
|
|||
}
|
||||
|
||||
/// @brief return a VelocyPack representation of the index
|
||||
void RocksDBIndex::toVelocyPack(VPackBuilder& builder, unsigned flags) const {
|
||||
void RocksDBIndex::toVelocyPack(VPackBuilder& builder,
|
||||
std::underlying_type<Serialize>::type flags) const {
|
||||
Index::toVelocyPack(builder, flags);
|
||||
if (flags & Index::SERIALIZE_OBJECTID) {
|
||||
if (Index::hasFlag(flags, Index::Serialize::ObjectId)) {
|
||||
// If we store it, it cannot be 0
|
||||
TRI_ASSERT(_objectId != 0);
|
||||
builder.add("objectId", VPackValue(std::to_string(_objectId)));
|
||||
|
|
|
@ -58,7 +58,8 @@ class RocksDBIndex : public Index {
|
|||
void toVelocyPackFigures(VPackBuilder& builder) const override;
|
||||
|
||||
/// @brief return a VelocyPack representation of the index
|
||||
void toVelocyPack(velocypack::Builder& builder, unsigned flags) const override;
|
||||
void toVelocyPack(velocypack::Builder& builder,
|
||||
std::underlying_type<Index::Serialize>::type) const override;
|
||||
|
||||
uint64_t objectId() const { return _objectId; }
|
||||
|
||||
|
|
|
@ -178,7 +178,8 @@ void RocksDBPrimaryIndex::load() {
|
|||
}
|
||||
|
||||
/// @brief return a VelocyPack representation of the index
|
||||
void RocksDBPrimaryIndex::toVelocyPack(VPackBuilder& builder, unsigned flags) const {
|
||||
void RocksDBPrimaryIndex::toVelocyPack(VPackBuilder& builder,
|
||||
std::underlying_type<Serialize>::type flags) const {
|
||||
builder.openObject();
|
||||
RocksDBIndex::toVelocyPack(builder, flags);
|
||||
// hard-coded
|
||||
|
|
|
@ -108,7 +108,8 @@ class RocksDBPrimaryIndex final : public RocksDBIndex {
|
|||
|
||||
void load() override;
|
||||
|
||||
void toVelocyPack(VPackBuilder&, unsigned flags) const override;
|
||||
void toVelocyPack(VPackBuilder&,
|
||||
std::underlying_type<Index::Serialize>::type) const override;
|
||||
|
||||
LocalDocumentId lookupKey(transaction::Methods* trx,
|
||||
arangodb::StringRef key) const;
|
||||
|
|
|
@ -309,7 +309,8 @@ double RocksDBVPackIndex::selectivityEstimate(
|
|||
}
|
||||
|
||||
/// @brief return a VelocyPack representation of the index
|
||||
void RocksDBVPackIndex::toVelocyPack(VPackBuilder& builder, unsigned flags) const {
|
||||
void RocksDBVPackIndex::toVelocyPack(VPackBuilder& builder,
|
||||
std::underlying_type<Serialize>::type flags) const {
|
||||
builder.openObject();
|
||||
RocksDBIndex::toVelocyPack(builder, flags);
|
||||
builder.add(
|
||||
|
|
|
@ -157,7 +157,8 @@ class RocksDBVPackIndex : public RocksDBIndex {
|
|||
RocksDBCuckooIndexEstimator<uint64_t>* estimator() override;
|
||||
bool needToPersistEstimate() const override;
|
||||
|
||||
void toVelocyPack(VPackBuilder&, unsigned flags) const override;
|
||||
void toVelocyPack(VPackBuilder&,
|
||||
std::underlying_type<Index::Serialize>::type) const override;
|
||||
|
||||
bool canBeDropped() const override { return true; }
|
||||
|
||||
|
|
|
@ -288,7 +288,8 @@ std::shared_ptr<arangodb::Index> transaction::Methods::IndexHandle::getIndex()
|
|||
|
||||
/// @brief IndexHandle toVelocyPack method passthrough
|
||||
void transaction::Methods::IndexHandle::toVelocyPack(
|
||||
arangodb::velocypack::Builder& builder, unsigned flags) const {
|
||||
arangodb::velocypack::Builder& builder,
|
||||
std::underlying_type<Index::Serialize>::type flags) const {
|
||||
_index->toVelocyPack(builder, flags);
|
||||
}
|
||||
|
||||
|
|
|
@ -99,7 +99,8 @@ class Methods {
|
|||
std::shared_ptr<arangodb::Index> _index;
|
||||
public:
|
||||
IndexHandle() = default;
|
||||
void toVelocyPack(arangodb::velocypack::Builder& builder, unsigned flags) const;
|
||||
void toVelocyPack(arangodb::velocypack::Builder& builder,
|
||||
std::underlying_type<Index::Serialize>::type flags) const;
|
||||
bool operator==(IndexHandle const& other) const {
|
||||
return other._index.get() == _index.get();
|
||||
}
|
||||
|
|
|
@ -174,13 +174,17 @@ static void JS_GetIndexesVocbaseCol(
|
|||
TRI_V8_THROW_EXCEPTION_INTERNAL("cannot extract collection");
|
||||
}
|
||||
|
||||
bool withFigures = false;
|
||||
if (args.Length() > 0) {
|
||||
withFigures = TRI_ObjectToBoolean(args[0]);
|
||||
auto flags = Index::makeFlags(Index::Serialize::Estimates);
|
||||
if (args.Length() > 0 && TRI_ObjectToBoolean(args[0])) {
|
||||
flags = Index::makeFlags(Index::Serialize::Estimates, Index::Serialize::Figures);
|
||||
}
|
||||
bool withLinks = false;
|
||||
if (args.Length() > 1) {
|
||||
withLinks = TRI_ObjectToBoolean(args[1]);
|
||||
}
|
||||
|
||||
VPackBuilder output;
|
||||
Result res = methods::Indexes::getAll(collection, withFigures, output);
|
||||
Result res = methods::Indexes::getAll(collection, flags, withLinks, output);
|
||||
if (res.fail()) {
|
||||
TRI_V8_THROW_EXCEPTION(res);
|
||||
}
|
||||
|
|
|
@ -493,7 +493,8 @@ LogicalCollection::getIndexes() const {
|
|||
return getPhysical()->getIndexes();
|
||||
}
|
||||
|
||||
void LogicalCollection::getIndexesVPack(VPackBuilder& result, unsigned flags,
|
||||
void LogicalCollection::getIndexesVPack(VPackBuilder& result,
|
||||
std::underlying_type<Index::Serialize>::type flags,
|
||||
std::function<bool(arangodb::Index const*)> const& filter) const {
|
||||
getPhysical()->getIndexesVPack(result, flags, filter);
|
||||
}
|
||||
|
@ -637,7 +638,7 @@ void LogicalCollection::toVelocyPackForClusterInventory(VPackBuilder& result,
|
|||
}
|
||||
|
||||
result.add(VPackValue("indexes"));
|
||||
getIndexesVPack(result, Index::SERIALIZE_BASICS);
|
||||
getIndexesVPack(result, Index::makeFlags());
|
||||
result.add("planVersion", VPackValue(planVersion()));
|
||||
result.add("isReady", VPackValue(isReady));
|
||||
result.add("allInSync", VPackValue(allInSync));
|
||||
|
@ -689,9 +690,9 @@ arangodb::Result LogicalCollection::appendVelocyPack(
|
|||
|
||||
// Indexes
|
||||
result.add(VPackValue("indexes"));
|
||||
unsigned flags = Index::SERIALIZE_BASICS;
|
||||
auto flags = Index::makeFlags();
|
||||
if (forPersistence) {
|
||||
flags |= Index::SERIALIZE_OBJECTID;
|
||||
flags = Index::makeFlags(Index::Serialize::ObjectId);
|
||||
}
|
||||
getIndexesVPack(result, flags);
|
||||
|
||||
|
|
|
@ -215,7 +215,7 @@ class LogicalCollection: public LogicalDataSource {
|
|||
|
||||
std::vector<std::shared_ptr<Index>> getIndexes() const;
|
||||
|
||||
void getIndexesVPack(velocypack::Builder&, unsigned flags,
|
||||
void getIndexesVPack(velocypack::Builder&, uint8_t,
|
||||
std::function<bool(arangodb::Index const*)> const& filter =
|
||||
[](arangodb::Index const*) -> bool { return true; }) const;
|
||||
|
||||
|
|
|
@ -81,8 +81,9 @@ Result Indexes::getIndex(LogicalCollection const* collection,
|
|||
return Result(TRI_ERROR_ARANGO_INDEX_NOT_FOUND);
|
||||
}
|
||||
|
||||
|
||||
VPackBuilder tmp;
|
||||
Result res = Indexes::getAll(collection, false, tmp);
|
||||
Result res = Indexes::getAll(collection, Index::makeFlags(), false, tmp);
|
||||
if (res.ok()) {
|
||||
for (VPackSlice const& index : VPackArrayIterator(tmp.slice())) {
|
||||
if (index.get("id").compareString(name) == 0) {
|
||||
|
@ -94,13 +95,11 @@ Result Indexes::getIndex(LogicalCollection const* collection,
|
|||
return Result(TRI_ERROR_ARANGO_INDEX_NOT_FOUND);
|
||||
}
|
||||
|
||||
/// @brief get all indexes, skips view links
|
||||
arangodb::Result Indexes::getAll(LogicalCollection const* collection,
|
||||
bool withFigures, VPackBuilder& result) {
|
||||
|
||||
unsigned flags = Index::SERIALIZE_ESTIMATES;
|
||||
if (withFigures) {
|
||||
flags |= Index::SERIALIZE_FIGURES;
|
||||
}
|
||||
std::underlying_type<Index::Serialize>::type flags,
|
||||
bool withLinks,
|
||||
VPackBuilder& result) {
|
||||
VPackBuilder tmp;
|
||||
if (ServerState::instance()->isCoordinator()) {
|
||||
TRI_ASSERT(collection);
|
||||
|
@ -117,7 +116,13 @@ arangodb::Result Indexes::getAll(LogicalCollection const* collection,
|
|||
|
||||
VPackBuilder tmpInner;
|
||||
auto c = ClusterInfo::instance()->getCollection(databaseName, cid);
|
||||
#ifdef USE_IRESEARCH
|
||||
c->getIndexesVPack(tmpInner, flags, [withLinks](arangodb::Index const* idx) {
|
||||
return withLinks || idx->type() != Index::TRI_IDX_TYPE_IRESEARCH_LINK;
|
||||
});
|
||||
#else
|
||||
c->getIndexesVPack(tmpInner, flags);
|
||||
#endif
|
||||
|
||||
tmp.openArray();
|
||||
for (VPackSlice const& s : VPackArrayIterator(tmpInner.slice())) {
|
||||
|
@ -160,8 +165,12 @@ arangodb::Result Indexes::getAll(LogicalCollection const* collection,
|
|||
auto indexes = collection->getIndexes();
|
||||
|
||||
tmp.openArray(true);
|
||||
|
||||
for (std::shared_ptr<arangodb::Index> const& idx : indexes) {
|
||||
#ifdef USE_IRESEARCH
|
||||
if (withLinks && idx->type() == Index::TRI_IDX_TYPE_IRESEARCH_LINK) {
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
idx->toVelocyPack(tmp, flags);
|
||||
}
|
||||
tmp.close();
|
||||
|
@ -234,7 +243,7 @@ arangodb::Result Indexes::getAll(LogicalCollection const* collection,
|
|||
merge.close();
|
||||
|
||||
merge.add("selectivityEstimate", VPackValue(selectivity / 2));
|
||||
if (withFigures) {
|
||||
if (Index::hasFlag(flags, Index::Serialize::Figures)) {
|
||||
merge.add("figures", VPackValue(VPackValueType::Object));
|
||||
merge.add("memory", VPackValue(memory));
|
||||
if (useCache) {
|
||||
|
@ -300,7 +309,7 @@ static Result EnsureIndexLocal(arangodb::LogicalCollection* collection,
|
|||
|
||||
VPackBuilder tmp;
|
||||
try {
|
||||
idx->toVelocyPack(tmp, Index::SERIALIZE_ESTIMATES);
|
||||
idx->toVelocyPack(tmp, Index::makeFlags(Index::Serialize::Estimates));
|
||||
} catch (...) {
|
||||
return Result(TRI_ERROR_OUT_OF_MEMORY);
|
||||
}
|
||||
|
|
|
@ -45,8 +45,10 @@ struct Indexes {
|
|||
velocypack::Slice const& indexId,
|
||||
velocypack::Builder&);
|
||||
|
||||
/// @brief get all indexes, skips view links
|
||||
static arangodb::Result getAll(LogicalCollection const* collection,
|
||||
bool withFigures,
|
||||
std::underlying_type<Index::Serialize>::type,
|
||||
bool skipLinks,
|
||||
arangodb::velocypack::Builder&);
|
||||
|
||||
static arangodb::Result createIndex(LogicalCollection*, Index::IndexType,
|
||||
|
|
|
@ -126,7 +126,7 @@ arangodb::Result recreateGeoIndex(TRI_vocbase_t& vocbase,
|
|||
TRI_idx_iid_t iid = oldIndex->id();
|
||||
|
||||
VPackBuilder oldDesc;
|
||||
oldIndex->toVelocyPack(oldDesc, Index::SERIALIZE_BASICS);
|
||||
oldIndex->toVelocyPack(oldDesc, Index::makeFlags());
|
||||
VPackBuilder overw;
|
||||
|
||||
overw.openObject();
|
||||
|
|
|
@ -1006,7 +1006,7 @@ void TRI_vocbase_t::inventory(
|
|||
result.openObject();
|
||||
|
||||
result.add(VPackValue("indexes"));
|
||||
collection->getIndexesVPack(result, Index::SERIALIZE_BASICS, [](arangodb::Index const* idx) {
|
||||
collection->getIndexesVPack(result, Index::makeFlags(), [](arangodb::Index const* idx) {
|
||||
// we have to exclude the primary and the edge index here, because otherwise
|
||||
// at least the MMFiles engine will try to create it
|
||||
return (idx->type() != arangodb::Index::TRI_IDX_TYPE_PRIMARY_INDEX &&
|
||||
|
|
|
@ -598,9 +598,12 @@ ArangoCollection.prototype.refresh = function () {
|
|||
// / @brief gets all indexes
|
||||
// //////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
ArangoCollection.prototype.getIndexes = ArangoCollection.prototype.indexes = function (withStats) {
|
||||
var requestResult = this._database._connection.GET(this._indexurl() +
|
||||
'&withStats=' + (withStats || false));
|
||||
ArangoCollection.prototype.getIndexes = ArangoCollection.prototype.indexes = function (withStats, withLinks) {
|
||||
let url = this._indexurl() + '&withStats=' + (withStats || false);
|
||||
if (withLinks) {
|
||||
url += '&withLinks=true';
|
||||
}
|
||||
var requestResult = this._database._connection.GET(url);
|
||||
|
||||
arangosh.checkRequestResult(requestResult);
|
||||
|
||||
|
|
|
@ -473,7 +473,7 @@ std::vector<std::string> ProgramOptions::similar(std::string const& value, int c
|
|||
// additionally add all options that have the search string as part
|
||||
// of their name
|
||||
walk(
|
||||
[this, &value, &result](Section const&, Option const& option) {
|
||||
[&value, &result](Section const&, Option const& option) {
|
||||
if (option.fullName().find(value) != std::string::npos) {
|
||||
result.emplace_back(option.displayName());
|
||||
}
|
||||
|
|
|
@ -221,7 +221,7 @@ SECTION("test_defaults") {
|
|||
|
||||
arangodb::iresearch::IResearchLinkMeta actualMeta;
|
||||
arangodb::iresearch::IResearchLinkMeta expectedMeta;
|
||||
auto builder = link->toVelocyPack(arangodb::Index::SERIALIZE_FIGURES);
|
||||
auto builder = link->toVelocyPack(arangodb::Index::makeFlags(arangodb::Index::Serialize::Figures));
|
||||
std::string error;
|
||||
|
||||
CHECK((actualMeta.init(builder->slice(), error) && expectedMeta == actualMeta));
|
||||
|
@ -274,7 +274,7 @@ SECTION("test_defaults") {
|
|||
{
|
||||
arangodb::iresearch::IResearchLinkMeta actualMeta;
|
||||
arangodb::iresearch::IResearchLinkMeta expectedMeta;
|
||||
auto builder = link->toVelocyPack(arangodb::Index::SERIALIZE_FIGURES);
|
||||
auto builder = link->toVelocyPack(arangodb::Index::makeFlags(arangodb::Index::Serialize::Figures));
|
||||
std::string error;
|
||||
|
||||
CHECK((actualMeta.init(builder->slice(), error) && expectedMeta == actualMeta));
|
||||
|
@ -294,7 +294,7 @@ SECTION("test_defaults") {
|
|||
// ensure jSON is still valid after unload()
|
||||
{
|
||||
link->unload();
|
||||
auto builder = link->toVelocyPack(arangodb::Index::SERIALIZE_FIGURES);
|
||||
auto builder = link->toVelocyPack(arangodb::Index::makeFlags(arangodb::Index::Serialize::Figures));
|
||||
auto slice = builder->slice();
|
||||
CHECK((
|
||||
slice.hasKey("view")
|
||||
|
|
|
@ -359,7 +359,7 @@ SECTION("test_create_drop") {
|
|||
|
||||
arangodb::iresearch::IResearchLinkMeta actualMeta;
|
||||
arangodb::iresearch::IResearchLinkMeta expectedMeta;
|
||||
auto builder = index->toVelocyPack(arangodb::Index::SERIALIZE_FIGURES);
|
||||
auto builder = index->toVelocyPack(arangodb::Index::makeFlags(arangodb::Index::Serialize::Figures));
|
||||
|
||||
error.clear();
|
||||
CHECK(actualMeta.init(builder->slice(), error));
|
||||
|
@ -398,7 +398,7 @@ SECTION("test_create_drop") {
|
|||
{
|
||||
arangodb::iresearch::IResearchLinkMeta actualMeta;
|
||||
arangodb::iresearch::IResearchLinkMeta expectedMeta;
|
||||
auto builder = index->toVelocyPack(arangodb::Index::SERIALIZE_FIGURES);
|
||||
auto builder = index->toVelocyPack(arangodb::Index::makeFlags(arangodb::Index::Serialize::Figures));
|
||||
std::string error;
|
||||
|
||||
CHECK((actualMeta.init(builder->slice(), error) && expectedMeta == actualMeta));
|
||||
|
@ -468,7 +468,7 @@ SECTION("test_create_drop") {
|
|||
{
|
||||
arangodb::iresearch::IResearchLinkMeta actualMeta;
|
||||
arangodb::iresearch::IResearchLinkMeta expectedMeta;
|
||||
auto builder = index->toVelocyPack(arangodb::Index::SERIALIZE_FIGURES);
|
||||
auto builder = index->toVelocyPack(arangodb::Index::makeFlags(arangodb::Index::Serialize::Figures));
|
||||
std::string error;
|
||||
|
||||
CHECK((actualMeta.init(builder->slice(), error) && expectedMeta == actualMeta));
|
||||
|
@ -489,7 +489,7 @@ SECTION("test_create_drop") {
|
|||
// ensure jSON is still valid after unload()
|
||||
{
|
||||
index->unload();
|
||||
auto builder = index->toVelocyPack(arangodb::Index::SERIALIZE_FIGURES);
|
||||
auto builder = index->toVelocyPack(arangodb::Index::makeFlags(arangodb::Index::Serialize::Figures));
|
||||
auto slice = builder->slice();
|
||||
CHECK((
|
||||
slice.hasKey("view")
|
||||
|
|
|
@ -1076,7 +1076,7 @@ SECTION("test_update_links_partial_remove") {
|
|||
arangodb::iresearch::IResearchLinkMeta expectedMeta;
|
||||
expectedMeta._includeAllFields = true;
|
||||
arangodb::iresearch::IResearchLinkMeta actualMeta;
|
||||
auto builder = index->toVelocyPack(arangodb::Index::SERIALIZE_FIGURES);
|
||||
auto builder = index->toVelocyPack(arangodb::Index::makeFlags(arangodb::Index::Serialize::Figures));
|
||||
|
||||
error.clear();
|
||||
CHECK(actualMeta.init(builder->slice(), error));
|
||||
|
@ -1122,7 +1122,7 @@ SECTION("test_update_links_partial_remove") {
|
|||
arangodb::iresearch::IResearchLinkMeta expectedMeta;
|
||||
expectedMeta._trackListPositions = true;
|
||||
arangodb::iresearch::IResearchLinkMeta actualMeta;
|
||||
auto builder = index->toVelocyPack(arangodb::Index::SERIALIZE_FIGURES);
|
||||
auto builder = index->toVelocyPack(arangodb::Index::makeFlags(arangodb::Index::Serialize::Figures));
|
||||
|
||||
error.clear();
|
||||
CHECK(actualMeta.init(builder->slice(), error));
|
||||
|
@ -1167,7 +1167,7 @@ SECTION("test_update_links_partial_remove") {
|
|||
|
||||
arangodb::iresearch::IResearchLinkMeta expectedMeta;
|
||||
arangodb::iresearch::IResearchLinkMeta actualMeta;
|
||||
auto builder = index->toVelocyPack(arangodb::Index::SERIALIZE_FIGURES);
|
||||
auto builder = index->toVelocyPack(arangodb::Index::makeFlags(arangodb::Index::Serialize::Figures));
|
||||
|
||||
error.clear();
|
||||
CHECK(actualMeta.init(builder->slice(), error));
|
||||
|
@ -1301,7 +1301,7 @@ SECTION("test_update_links_partial_remove") {
|
|||
arangodb::iresearch::IResearchLinkMeta expectedMeta;
|
||||
expectedMeta._includeAllFields = true;
|
||||
arangodb::iresearch::IResearchLinkMeta actualMeta;
|
||||
auto builder = index->toVelocyPack(arangodb::Index::SERIALIZE_FIGURES);
|
||||
auto builder = index->toVelocyPack(arangodb::Index::makeFlags(arangodb::Index::Serialize::Figures));
|
||||
|
||||
error.clear();
|
||||
CHECK(actualMeta.init(builder->slice(), error));
|
||||
|
@ -1347,7 +1347,7 @@ SECTION("test_update_links_partial_remove") {
|
|||
|
||||
arangodb::iresearch::IResearchLinkMeta expectedMeta;
|
||||
arangodb::iresearch::IResearchLinkMeta actualMeta;
|
||||
auto builder = index->toVelocyPack(arangodb::Index::SERIALIZE_FIGURES);
|
||||
auto builder = index->toVelocyPack(arangodb::Index::makeFlags(arangodb::Index::Serialize::Figures));
|
||||
|
||||
error.clear();
|
||||
CHECK(actualMeta.init(builder->slice(), error));
|
||||
|
@ -1620,7 +1620,7 @@ SECTION("test_update_links_partial_add") {
|
|||
arangodb::iresearch::IResearchLinkMeta expectedMeta;
|
||||
expectedMeta._includeAllFields = true;
|
||||
arangodb::iresearch::IResearchLinkMeta actualMeta;
|
||||
auto builder = index->toVelocyPack(arangodb::Index::SERIALIZE_FIGURES);
|
||||
auto builder = index->toVelocyPack(arangodb::Index::makeFlags(arangodb::Index::Serialize::Figures));
|
||||
|
||||
error.clear();
|
||||
CHECK(actualMeta.init(builder->slice(), error));
|
||||
|
@ -1665,7 +1665,7 @@ SECTION("test_update_links_partial_add") {
|
|||
|
||||
arangodb::iresearch::IResearchLinkMeta expectedMeta;
|
||||
arangodb::iresearch::IResearchLinkMeta actualMeta;
|
||||
auto builder = index->toVelocyPack(arangodb::Index::SERIALIZE_FIGURES);
|
||||
auto builder = index->toVelocyPack(arangodb::Index::makeFlags(arangodb::Index::Serialize::Figures));
|
||||
|
||||
error.clear();
|
||||
CHECK(actualMeta.init(builder->slice(), error));
|
||||
|
@ -1814,7 +1814,7 @@ SECTION("test_update_links_partial_add") {
|
|||
arangodb::iresearch::IResearchLinkMeta expectedMeta;
|
||||
expectedMeta._includeAllFields = true;
|
||||
arangodb::iresearch::IResearchLinkMeta actualMeta;
|
||||
auto builder = index->toVelocyPack(arangodb::Index::SERIALIZE_FIGURES);
|
||||
auto builder = index->toVelocyPack(arangodb::Index::makeFlags(arangodb::Index::Serialize::Figures));
|
||||
|
||||
error.clear();
|
||||
CHECK(actualMeta.init(builder->slice(), error));
|
||||
|
@ -1861,7 +1861,7 @@ SECTION("test_update_links_partial_add") {
|
|||
arangodb::iresearch::IResearchLinkMeta expectedMeta;
|
||||
expectedMeta._trackListPositions = true;
|
||||
arangodb::iresearch::IResearchLinkMeta actualMeta;
|
||||
auto builder = index->toVelocyPack(arangodb::Index::SERIALIZE_FIGURES);
|
||||
auto builder = index->toVelocyPack(arangodb::Index::makeFlags(arangodb::Index::Serialize::Figures));
|
||||
|
||||
error.clear();
|
||||
CHECK(actualMeta.init(builder->slice(), error));
|
||||
|
@ -1907,7 +1907,7 @@ SECTION("test_update_links_partial_add") {
|
|||
|
||||
arangodb::iresearch::IResearchLinkMeta expectedMeta;
|
||||
arangodb::iresearch::IResearchLinkMeta actualMeta;
|
||||
auto builder = index->toVelocyPack(arangodb::Index::SERIALIZE_FIGURES);
|
||||
auto builder = index->toVelocyPack(arangodb::Index::makeFlags(arangodb::Index::Serialize::Figures));
|
||||
|
||||
error.clear();
|
||||
CHECK(actualMeta.init(builder->slice(), error));
|
||||
|
@ -2226,7 +2226,7 @@ SECTION("test_update_links_replace") {
|
|||
arangodb::iresearch::IResearchLinkMeta expectedMeta;
|
||||
expectedMeta._includeAllFields = true;
|
||||
arangodb::iresearch::IResearchLinkMeta actualMeta;
|
||||
auto builder = index->toVelocyPack(arangodb::Index::SERIALIZE_FIGURES);
|
||||
auto builder = index->toVelocyPack(arangodb::Index::makeFlags(arangodb::Index::Serialize::Figures));
|
||||
|
||||
error.clear();
|
||||
CHECK(actualMeta.init(builder->slice(), error));
|
||||
|
@ -2271,7 +2271,7 @@ SECTION("test_update_links_replace") {
|
|||
|
||||
arangodb::iresearch::IResearchLinkMeta expectedMeta;
|
||||
arangodb::iresearch::IResearchLinkMeta actualMeta;
|
||||
auto builder = index->toVelocyPack(arangodb::Index::SERIALIZE_FIGURES);
|
||||
auto builder = index->toVelocyPack(arangodb::Index::makeFlags(arangodb::Index::Serialize::Figures));
|
||||
|
||||
error.clear();
|
||||
CHECK(actualMeta.init(builder->slice(), error));
|
||||
|
@ -2402,7 +2402,7 @@ SECTION("test_update_links_replace") {
|
|||
arangodb::iresearch::IResearchLinkMeta expectedMeta;
|
||||
expectedMeta._trackListPositions = true;
|
||||
arangodb::iresearch::IResearchLinkMeta actualMeta;
|
||||
auto builder = index->toVelocyPack(arangodb::Index::SERIALIZE_FIGURES);
|
||||
auto builder = index->toVelocyPack(arangodb::Index::makeFlags(arangodb::Index::Serialize::Figures));
|
||||
|
||||
error.clear();
|
||||
CHECK(actualMeta.init(builder->slice(), error));
|
||||
|
@ -2524,7 +2524,7 @@ SECTION("test_update_links_replace") {
|
|||
arangodb::iresearch::IResearchLinkMeta expectedMeta;
|
||||
expectedMeta._includeAllFields = true;
|
||||
arangodb::iresearch::IResearchLinkMeta actualMeta;
|
||||
auto builder = index->toVelocyPack(arangodb::Index::SERIALIZE_FIGURES);
|
||||
auto builder = index->toVelocyPack(arangodb::Index::makeFlags(arangodb::Index::Serialize::Figures));
|
||||
|
||||
error.clear();
|
||||
CHECK(actualMeta.init(builder->slice(), error));
|
||||
|
@ -2813,7 +2813,7 @@ SECTION("test_update_links_clear") {
|
|||
arangodb::iresearch::IResearchLinkMeta expectedMeta;
|
||||
expectedMeta._includeAllFields = true;
|
||||
arangodb::iresearch::IResearchLinkMeta actualMeta;
|
||||
auto builder = index->toVelocyPack(arangodb::Index::SERIALIZE_FIGURES);
|
||||
auto builder = index->toVelocyPack(arangodb::Index::makeFlags(arangodb::Index::Serialize::Figures));
|
||||
|
||||
error.clear();
|
||||
CHECK(actualMeta.init(builder->slice(), error));
|
||||
|
@ -2860,7 +2860,7 @@ SECTION("test_update_links_clear") {
|
|||
arangodb::iresearch::IResearchLinkMeta expectedMeta;
|
||||
expectedMeta._trackListPositions = true;
|
||||
arangodb::iresearch::IResearchLinkMeta actualMeta;
|
||||
auto builder = index->toVelocyPack(arangodb::Index::SERIALIZE_FIGURES);
|
||||
auto builder = index->toVelocyPack(arangodb::Index::makeFlags(arangodb::Index::Serialize::Figures));
|
||||
|
||||
error.clear();
|
||||
CHECK(actualMeta.init(builder->slice(), error));
|
||||
|
@ -2905,7 +2905,7 @@ SECTION("test_update_links_clear") {
|
|||
|
||||
arangodb::iresearch::IResearchLinkMeta expectedMeta;
|
||||
arangodb::iresearch::IResearchLinkMeta actualMeta;
|
||||
auto builder = index->toVelocyPack(arangodb::Index::SERIALIZE_FIGURES);
|
||||
auto builder = index->toVelocyPack(arangodb::Index::makeFlags(arangodb::Index::Serialize::Figures));
|
||||
|
||||
error.clear();
|
||||
CHECK(actualMeta.init(builder->slice(), error));
|
||||
|
@ -3172,7 +3172,7 @@ SECTION("test_drop_link") {
|
|||
arangodb::iresearch::IResearchLinkMeta expectedMeta;
|
||||
expectedMeta._includeAllFields = true;
|
||||
arangodb::iresearch::IResearchLinkMeta actualMeta;
|
||||
auto builder = index->toVelocyPack(arangodb::Index::SERIALIZE_FIGURES);
|
||||
auto builder = index->toVelocyPack(arangodb::Index::makeFlags(arangodb::Index::Serialize::Figures));
|
||||
|
||||
error.clear();
|
||||
CHECK(actualMeta.init(builder->slice(), error));
|
||||
|
@ -4391,4 +4391,4 @@ SECTION("IResearchViewNode::createBlock") {
|
|||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- END-OF-FILE
|
||||
// -----------------------------------------------------------------------------
|
||||
// -----------------------------------------------------------------------------
|
||||
|
|
|
@ -184,7 +184,7 @@ class EdgeIndexMock final : public arangodb::Index {
|
|||
|
||||
void toVelocyPack(
|
||||
VPackBuilder& builder,
|
||||
unsigned flags
|
||||
std::underlying_type<arangodb::Index::Serialize>::type flags
|
||||
) const override {
|
||||
builder.openObject();
|
||||
Index::toVelocyPack(builder, flags);
|
||||
|
@ -1531,4 +1531,4 @@ bool TransactionStateMock::hasFailedOperations() const {
|
|||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- END-OF-FILE
|
||||
// -----------------------------------------------------------------------------
|
||||
// -----------------------------------------------------------------------------
|
||||
|
|
|
@ -71,7 +71,7 @@ function IResearchFeatureDDLTestSuite () {
|
|||
let properties = view.properties();
|
||||
assertTrue(Object === properties.links.constructor);
|
||||
assertEqual(1, Object.keys(properties.links).length);
|
||||
var indexes = db.TestCollection0.getIndexes();
|
||||
var indexes = db.TestCollection0.getIndexes(false, true);
|
||||
assertEqual(2, indexes.length);
|
||||
var link = indexes[1];
|
||||
assertEqual("primary", indexes[0].type);
|
||||
|
@ -79,7 +79,7 @@ function IResearchFeatureDDLTestSuite () {
|
|||
assertEqual("arangosearch", link.type);
|
||||
db._dropView("TestView");
|
||||
assertEqual(null, db._view("TestView"));
|
||||
assertEqual(1, db.TestCollection0.getIndexes().length);
|
||||
assertEqual(1, db.TestCollection0.getIndexes(false, true).length);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -97,7 +97,7 @@ function IResearchFeatureDDLTestSuite () {
|
|||
let properties = view.properties();
|
||||
assertTrue(Object === properties.links.constructor);
|
||||
assertEqual(1, Object.keys(properties.links).length);
|
||||
var indexes = db.TestCollection0.getIndexes();
|
||||
var indexes = db.TestCollection0.getIndexes(false, true);
|
||||
assertEqual(2, indexes.length);
|
||||
var link = indexes[1];
|
||||
assertEqual("primary", indexes[0].type);
|
||||
|
@ -107,7 +107,7 @@ function IResearchFeatureDDLTestSuite () {
|
|||
properties = view.properties();
|
||||
assertTrue(Object === properties.links.constructor);
|
||||
assertEqual(0, Object.keys(properties.links).length);
|
||||
assertEqual(1, db.TestCollection0.getIndexes().length);
|
||||
assertEqual(1, db.TestCollection0.getIndexes(false, true).length);
|
||||
}
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in New Issue