mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'devel' of github.com:arangodb/arangodb into devel
This commit is contained in:
commit
d1b4cfc9ef
|
@ -133,9 +133,13 @@ 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::makeFlags(Index::Serialize::Basics),
|
||||
[](arangodb::Index const* idx) {
|
||||
return (idx->type() == arangodb::Index::TRI_IDX_TYPE_PRIMARY_INDEX);
|
||||
col->getIndexesVPack(builder, [](arangodb::Index const* idx, uint8_t& flags) {
|
||||
if (idx->type() == arangodb::Index::TRI_IDX_TYPE_PRIMARY_INDEX) {
|
||||
flags = Index::makeFlags(Index::Serialize::Basics);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -1307,7 +1307,7 @@ Future<OperationResult> createDocumentOnCoordinator(transaction::Methods const&
|
|||
f = beginTransactionOnSomeLeaders(*trx.state(), coll, opCtx.shardMap);
|
||||
}
|
||||
|
||||
return std::move(f).thenValue([=, &trx, &coll, opCtx(std::move(opCtx))](Result r) -> Future<OperationResult> {
|
||||
return std::move(f).thenValue([=, &trx, &coll, opCtx(std::move(opCtx))](Result) -> Future<OperationResult> {
|
||||
std::string const& dbname = trx.vocbase().name();
|
||||
std::string const baseUrl =
|
||||
"/_db/" + StringUtils::urlEncode(dbname) + "/_api/document/";
|
||||
|
@ -2486,7 +2486,7 @@ std::vector<std::shared_ptr<LogicalCollection>> ClusterMethods::persistCollectio
|
|||
"planId", "version", "objectId"};
|
||||
col->setStatus(TRI_VOC_COL_STATUS_LOADED);
|
||||
VPackBuilder velocy =
|
||||
col->toVelocyPackIgnore(ignoreKeys, LogicalDataSource::makeFlags());
|
||||
col->toVelocyPackIgnore(ignoreKeys, LogicalDataSource::Serialization::List);
|
||||
|
||||
infos.emplace_back(ClusterCollectionCreationInfo{
|
||||
std::to_string(col->id()), col->numberOfShards(), col->replicationFactor(),
|
||||
|
|
|
@ -95,9 +95,7 @@ Result DBServerAgencySync::getLocalCollections(VPackBuilder& collections) {
|
|||
|
||||
// generate a collection definition identical to that which would be
|
||||
// persisted in the case of SingleServer
|
||||
collection->properties(collections,
|
||||
LogicalDataSource::makeFlags(LogicalDataSource::Serialize::Detailed,
|
||||
LogicalDataSource::Serialize::ForPersistence));
|
||||
collection->properties(collections, LogicalDataSource::Serialization::Persistence);
|
||||
|
||||
auto const& folls = collection->followers();
|
||||
std::string const theLeader = folls->getLeader();
|
||||
|
|
|
@ -681,7 +681,7 @@ static void JS_GetCollectionInfoClusterInfo(v8::FunctionCallbackInfo<v8::Value>
|
|||
"version",
|
||||
"objectId"};
|
||||
VPackBuilder infoBuilder =
|
||||
col->toVelocyPackIgnore(ignoreKeys, LogicalDataSource::makeFlags());
|
||||
col->toVelocyPackIgnore(ignoreKeys, LogicalDataSource::Serialization::List);
|
||||
VPackSlice info = infoBuilder.slice();
|
||||
|
||||
TRI_ASSERT(info.isObject());
|
||||
|
|
|
@ -436,7 +436,7 @@ arangodb::aql::AqlValue aqlFnTokens(arangodb::aql::ExpressionContext* expression
|
|||
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_BAD_PARAMETER, message);
|
||||
}
|
||||
|
||||
arangodb::iresearch::IResearchAnalyzerFeature::AnalyzerPool::ptr pool;
|
||||
arangodb::iresearch::AnalyzerPool::ptr pool;
|
||||
// identity now is default analyzer
|
||||
auto const name = args.size() > 1 ?
|
||||
arangodb::iresearch::getStringRef(args[1].slice()) :
|
||||
|
@ -622,11 +622,10 @@ void addFunctions(arangodb::aql::AqlFunctionFeature& functions) {
|
|||
/// @return pool will generate analyzers as per supplied parameters
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool equalAnalyzer(
|
||||
arangodb::iresearch::IResearchAnalyzerFeature::AnalyzerPool const& pool,
|
||||
arangodb::iresearch::AnalyzerPool const& pool,
|
||||
irs::string_ref const& type,
|
||||
VPackSlice const properties,
|
||||
irs::flags const& features
|
||||
) noexcept {
|
||||
irs::flags const& features) {
|
||||
std::string normalizedProperties;
|
||||
|
||||
if (!::normalize(normalizedProperties, type, properties)) {
|
||||
|
@ -910,13 +909,14 @@ typedef irs::async_utils::read_write_mutex::write_mutex WriteMutex;
|
|||
namespace arangodb {
|
||||
namespace iresearch {
|
||||
|
||||
void IResearchAnalyzerFeature::AnalyzerPool::toVelocyPack(VPackBuilder& builder,
|
||||
bool forPersistence /*= false*/) {
|
||||
VPackObjectBuilder rootScope(&builder);
|
||||
arangodb::iresearch::addStringRef(builder, StaticStrings::AnalyzerNameField,
|
||||
forPersistence ?
|
||||
splitAnalyzerName(name()).second :
|
||||
irs::string_ref(name()) );
|
||||
void AnalyzerPool::toVelocyPack(
|
||||
VPackBuilder& builder,
|
||||
irs::string_ref const& name) {
|
||||
TRI_ASSERT(builder.isOpenObject());
|
||||
// if (forPersistence) {
|
||||
// arangodb::iresearch::addStringRef(builder, arangodb::StaticStrings::KeyString, name);
|
||||
// }
|
||||
arangodb::iresearch::addStringRef(builder, StaticStrings::AnalyzerNameField, name);
|
||||
arangodb::iresearch::addStringRef(builder, StaticStrings::AnalyzerTypeField, type());
|
||||
builder.add(StaticStrings::AnalyzerPropertiesField, properties());
|
||||
|
||||
|
@ -928,8 +928,37 @@ void IResearchAnalyzerFeature::AnalyzerPool::toVelocyPack(VPackBuilder& builder,
|
|||
}
|
||||
}
|
||||
|
||||
/*static*/ IResearchAnalyzerFeature::AnalyzerPool::Builder::ptr
|
||||
IResearchAnalyzerFeature::AnalyzerPool::Builder::make(
|
||||
void AnalyzerPool::toVelocyPack(VPackBuilder& builder,
|
||||
TRI_vocbase_t const* vocbase /*= nullptr*/) {
|
||||
irs::string_ref name = this->name();
|
||||
if (vocbase) {
|
||||
auto const split = IResearchAnalyzerFeature::splitAnalyzerName(name);
|
||||
if (!split.first.null()) {
|
||||
if (split.first == vocbase->name()) {
|
||||
name = split.second;
|
||||
} else {
|
||||
name = irs::string_ref(split.second.c_str()-2, split.second.size()+2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
VPackObjectBuilder rootScope(&builder);
|
||||
toVelocyPack(builder, name);
|
||||
}
|
||||
|
||||
void AnalyzerPool::toVelocyPack(VPackBuilder& builder,
|
||||
bool forPersistence /*= false*/) {
|
||||
irs::string_ref name = this->name();
|
||||
if (forPersistence) {
|
||||
name = IResearchAnalyzerFeature::splitAnalyzerName(name).second;
|
||||
}
|
||||
|
||||
VPackObjectBuilder rootScope(&builder);
|
||||
toVelocyPack(builder, name);
|
||||
}
|
||||
|
||||
/*static*/ AnalyzerPool::Builder::ptr
|
||||
AnalyzerPool::Builder::make(
|
||||
irs::string_ref const& type,
|
||||
VPackSlice properties) {
|
||||
if (type.empty()) {
|
||||
|
@ -942,12 +971,12 @@ IResearchAnalyzerFeature::AnalyzerPool::Builder::make(
|
|||
type, irs::text_format::vpack, iresearch::ref<char>(properties), false);
|
||||
}
|
||||
|
||||
IResearchAnalyzerFeature::AnalyzerPool::AnalyzerPool(irs::string_ref const& name)
|
||||
AnalyzerPool::AnalyzerPool(irs::string_ref const& name)
|
||||
: _cache(DEFAULT_POOL_SIZE),
|
||||
_name(name) {
|
||||
}
|
||||
|
||||
bool IResearchAnalyzerFeature::AnalyzerPool::init(
|
||||
bool AnalyzerPool::init(
|
||||
irs::string_ref const& type,
|
||||
VPackSlice const properties,
|
||||
irs::flags const& features /*= irs::flags::empty_instance()*/) {
|
||||
|
@ -1017,7 +1046,7 @@ bool IResearchAnalyzerFeature::AnalyzerPool::init(
|
|||
return false;
|
||||
}
|
||||
|
||||
void IResearchAnalyzerFeature::AnalyzerPool::setKey(irs::string_ref const& key) {
|
||||
void AnalyzerPool::setKey(irs::string_ref const& key) {
|
||||
if (key.null()) {
|
||||
_key = irs::string_ref::NIL;
|
||||
|
||||
|
@ -1050,7 +1079,7 @@ void IResearchAnalyzerFeature::AnalyzerPool::setKey(irs::string_ref const& key)
|
|||
_key = irs::string_ref(_config.c_str() + keyOffset, key.size());
|
||||
}
|
||||
|
||||
irs::analysis::analyzer::ptr IResearchAnalyzerFeature::AnalyzerPool::get() const noexcept {
|
||||
irs::analysis::analyzer::ptr AnalyzerPool::get() const noexcept {
|
||||
try {
|
||||
// FIXME do not use shared_ptr
|
||||
return _cache.emplace(_type, _properties).release();
|
||||
|
@ -1254,13 +1283,12 @@ arangodb::Result IResearchAnalyzerFeature::emplaceAnalyzer( // emplace
|
|||
}
|
||||
|
||||
arangodb::Result IResearchAnalyzerFeature::ensure( // ensure analyzer existence if possible
|
||||
EmplaceResult& result, // emplacement result on success (out-param)
|
||||
irs::string_ref const& name, // analyzer name
|
||||
irs::string_ref const& type, // analyzer type
|
||||
VPackSlice const properties, // analyzer properties
|
||||
irs::flags const& features, // analyzer features
|
||||
bool isEmplace
|
||||
) {
|
||||
EmplaceResult& result, // emplacement result on success (out-param)
|
||||
irs::string_ref const& name, // analyzer name
|
||||
irs::string_ref const& type, // analyzer type
|
||||
VPackSlice const properties, // analyzer properties
|
||||
irs::flags const& features, // analyzer features
|
||||
bool isEmplace) {
|
||||
try {
|
||||
auto split = splitAnalyzerName(name);
|
||||
|
||||
|
@ -1289,19 +1317,15 @@ arangodb::Result IResearchAnalyzerFeature::ensure( // ensure analyzer existence
|
|||
}
|
||||
}
|
||||
|
||||
// validate and emplace an analyzer
|
||||
EmplaceAnalyzerResult itr;
|
||||
auto res = // validate and emplace an analyzer
|
||||
emplaceAnalyzer(itr, _analyzers, name, type, properties, features);
|
||||
auto res = emplaceAnalyzer(itr, _analyzers, name, type, properties, features);
|
||||
|
||||
if (!res.ok()) {
|
||||
return res;
|
||||
}
|
||||
|
||||
auto* engine = arangodb::EngineSelectorFeature::ENGINE;
|
||||
auto allowCreation = // should analyzer creation be allowed (always for cluster)
|
||||
isEmplace // if it's a user creation request
|
||||
|| arangodb::ServerState::instance()->isClusterRole() // always for cluster
|
||||
|| (engine && engine->inRecovery()); // always during recovery since analyzer collection might not be available yet
|
||||
bool erase = itr.second; // an insertion took place
|
||||
auto cleanup = irs::make_finally([&erase, this, &itr]()->void {
|
||||
if (erase) {
|
||||
|
@ -1312,14 +1336,6 @@ arangodb::Result IResearchAnalyzerFeature::ensure( // ensure analyzer existence
|
|||
|
||||
// new pool creation
|
||||
if (itr.second) {
|
||||
if (!allowCreation) {
|
||||
return arangodb::Result( // result
|
||||
TRI_ERROR_BAD_PARAMETER, // code
|
||||
"forbidden implicit creation of an arangosearch analyzer instance for name '" + std::string(name) +
|
||||
"' type '" + std::string(type) +
|
||||
"' properties '" + properties.toString() + "'");
|
||||
}
|
||||
|
||||
if (!pool) {
|
||||
return arangodb::Result(
|
||||
TRI_ERROR_INTERNAL,
|
||||
|
@ -1369,7 +1385,7 @@ arangodb::Result IResearchAnalyzerFeature::ensure( // ensure analyzer existence
|
|||
return arangodb::Result();
|
||||
}
|
||||
|
||||
IResearchAnalyzerFeature::AnalyzerPool::ptr IResearchAnalyzerFeature::get( // find analyzer
|
||||
AnalyzerPool::ptr IResearchAnalyzerFeature::get( // find analyzer
|
||||
irs::string_ref const& name, // analyzer name
|
||||
TRI_vocbase_t const& activeVocbase, // fallback vocbase if not part of name
|
||||
TRI_vocbase_t const& systemVocbase, // the system vocbase for use with empty prefix
|
||||
|
@ -1445,7 +1461,7 @@ IResearchAnalyzerFeature::AnalyzerPool::ptr IResearchAnalyzerFeature::get( // fi
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
IResearchAnalyzerFeature::AnalyzerPool::ptr IResearchAnalyzerFeature::get( // find analyzer
|
||||
AnalyzerPool::ptr IResearchAnalyzerFeature::get( // find analyzer
|
||||
irs::string_ref const& name, // analyzer name
|
||||
bool onlyCached /*= false*/ // check only locally cached analyzers
|
||||
) const noexcept {
|
||||
|
@ -1506,33 +1522,6 @@ IResearchAnalyzerFeature::AnalyzerPool::ptr IResearchAnalyzerFeature::get( // fi
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
IResearchAnalyzerFeature::AnalyzerPool::ptr IResearchAnalyzerFeature::get( // find analyzer
|
||||
irs::string_ref const& name, // analyzer name
|
||||
irs::string_ref const& type, // analyzer type
|
||||
VPackSlice const properties, // analyzer properties
|
||||
irs::flags const& features // analyzer features
|
||||
) {
|
||||
EmplaceResult result;
|
||||
auto res = ensure( // find and validate analyzer
|
||||
result, // result
|
||||
name, // analyzer name
|
||||
type, // analyzer type
|
||||
properties, // analyzer properties
|
||||
features, // analyzer features
|
||||
false
|
||||
);
|
||||
|
||||
if (!res.ok()) {
|
||||
LOG_TOPIC("ed6a3", WARN, arangodb::iresearch::TOPIC)
|
||||
<< "failure to get arangosearch analyzer name '" << name << "': " << res.errorNumber() << " " << res.errorMessage();
|
||||
TRI_set_errno(TRI_ERROR_INTERNAL);
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return result.first;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief return a container of statically defined/initialized analyzers
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -1568,7 +1557,7 @@ IResearchAnalyzerFeature::AnalyzerPool::ptr IResearchAnalyzerFeature::get( // fi
|
|||
// register the text analyzers
|
||||
{
|
||||
// Note: ArangoDB strings coming from JavaScript user input are UTF-8 encoded
|
||||
std::vector<irs::string_ref> const locales = {
|
||||
irs::string_ref const locales[] = {
|
||||
"de", "en", "es", "fi", "fr", "it",
|
||||
"nl", "no", "pt", "ru", "sv", "zh"
|
||||
};
|
||||
|
@ -1623,7 +1612,7 @@ IResearchAnalyzerFeature::AnalyzerPool::ptr IResearchAnalyzerFeature::get( // fi
|
|||
return instance.analyzers;
|
||||
}
|
||||
|
||||
/*static*/ IResearchAnalyzerFeature::AnalyzerPool::ptr IResearchAnalyzerFeature::identity() noexcept {
|
||||
/*static*/ AnalyzerPool::ptr IResearchAnalyzerFeature::identity() noexcept {
|
||||
struct Identity {
|
||||
AnalyzerPool::ptr instance;
|
||||
Identity() {
|
||||
|
|
|
@ -72,6 +72,52 @@ class ApplicationServer;
|
|||
namespace arangodb {
|
||||
namespace iresearch {
|
||||
|
||||
// thread-safe analyzer pool
|
||||
class AnalyzerPool : private irs::util::noncopyable {
|
||||
public:
|
||||
typedef std::shared_ptr<AnalyzerPool> ptr;
|
||||
explicit AnalyzerPool(irs::string_ref const& name);
|
||||
irs::flags const& features() const noexcept { return _features; }
|
||||
irs::analysis::analyzer::ptr get() const noexcept; // nullptr == error creating analyzer
|
||||
std::string const& name() const noexcept { return _name; }
|
||||
VPackSlice properties() const noexcept { return _properties; }
|
||||
irs::string_ref const& type() const noexcept { return _type; }
|
||||
|
||||
// definition to be stored in _analyzers collection or shown to the end user
|
||||
void toVelocyPack(arangodb::velocypack::Builder& builder,
|
||||
bool forPersistence = false);
|
||||
|
||||
// definition to be stored/shown in a link definition
|
||||
void toVelocyPack(arangodb::velocypack::Builder& builder,
|
||||
TRI_vocbase_t const* vocbase = nullptr);
|
||||
|
||||
private:
|
||||
friend class IResearchAnalyzerFeature; // required for calling AnalyzerPool::init(...) and AnalyzerPool::setKey(...)
|
||||
|
||||
// 'make(...)' method wrapper for irs::analysis::analyzer types
|
||||
struct Builder {
|
||||
typedef irs::analysis::analyzer::ptr ptr;
|
||||
DECLARE_FACTORY(irs::string_ref const& type, VPackSlice properties);
|
||||
};
|
||||
|
||||
void toVelocyPack(arangodb::velocypack::Builder& builder,
|
||||
irs::string_ref const& name);
|
||||
|
||||
bool init(irs::string_ref const& type,
|
||||
VPackSlice const properties,
|
||||
irs::flags const& features = irs::flags::empty_instance());
|
||||
void setKey(irs::string_ref const& type);
|
||||
|
||||
mutable irs::unbounded_object_pool<Builder> _cache; // cache of irs::analysis::analyzer (constructed via
|
||||
// AnalyzerBuilder::make(...))
|
||||
std::string _config; // non-null type + non-null properties + key
|
||||
irs::flags _features; // cached analyzer features
|
||||
irs::string_ref _key; // the key of the persisted configuration for this pool, null == static analyzer
|
||||
std::string _name; // ArangoDB alias for an IResearch analyzer configuration
|
||||
VPackSlice _properties; // IResearch analyzer configuration
|
||||
irs::string_ref _type; // IResearch analyzer name
|
||||
}; // AnalyzerPool
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief a cache of IResearch analyzer instances
|
||||
/// and a provider of AQL TOKENS(<data>, <analyzer>) function
|
||||
|
@ -81,43 +127,6 @@ namespace iresearch {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
class IResearchAnalyzerFeature final : public arangodb::application_features::ApplicationFeature {
|
||||
public:
|
||||
// thread-safe analyzer pool
|
||||
class AnalyzerPool : private irs::util::noncopyable {
|
||||
public:
|
||||
typedef std::shared_ptr<AnalyzerPool> ptr;
|
||||
explicit AnalyzerPool(irs::string_ref const& name);
|
||||
irs::flags const& features() const noexcept { return _features; }
|
||||
irs::analysis::analyzer::ptr get() const noexcept; // nullptr == error creating analyzer
|
||||
std::string const& name() const noexcept { return _name; }
|
||||
VPackSlice properties() const noexcept { return _properties; }
|
||||
irs::string_ref const& type() const noexcept { return _type; }
|
||||
|
||||
void toVelocyPack(arangodb::velocypack::Builder& builder, bool forPersistence = false);
|
||||
|
||||
private:
|
||||
friend class IResearchAnalyzerFeature; // required for calling AnalyzerPool::init(...) and AnalyzerPool::setKey(...)
|
||||
|
||||
// 'make(...)' method wrapper for irs::analysis::analyzer types
|
||||
struct Builder {
|
||||
typedef irs::analysis::analyzer::ptr ptr;
|
||||
DECLARE_FACTORY(irs::string_ref const& type, VPackSlice properties);
|
||||
};
|
||||
|
||||
mutable irs::unbounded_object_pool<Builder> _cache; // cache of irs::analysis::analyzer (constructed via
|
||||
// AnalyzerBuilder::make(...))
|
||||
std::string _config; // non-null type + non-null properties + key
|
||||
irs::flags _features; // cached analyzer features
|
||||
irs::string_ref _key; // the key of the persisted configuration for this pool, null == static analyzer
|
||||
std::string _name; // ArangoDB alias for an IResearch analyzer configuration
|
||||
VPackSlice _properties; // IResearch analyzer configuration
|
||||
irs::string_ref _type; // IResearch analyzer name
|
||||
|
||||
bool init(irs::string_ref const& type,
|
||||
VPackSlice const properties,
|
||||
irs::flags const& features = irs::flags::empty_instance());
|
||||
void setKey(irs::string_ref const& type);
|
||||
};
|
||||
|
||||
explicit IResearchAnalyzerFeature(arangodb::application_features::ApplicationServer& server);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -158,11 +167,33 @@ class IResearchAnalyzerFeature final : public arangodb::application_features::Ap
|
|||
EmplaceResult& result,
|
||||
irs::string_ref const& name,
|
||||
irs::string_ref const& type,
|
||||
VPackSlice properties,
|
||||
VPackSlice const properties,
|
||||
irs::flags const& features = irs::flags::empty_instance()) {
|
||||
return ensure(result, name, type, properties, features, true);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief find analyzer
|
||||
/// @param result the result of the successful emplacement (out-param)
|
||||
/// first - the emplaced pool
|
||||
/// second - if an insertion of an new analyzer occured
|
||||
/// @param name analyzer name (already normalized)
|
||||
/// @param type the underlying IResearch analyzer type
|
||||
/// @param properties the configuration for the underlying IResearch type
|
||||
/// @param features the expected features the analyzer should produce
|
||||
/// @return analyzer matching the specified parameters or nullptr
|
||||
/// @note will construct and cache the analyzer if missing only on db-server
|
||||
/// persistence in the cases of inRecovery or !storage engine will fail
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
arangodb::Result get(
|
||||
EmplaceResult& result,
|
||||
irs::string_ref const& name,
|
||||
irs::string_ref const& type,
|
||||
VPackSlice const properties,
|
||||
irs::flags const& features) {
|
||||
return ensure(result, name, type, properties, features, false);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief find analyzer
|
||||
/// @param name analyzer name (already normalized)
|
||||
|
@ -184,23 +215,6 @@ class IResearchAnalyzerFeature final : public arangodb::application_features::Ap
|
|||
bool onlyCached = false // check only locally cached analyzers
|
||||
) const noexcept;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief find analyzer
|
||||
/// @param name analyzer name (already normalized)
|
||||
/// @param type the underlying IResearch analyzer type
|
||||
/// @param properties the configuration for the underlying IResearch type
|
||||
/// @param features the expected features the analyzer should produce
|
||||
/// @return analyzer matching the specified parameters or nullptr
|
||||
/// @note will construct and cache the analyzer if missing only on db-server
|
||||
/// persistence in the cases of inRecovery or !storage engine will fail
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
AnalyzerPool::ptr get( // find analyzer
|
||||
irs::string_ref const& name, // analyzer name
|
||||
irs::string_ref const& type, // analyzer type
|
||||
VPackSlice const properties, // analyzer properties
|
||||
irs::flags const& features // analyzer features
|
||||
);
|
||||
|
||||
static AnalyzerPool::ptr identity() noexcept; // the identity analyzer
|
||||
static std::string const& name() noexcept;
|
||||
|
||||
|
|
|
@ -264,10 +264,7 @@ bool upgradeSingleServerArangoSearchView0_1(
|
|||
arangodb::Result res;
|
||||
|
||||
builder.openObject();
|
||||
res = view->properties(builder,
|
||||
arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed,
|
||||
arangodb::LogicalDataSource::Serialize::ForPersistence)); // get JSON with meta + 'version'
|
||||
res = view->properties(builder, arangodb::LogicalDataSource::Serialization::Persistence); // get JSON with meta + 'version'
|
||||
builder.close();
|
||||
|
||||
if (!res.ok()) {
|
||||
|
@ -297,8 +294,7 @@ bool upgradeSingleServerArangoSearchView0_1(
|
|||
|
||||
builder.clear();
|
||||
builder.openObject();
|
||||
res = view->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed)); // get JSON with end-user definition
|
||||
res = view->properties(builder, arangodb::LogicalDataSource::Serialization::Properties); // get JSON with end-user definition
|
||||
builder.close();
|
||||
|
||||
if (!res.ok()) {
|
||||
|
|
|
@ -225,6 +225,9 @@ arangodb::Result modifyLinks( // modify links
|
|||
arangodb::velocypack::Slice const& links, // modified link definitions
|
||||
std::unordered_set<TRI_voc_cid_t> const& stale = {} // stale links
|
||||
) {
|
||||
LOG_TOPIC("4bdd2", DEBUG, arangodb::iresearch::TOPIC)
|
||||
<< "link modification request for view '" << view.name() << "', original definition:" << links.toString();
|
||||
|
||||
if (!links.isObject()) {
|
||||
return arangodb::Result( // result
|
||||
TRI_ERROR_BAD_PARAMETER, // code
|
||||
|
@ -288,6 +291,9 @@ arangodb::Result modifyLinks( // modify links
|
|||
normalized.close();
|
||||
link = normalized.slice(); // use normalized definition for index creation
|
||||
|
||||
LOG_TOPIC("4bdd1", DEBUG, arangodb::iresearch::TOPIC)
|
||||
<< "link modification request for view '" << view.name() << "', normalized definition:" << link.toString();
|
||||
|
||||
static const std::function<bool(irs::string_ref const& key)> acceptor = [](
|
||||
irs::string_ref const& key // json key
|
||||
)->bool {
|
||||
|
@ -319,7 +325,7 @@ arangodb::Result modifyLinks( // modify links
|
|||
std::string error;
|
||||
arangodb::iresearch::IResearchLinkMeta linkMeta;
|
||||
|
||||
if (!linkMeta.init(namedJson.slice(), true, error)) { // validated and normalized with 'isCreation=true' above via normalize(...)
|
||||
if (!linkMeta.init(namedJson.slice(), true, error, &view.vocbase())) { // validated and normalized with 'isCreation=true' above via normalize(...)
|
||||
return arangodb::Result(
|
||||
TRI_ERROR_BAD_PARAMETER,
|
||||
std::string("error parsing link parameters from json for arangosearch view '") + view.name() + "' collection '" + collectionName + "' error '" + error + "'"
|
||||
|
|
|
@ -208,7 +208,7 @@ bool IResearchLinkMeta::init( // initialize meta
|
|||
auto value = *itr;
|
||||
|
||||
if (!value.isObject()) {
|
||||
errorField = fieldName + "=>[" + std::to_string(itr.index()) + "]";
|
||||
errorField = fieldName + "[" + std::to_string(itr.index()) + "]";
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -221,7 +221,7 @@ bool IResearchLinkMeta::init( // initialize meta
|
|||
|
||||
if (!value.hasKey(subFieldName) // missing required filed
|
||||
|| !value.get(subFieldName).isString()) {
|
||||
errorField = fieldName + "=>[" + std::to_string(itr.index()) + "]=>" + subFieldName;
|
||||
errorField = fieldName + "[" + std::to_string(itr.index()) + "]." + subFieldName;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -234,7 +234,7 @@ bool IResearchLinkMeta::init( // initialize meta
|
|||
: nullptr;
|
||||
if (sysVocbase) {
|
||||
name = IResearchAnalyzerFeature::normalize( // normalize
|
||||
name, *defaultVocbase, *sysVocbase // args
|
||||
name, *defaultVocbase, *sysVocbase, true// args
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -248,7 +248,7 @@ bool IResearchLinkMeta::init( // initialize meta
|
|||
|
||||
if (!value.hasKey(subFieldName) // missing required filed
|
||||
|| !value.get(subFieldName).isString()) {
|
||||
errorField = fieldName + "=>[" + std::to_string(itr.index()) + "]=>" + subFieldName;
|
||||
errorField = fieldName + "[" + std::to_string(itr.index()) + "]." + subFieldName;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -266,7 +266,7 @@ bool IResearchLinkMeta::init( // initialize meta
|
|||
auto subField = value.get(subFieldName);
|
||||
|
||||
if (!subField.isObject() && !subField.isNull()) {
|
||||
errorField = fieldName + "=>[" + std::to_string(itr.index()) + "]=>" + subFieldName;
|
||||
errorField = fieldName + "[" + std::to_string(itr.index()) + "]." + subFieldName;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -285,7 +285,7 @@ bool IResearchLinkMeta::init( // initialize meta
|
|||
auto subField = value.get(subFieldName);
|
||||
|
||||
if (!subField.isArray()) {
|
||||
errorField = fieldName + "=>[" + std::to_string(itr.index()) + "]=>" + subFieldName;
|
||||
errorField = fieldName + "[" + std::to_string(itr.index()) + "]." + subFieldName;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -296,7 +296,7 @@ bool IResearchLinkMeta::init( // initialize meta
|
|||
auto subValue = *subItr;
|
||||
|
||||
if (!subValue.isString() && !subValue.isNull()) {
|
||||
errorField = fieldName + "=>[" + std::to_string(itr.index()) + "]=>" + subFieldName + "=>[" + std::to_string(subItr.index()) + + "]";
|
||||
errorField = fieldName + "[" + std::to_string(itr.index()) + "]." + subFieldName + "[" + std::to_string(subItr.index()) + + "]";
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -305,7 +305,7 @@ bool IResearchLinkMeta::init( // initialize meta
|
|||
auto* feature = irs::attribute::type_id::get(featureName, false);
|
||||
|
||||
if (!feature) {
|
||||
errorField = fieldName + "=>[" + std::to_string(itr.index()) + "]=>" + subFieldName + "=>" + std::string(featureName);
|
||||
errorField = fieldName + "[" + std::to_string(itr.index()) + "]." + subFieldName + "." + std::string(featureName);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -314,10 +314,13 @@ bool IResearchLinkMeta::init( // initialize meta
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// get analyzer potentially creating it (e.g. on cluster)
|
||||
// @note do not use emplace(...) since it'll trigger loadAnalyzers(...)
|
||||
if (!analyzers.get(name, type, properties, features)) {
|
||||
errorField = fieldName + "=>[" + std::to_string(itr.index()) + "]";
|
||||
arangodb::iresearch::IResearchAnalyzerFeature::EmplaceResult emplaceResult;
|
||||
auto const res = analyzers.get(emplaceResult, name, type, properties, features);
|
||||
if (res.fail()) {
|
||||
errorField = fieldName + "[" + std::to_string(itr.index()) + "]";
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -350,7 +353,7 @@ bool IResearchLinkMeta::init( // initialize meta
|
|||
auto value = *itr;
|
||||
|
||||
if (!value.isString()) {
|
||||
errorField = fieldName + "=>[" + std::to_string(itr.index()) + "]";
|
||||
errorField = fieldName + "[" + std::to_string(itr.index()) + "]";
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -360,27 +363,23 @@ bool IResearchLinkMeta::init( // initialize meta
|
|||
|
||||
if (defaultVocbase) {
|
||||
auto sysVocbase = server.hasFeature<SystemDatabaseFeature>()
|
||||
? server.getFeature<SystemDatabaseFeature>().use()
|
||||
: nullptr;
|
||||
? server.getFeature<SystemDatabaseFeature>().use()
|
||||
: nullptr;
|
||||
|
||||
if (sysVocbase) {
|
||||
name = IResearchAnalyzerFeature::normalize( // normalize
|
||||
name, *defaultVocbase, *sysVocbase // args
|
||||
);
|
||||
shortName = IResearchAnalyzerFeature::normalize( // normalize
|
||||
name, *defaultVocbase, *sysVocbase, false // args
|
||||
);
|
||||
name = IResearchAnalyzerFeature::normalize(
|
||||
name, *defaultVocbase, *sysVocbase);
|
||||
shortName = IResearchAnalyzerFeature::normalize(
|
||||
name, *defaultVocbase, *sysVocbase, false);
|
||||
}
|
||||
}
|
||||
|
||||
// for cluster only check cache to avoid ClusterInfo locking issues
|
||||
// analyzer should have been populated via 'analyzerDefinitions' above
|
||||
auto analyzer = analyzers.get( // get analyzer
|
||||
name, arangodb::ServerState::instance()->isClusterRole() // args
|
||||
);
|
||||
auto analyzer = analyzers.get(name, arangodb::ServerState::instance()->isClusterRole());
|
||||
|
||||
if (!analyzer) {
|
||||
errorField = fieldName + "=>" + value.copyString(); // original (non-normalized) 'name' value
|
||||
errorField = fieldName + "." + value.copyString(); // original (non-normalized) 'name' value
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -456,7 +455,7 @@ bool IResearchLinkMeta::init( // initialize meta
|
|||
auto itr = policies.find(name);
|
||||
|
||||
if (itr == policies.end()) {
|
||||
errorField = fieldName + "=>" + name;
|
||||
errorField = fieldName + "." + name;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -496,7 +495,7 @@ bool IResearchLinkMeta::init( // initialize meta
|
|||
auto value = itr.value();
|
||||
|
||||
if (!key.isString()) {
|
||||
errorField = fieldName + "=>[" +
|
||||
errorField = fieldName + "[" +
|
||||
arangodb::basics::StringUtils::itoa(itr.index()) + "]";
|
||||
|
||||
return false;
|
||||
|
@ -505,7 +504,7 @@ bool IResearchLinkMeta::init( // initialize meta
|
|||
auto name = key.copyString();
|
||||
|
||||
if (!value.isObject()) {
|
||||
errorField = fieldName + "=>" + name;
|
||||
errorField = fieldName + "." + name;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -514,7 +513,7 @@ bool IResearchLinkMeta::init( // initialize meta
|
|||
|
||||
// false == do not read 'analyzerDefinitions' from child elements
|
||||
if (!_fields[name]->init(value, false, childErrorField, defaultVocbase, subDefaults)) {
|
||||
errorField = fieldName + "=>" + name + "=>" + childErrorField;
|
||||
errorField = fieldName + "." + name + "." + childErrorField;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -531,7 +530,7 @@ bool IResearchLinkMeta::json( // append meta jSON
|
|||
IResearchLinkMeta const* ignoreEqual /*= nullptr*/, // values to ignore if equal
|
||||
TRI_vocbase_t const* defaultVocbase /*= nullptr*/, // fallback vocbase
|
||||
Mask const* mask /*= nullptr*/, // values to ignore always
|
||||
std::map<std::string, IResearchAnalyzerFeature::AnalyzerPool::ptr>* usedAnalyzers /*= nullptr*/ // append analyzers used in definition
|
||||
std::map<std::string, AnalyzerPool::ptr>* usedAnalyzers /*= nullptr*/ // append analyzers used in definition
|
||||
) const {
|
||||
if (!builder.isOpenObject()) {
|
||||
return false;
|
||||
|
@ -546,7 +545,7 @@ bool IResearchLinkMeta::json( // append meta jSON
|
|||
}
|
||||
}
|
||||
|
||||
std::map<std::string, IResearchAnalyzerFeature::AnalyzerPool::ptr> analyzers;
|
||||
std::map<std::string, AnalyzerPool::ptr> analyzers;
|
||||
|
||||
if ((!ignoreEqual || !equalAnalyzers(_analyzers, ignoreEqual->_analyzers)) &&
|
||||
(!mask || mask->_analyzers)) {
|
||||
|
@ -586,7 +585,7 @@ bool IResearchLinkMeta::json( // append meta jSON
|
|||
entry._pool->name(), // analyzer name
|
||||
*defaultVocbase, // active vocbase
|
||||
*sysVocbase, // system vocbase
|
||||
writeAnalyzerDefinition // expand vocbase prefix
|
||||
false // expand vocbase prefix
|
||||
);
|
||||
} else {
|
||||
name = entry._pool->name(); // verbatim (assume already normalized)
|
||||
|
@ -665,7 +664,7 @@ bool IResearchLinkMeta::json( // append meta jSON
|
|||
|
||||
for (auto& entry: analyzers) {
|
||||
TRI_ASSERT(entry.second); // ensured by emplace into 'analyzers' above
|
||||
entry.second->toVelocyPack(builder);
|
||||
entry.second->toVelocyPack(builder, defaultVocbase);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -67,11 +67,11 @@ enum class ValueStorage : uint32_t {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
struct IResearchLinkMeta {
|
||||
struct Analyzer {
|
||||
IResearchAnalyzerFeature::AnalyzerPool::ptr _pool;
|
||||
AnalyzerPool::ptr _pool;
|
||||
std::string _shortName; // vocbase-dependent short analyzer name
|
||||
Analyzer(); // identity analyzer
|
||||
Analyzer( // constructor
|
||||
IResearchAnalyzerFeature::AnalyzerPool::ptr const& pool, // pool
|
||||
AnalyzerPool::ptr const& pool, // pool
|
||||
std::string&& shortName // short name (cached for use during insert(...))
|
||||
) noexcept: _pool(pool), _shortName(std::move(shortName)) {}
|
||||
operator bool() const noexcept { return false == !_pool; }
|
||||
|
@ -155,7 +155,7 @@ struct IResearchLinkMeta {
|
|||
IResearchLinkMeta const* ignoreEqual = nullptr, // values to ignore if equal
|
||||
TRI_vocbase_t const* defaultVocbase = nullptr, // fallback vocbase
|
||||
Mask const* mask = nullptr, // values to ignore always
|
||||
std::map<std::string, IResearchAnalyzerFeature::AnalyzerPool::ptr>* usedAnalyzers = nullptr // append analyzers used in definition
|
||||
std::map<std::string, AnalyzerPool::ptr>* usedAnalyzers = nullptr // append analyzers used in definition
|
||||
) const;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -347,20 +347,31 @@ IResearchView::~IResearchView() {
|
|||
|
||||
arangodb::Result IResearchView::appendVelocyPackImpl( // append JSON
|
||||
arangodb::velocypack::Builder& builder, // destrination
|
||||
std::underlying_type<Serialize>::type flags) const {
|
||||
if (hasFlag(flags, Serialize::ForPersistence) &&
|
||||
arangodb::ServerState::instance()->isSingleServer()) {
|
||||
auto res = arangodb::LogicalViewHelperStorageEngine::properties( // storage engine properties
|
||||
builder, *this // args
|
||||
);
|
||||
|
||||
if (!res.ok()) {
|
||||
return res;
|
||||
}
|
||||
Serialization context) const {
|
||||
if (Serialization::List == context) {
|
||||
// nothing more to output
|
||||
return {};
|
||||
}
|
||||
|
||||
if (!hasFlag(flags, Serialize::Detailed)) {
|
||||
return arangodb::Result(); // nothing more to output
|
||||
static const std::function<bool(irs::string_ref const& key)> propertiesAcceptor =
|
||||
[](irs::string_ref const& key) -> bool {
|
||||
return key != StaticStrings::VersionField; // ignored fields
|
||||
};
|
||||
static const std::function<bool(irs::string_ref const& key)> persistenceAcceptor =
|
||||
[](irs::string_ref const&) -> bool { return true; };
|
||||
|
||||
auto& acceptor = context == Serialization::Persistence || context == Serialization::Inventory
|
||||
? persistenceAcceptor
|
||||
: propertiesAcceptor;
|
||||
|
||||
if (context == Serialization::Persistence) {
|
||||
if (arangodb::ServerState::instance()->isSingleServer()) {
|
||||
auto res = arangodb::LogicalViewHelperStorageEngine::properties(builder, *this);
|
||||
|
||||
if (!res.ok()) {
|
||||
return res;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!builder.isOpenObject()) {
|
||||
|
@ -370,13 +381,6 @@ arangodb::Result IResearchView::appendVelocyPackImpl( // append JSON
|
|||
std::vector<std::string> collections;
|
||||
|
||||
{
|
||||
static const std::function<bool(irs::string_ref const& key)> acceptor =
|
||||
[](irs::string_ref const& key) -> bool {
|
||||
return key != StaticStrings::VersionField; // ignored fields
|
||||
};
|
||||
static const std::function<bool(irs::string_ref const& key)> persistenceAcceptor =
|
||||
[](irs::string_ref const&) -> bool { return true; };
|
||||
|
||||
ReadMutex mutex(_mutex); // '_meta'/'_links' can be asynchronously modified
|
||||
SCOPED_LOCK(mutex);
|
||||
arangodb::velocypack::Builder sanitizedBuilder;
|
||||
|
@ -384,9 +388,7 @@ arangodb::Result IResearchView::appendVelocyPackImpl( // append JSON
|
|||
sanitizedBuilder.openObject();
|
||||
|
||||
if (!_meta.json(sanitizedBuilder) ||
|
||||
!mergeSliceSkipKeys(builder, sanitizedBuilder.close().slice(),
|
||||
hasFlag(flags, Serialize::ForPersistence) ? persistenceAcceptor
|
||||
: acceptor)) {
|
||||
!mergeSliceSkipKeys(builder, sanitizedBuilder.close().slice(), acceptor)) {
|
||||
return arangodb::Result(
|
||||
TRI_ERROR_INTERNAL,
|
||||
std::string("failure to generate definition while generating "
|
||||
|
@ -394,7 +396,12 @@ arangodb::Result IResearchView::appendVelocyPackImpl( // append JSON
|
|||
vocbase().name() + "'");
|
||||
}
|
||||
|
||||
if (hasFlag(flags, Serialize::ForPersistence)) {
|
||||
if (context == Serialization::Inventory) {
|
||||
// nothing more to output
|
||||
return {};
|
||||
}
|
||||
|
||||
if (context == Serialization::Persistence) {
|
||||
IResearchViewMetaState metaState;
|
||||
|
||||
for (auto& entry : _links) {
|
||||
|
@ -403,8 +410,8 @@ arangodb::Result IResearchView::appendVelocyPackImpl( // append JSON
|
|||
|
||||
metaState.json(builder);
|
||||
|
||||
return arangodb::Result(); // nothing more to output (persistent
|
||||
// configuration does not need links)
|
||||
// nothing more to output (persistent configuration does not need links)
|
||||
return {};
|
||||
}
|
||||
|
||||
// add CIDs of known collections to list
|
||||
|
|
|
@ -189,9 +189,9 @@ class IResearchView final: public arangodb::LogicalView {
|
|||
/// @brief fill and return a JSON description of a IResearchView object
|
||||
/// only fields describing the view itself, not 'link' descriptions
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
virtual arangodb::Result appendVelocyPackImpl( // append definition
|
||||
arangodb::velocypack::Builder& builder, // definition destination
|
||||
std::underlying_type<Serialize>::type flags) const override;
|
||||
virtual arangodb::Result appendVelocyPackImpl(
|
||||
arangodb::velocypack::Builder& builder,
|
||||
Serialization context) const override;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief drop this IResearch View
|
||||
|
|
|
@ -173,51 +173,32 @@ IResearchViewCoordinator::~IResearchViewCoordinator() {
|
|||
}
|
||||
|
||||
arangodb::Result IResearchViewCoordinator::appendVelocyPackImpl(
|
||||
arangodb::velocypack::Builder& builder, std::underlying_type<Serialize>::type flags) const {
|
||||
if (hasFlag(flags, Serialize::ForPersistence)) {
|
||||
arangodb::velocypack::Builder& builder, Serialization context) const {
|
||||
if (Serialization::List == context) {
|
||||
// nothing more to output
|
||||
return {};
|
||||
}
|
||||
|
||||
static const std::function<bool(irs::string_ref const& key)> propertiesAcceptor =
|
||||
[](irs::string_ref const& key) -> bool {
|
||||
return key != StaticStrings::VersionField; // ignored fields
|
||||
};
|
||||
static const std::function<bool(irs::string_ref const& key)> persistenceAcceptor =
|
||||
[](irs::string_ref const&) -> bool { return true; };
|
||||
|
||||
auto* acceptor = &propertiesAcceptor;
|
||||
|
||||
if (context == Serialization::Persistence || context == Serialization::Inventory) {
|
||||
auto res = arangodb::LogicalViewHelperClusterInfo::properties(builder, *this);
|
||||
|
||||
if (!res.ok()) {
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
if (!hasFlag(flags, Serialize::Detailed)) {
|
||||
return arangodb::Result(); // nothing more to output
|
||||
}
|
||||
|
||||
if (!builder.isOpenObject()) {
|
||||
return arangodb::Result(TRI_ERROR_BAD_PARAMETER,
|
||||
std::string("invalid builder provided for "
|
||||
"IResearchViewCoordinator definition"));
|
||||
}
|
||||
|
||||
static const std::function<bool(irs::string_ref const& key)> acceptor =
|
||||
[](irs::string_ref const& key) -> bool {
|
||||
return key != StaticStrings::VersionField; // ignored fields
|
||||
};
|
||||
static const std::function<bool(irs::string_ref const& key)> persistenceAcceptor =
|
||||
[](irs::string_ref const&) -> bool { return true; };
|
||||
arangodb::velocypack::Builder sanitizedBuilder;
|
||||
|
||||
sanitizedBuilder.openObject();
|
||||
|
||||
if (!_meta.json(sanitizedBuilder) ||
|
||||
!mergeSliceSkipKeys(builder, sanitizedBuilder.close().slice(),
|
||||
hasFlag(flags, Serialize::ForPersistence) ? persistenceAcceptor
|
||||
: acceptor)) {
|
||||
return arangodb::Result(
|
||||
TRI_ERROR_INTERNAL,
|
||||
std::string("failure to generate definition while generating "
|
||||
"properties jSON for IResearch View in database '") +
|
||||
vocbase().name() + "'");
|
||||
}
|
||||
|
||||
arangodb::velocypack::Builder links;
|
||||
|
||||
// links are not persisted, their definitions are part of the corresponding
|
||||
// collections
|
||||
if (!hasFlag(flags, Serialize::ForPersistence)) {
|
||||
acceptor = &persistenceAcceptor;
|
||||
// links are not persisted, their definitions are part of the corresponding
|
||||
// collections
|
||||
} else if (context == Serialization::Properties) {
|
||||
// verify that the current user has access on all linked collections
|
||||
ExecContext const& exec = ExecContext::current();
|
||||
if (!exec.isSuperuser()) {
|
||||
|
@ -231,6 +212,7 @@ arangodb::Result IResearchViewCoordinator::appendVelocyPackImpl(
|
|||
ReadMutex mutex(_mutex);
|
||||
SCOPED_LOCK(mutex); // '_collections' can be asynchronously modified
|
||||
|
||||
VPackBuilder links;
|
||||
links.openObject();
|
||||
|
||||
for (auto& entry : _collections) {
|
||||
|
@ -241,7 +223,25 @@ arangodb::Result IResearchViewCoordinator::appendVelocyPackImpl(
|
|||
builder.add(StaticStrings::LinksField, links.slice());
|
||||
}
|
||||
|
||||
return arangodb::Result();
|
||||
if (!builder.isOpenObject()) {
|
||||
return { TRI_ERROR_BAD_PARAMETER,
|
||||
"invalid builder provided for "
|
||||
"IResearchViewCoordinator definition" };
|
||||
}
|
||||
|
||||
VPackBuilder sanitizedBuilder;
|
||||
sanitizedBuilder.openObject();
|
||||
|
||||
if (!_meta.json(sanitizedBuilder) ||
|
||||
!mergeSliceSkipKeys(builder, sanitizedBuilder.close().slice(), *acceptor)) {
|
||||
return { TRI_ERROR_INTERNAL,
|
||||
std::string("failure to generate definition while generating "
|
||||
"properties jSON for IResearch View in database '")
|
||||
.append(vocbase().name())
|
||||
.append("'") };
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
/*static*/ arangodb::ViewFactory const& IResearchViewCoordinator::factory() {
|
||||
|
|
|
@ -90,7 +90,7 @@ class IResearchViewCoordinator final : public arangodb::LogicalView {
|
|||
|
||||
protected:
|
||||
virtual Result appendVelocyPackImpl(arangodb::velocypack::Builder& builder,
|
||||
std::underlying_type<Serialize>::type flags) const override;
|
||||
Serialization context) const override;
|
||||
|
||||
virtual arangodb::Result dropImpl() override;
|
||||
|
||||
|
|
|
@ -446,7 +446,7 @@ bool IResearchViewMeta::init(arangodb::velocypack::Slice const& slice, std::stri
|
|||
static const std::string typeFieldName("type");
|
||||
|
||||
if (!field.hasKey(typeFieldName)) {
|
||||
errorField = fieldName + "=>" + typeFieldName;
|
||||
errorField = fieldName + "." + typeFieldName;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -454,7 +454,7 @@ bool IResearchViewMeta::init(arangodb::velocypack::Slice const& slice, std::stri
|
|||
auto typeField = field.get(typeFieldName);
|
||||
|
||||
if (!typeField.isString()) {
|
||||
errorField = fieldName + "=>" + typeFieldName;
|
||||
errorField = fieldName + "." + typeFieldName;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -468,7 +468,7 @@ bool IResearchViewMeta::init(arangodb::velocypack::Slice const& slice, std::stri
|
|||
_consolidationPolicy =
|
||||
createConsolidationPolicy<irs::index_utils::consolidate_tier>(field, errorSubField);
|
||||
} else {
|
||||
errorField = fieldName + "=>" + typeFieldName;
|
||||
errorField = fieldName + "." + typeFieldName;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -477,7 +477,7 @@ bool IResearchViewMeta::init(arangodb::velocypack::Slice const& slice, std::stri
|
|||
if (errorSubField.empty()) {
|
||||
errorField = fieldName;
|
||||
} else {
|
||||
errorField = fieldName + "=>" + errorSubField;
|
||||
errorField = fieldName + "." + errorSubField;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -588,7 +588,7 @@ bool IResearchViewMeta::init(arangodb::velocypack::Slice const& slice, std::stri
|
|||
} else if (!_primarySort.fromVelocyPack(field, errorSubField)) {
|
||||
errorField = fieldName.toString();
|
||||
if (!errorSubField.empty()) {
|
||||
errorField += "=>" + errorSubField;
|
||||
errorField += errorSubField;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -758,7 +758,7 @@ bool IResearchViewMetaState::init(arangodb::velocypack::Slice const& slice,
|
|||
|
||||
if (!getNumber(value,
|
||||
itr.value())) { // [ <collectionId 1> ... <collectionId N> ]
|
||||
errorField = fieldName + "=>[" +
|
||||
errorField = fieldName + "[" +
|
||||
arangodb::basics::StringUtils::itoa(itr.index()) + "]";
|
||||
|
||||
return false;
|
||||
|
|
|
@ -119,18 +119,18 @@ bool IResearchViewSort::fromVelocyPack(
|
|||
auto const directionSlice = sortSlice.get(directionFieldName);
|
||||
if (!directionSlice.isNone()) {
|
||||
if (!parseDirectionString(directionSlice, direction)) {
|
||||
error = "[" + std::to_string(size()) + "]=>" + directionFieldName;
|
||||
error = "[" + std::to_string(size()) + "]." + directionFieldName;
|
||||
return false;
|
||||
}
|
||||
} else if (!parseDirectionBool(sortSlice.get(ascFieldName), direction)) {
|
||||
error = "[" + std::to_string(size()) + "]=>" + ascFieldName;
|
||||
error = "[" + std::to_string(size()) + "]." + ascFieldName;
|
||||
return false;
|
||||
}
|
||||
|
||||
auto const fieldSlice = sortSlice.get(fieldName);
|
||||
|
||||
if (!fieldSlice.isString()) {
|
||||
error = "[" + std::to_string(size()) + "]=>" + fieldName;
|
||||
error = "[" + std::to_string(size()) + "]." + fieldName;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -142,7 +142,7 @@ bool IResearchViewSort::fromVelocyPack(
|
|||
);
|
||||
} catch (...) {
|
||||
// FIXME why doesn't 'TRI_ParseAttributeString' return bool?
|
||||
error = "[" + std::to_string(size()) + "]=>" + fieldName;
|
||||
error = "[" + std::to_string(size()) + "]." + fieldName;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -312,7 +312,7 @@ class Index {
|
|||
virtual bool isHidden() const = 0;
|
||||
|
||||
/// @brief if true this index should not be shown externally
|
||||
virtual bool inProgress() const { return false; };
|
||||
virtual bool inProgress() const { return false; }
|
||||
|
||||
/// @brief whether or not the index has a selectivity estimate
|
||||
virtual bool hasSelectivityEstimate() const = 0;
|
||||
|
@ -347,7 +347,7 @@ class Index {
|
|||
/// @brief serialize selectivity estimates
|
||||
Estimates = 4,
|
||||
/// @brief serialize object ids for persistence
|
||||
Internals = 8,
|
||||
Internals = 8
|
||||
};
|
||||
|
||||
/// @brief helper for building flags
|
||||
|
|
|
@ -295,9 +295,7 @@ arangodb::Result MMFilesCollection::persistProperties() {
|
|||
try {
|
||||
auto infoBuilder = _logicalCollection.toVelocyPackIgnore(
|
||||
{"path", "statusString"},
|
||||
LogicalDataSource::makeFlags(LogicalDataSource::Serialize::Detailed,
|
||||
LogicalDataSource::Serialize::ForPersistence,
|
||||
LogicalDataSource::Serialize::IncludeInProgress));
|
||||
LogicalDataSource::Serialization::Persistence);
|
||||
MMFilesCollectionMarker marker(TRI_DF_MARKER_VPACK_CHANGE_COLLECTION,
|
||||
_logicalCollection.vocbase().id(),
|
||||
_logicalCollection.id(), infoBuilder.slice());
|
||||
|
@ -2283,9 +2281,7 @@ std::shared_ptr<Index> MMFilesCollection::createIndex(transaction::Methods& trx,
|
|||
if (!engine->inRecovery()) {
|
||||
auto builder = _logicalCollection.toVelocyPackIgnore(
|
||||
{"path", "statusString"},
|
||||
LogicalDataSource::makeFlags(LogicalDataSource::Serialize::Detailed,
|
||||
LogicalDataSource::Serialize::ForPersistence,
|
||||
LogicalDataSource::Serialize::IncludeInProgress));
|
||||
LogicalDataSource::Serialization::Persistence);
|
||||
_logicalCollection.properties(builder.slice(),
|
||||
false); // always a full-update
|
||||
}
|
||||
|
@ -2423,9 +2419,7 @@ bool MMFilesCollection::dropIndex(TRI_idx_iid_t iid) {
|
|||
{
|
||||
auto builder = _logicalCollection.toVelocyPackIgnore(
|
||||
{"path", "statusString"},
|
||||
LogicalDataSource::makeFlags(LogicalDataSource::Serialize::Detailed,
|
||||
LogicalDataSource::Serialize::ForPersistence,
|
||||
LogicalDataSource::Serialize::IncludeInProgress));
|
||||
LogicalDataSource::Serialization::Persistence);
|
||||
|
||||
_logicalCollection.properties(builder.slice(),
|
||||
false); // always a full-update
|
||||
|
|
|
@ -1020,10 +1020,9 @@ arangodb::Result MMFilesEngine::persistCollection(TRI_vocbase_t& vocbase,
|
|||
// Nothing to do. In recovery we do not write markers.
|
||||
return {};
|
||||
}
|
||||
VPackBuilder builder =
|
||||
collection.toVelocyPackIgnore({"path", "statusString"},
|
||||
LogicalDataSource::makeFlags(
|
||||
LogicalDataSource::Serialize::Detailed));
|
||||
VPackBuilder builder = collection.toVelocyPackIgnore(
|
||||
{"path", "statusString"},
|
||||
LogicalDataSource::Serialization::Properties);
|
||||
VPackSlice const slice = builder.slice();
|
||||
|
||||
auto cid = collection.id();
|
||||
|
@ -1347,9 +1346,7 @@ Result MMFilesEngine::createView(TRI_vocbase_t& vocbase, TRI_voc_cid_t id,
|
|||
VPackBuilder builder;
|
||||
|
||||
builder.openObject();
|
||||
view.properties(builder,
|
||||
LogicalDataSource::makeFlags(LogicalDataSource::Serialize::Detailed,
|
||||
LogicalDataSource::Serialize::ForPersistence));
|
||||
view.properties(builder, LogicalDataSource::Serialization::Persistence);
|
||||
builder.close();
|
||||
|
||||
TRI_ASSERT(id != 0);
|
||||
|
@ -1449,9 +1446,7 @@ void MMFilesEngine::saveViewInfo(TRI_vocbase_t const& vocbase,
|
|||
VPackBuilder builder;
|
||||
|
||||
builder.openObject();
|
||||
view.properties(builder,
|
||||
LogicalDataSource::makeFlags(LogicalDataSource::Serialize::Detailed,
|
||||
LogicalDataSource::Serialize::ForPersistence));
|
||||
view.properties(builder, LogicalDataSource::Serialization::Persistence);
|
||||
builder.close();
|
||||
|
||||
LOG_TOPIC("cff7f", TRACE, Logger::VIEWS) << "storing view properties in file '" << filename
|
||||
|
@ -1481,9 +1476,7 @@ Result MMFilesEngine::changeView(TRI_vocbase_t& vocbase,
|
|||
VPackBuilder infoBuilder;
|
||||
|
||||
infoBuilder.openObject();
|
||||
view.properties(infoBuilder,
|
||||
LogicalDataSource::makeFlags(LogicalDataSource::Serialize::Detailed,
|
||||
LogicalDataSource::Serialize::ForPersistence));
|
||||
view.properties(infoBuilder, LogicalDataSource::Serialization::Persistence);
|
||||
infoBuilder.close();
|
||||
|
||||
MMFilesViewMarker marker(TRI_DF_MARKER_VPACK_CHANGE_VIEW, vocbase.id(),
|
||||
|
@ -2238,10 +2231,9 @@ void MMFilesEngine::saveCollectionInfo(TRI_vocbase_t* vocbase, TRI_voc_cid_t id,
|
|||
bool forceSync) const {
|
||||
std::string const filename = collectionParametersFilename(vocbase->id(), id);
|
||||
|
||||
VPackBuilder builder =
|
||||
parameters->toVelocyPackIgnore({"path", "statusString"},
|
||||
LogicalDataSource::makeFlags(
|
||||
LogicalDataSource::Serialize::Detailed));
|
||||
VPackBuilder builder = parameters->toVelocyPackIgnore(
|
||||
{"path", "statusString"},
|
||||
LogicalDataSource::Serialization::Properties);
|
||||
TRI_ASSERT(id != 0);
|
||||
|
||||
bool ok = VelocyPackHelper::velocyPackToFile(filename, builder.slice(), forceSync);
|
||||
|
|
|
@ -1415,10 +1415,28 @@ Result DatabaseInitialSyncer::handleCollectionsAndViews(VPackSlice const& collSl
|
|||
collections.emplace_back(parameters, indexes);
|
||||
}
|
||||
|
||||
// STEP 1: validate collection declarations from master
|
||||
// STEP 1: now that the collections exist create the views
|
||||
// this should be faster than re-indexing afterwards
|
||||
// ----------------------------------------------------------------------------------
|
||||
|
||||
// STEP 2: drop and re-create collections locally if they are also present on
|
||||
if (!_config.applier._skipCreateDrop &&
|
||||
_config.applier._restrictCollections.empty() &&
|
||||
viewSlices.isArray()) {
|
||||
// views are optional, and 3.3 and before will not send any view data
|
||||
Result r = handleViewCreation(viewSlices); // no requests to master
|
||||
if (r.fail()) {
|
||||
LOG_TOPIC("96cda", ERR, Logger::REPLICATION)
|
||||
<< "Error during intial sync view creation: " << r.errorMessage();
|
||||
return r;
|
||||
}
|
||||
} else {
|
||||
_config.progress.set("view creation skipped because of configuration");
|
||||
}
|
||||
|
||||
// STEP 2: validate collection declarations from master
|
||||
// ----------------------------------------------------------------------------------
|
||||
|
||||
// STEP 3: drop and re-create collections locally if they are also present on
|
||||
// the master
|
||||
// ------------------------------------------------------------------------------------
|
||||
|
||||
|
@ -1432,23 +1450,6 @@ Result DatabaseInitialSyncer::handleCollectionsAndViews(VPackSlice const& collSl
|
|||
}
|
||||
}
|
||||
|
||||
// STEP 3: now that the collections exist create the views
|
||||
// this should be faster than re-indexing afterwards
|
||||
// ----------------------------------------------------------------------------------
|
||||
|
||||
if (!_config.applier._skipCreateDrop &&
|
||||
_config.applier._restrictCollections.empty() && viewSlices.isArray()) {
|
||||
// views are optional, and 3.3 and before will not send any view data
|
||||
Result r = handleViewCreation(viewSlices); // no requests to master
|
||||
if (r.fail()) {
|
||||
LOG_TOPIC("96cda", ERR, Logger::REPLICATION)
|
||||
<< "Error during intial sync view creation: " << r.errorMessage();
|
||||
return r;
|
||||
}
|
||||
} else {
|
||||
_config.progress.set("view creation skipped because of configuration");
|
||||
}
|
||||
|
||||
// STEP 4: sync collection data from master and create initial indexes
|
||||
// ----------------------------------------------------------------------------------
|
||||
|
||||
|
|
|
@ -217,7 +217,7 @@ void RestAnalyzerHandler::createAnalyzer( // create
|
|||
auto pool = result.first;
|
||||
arangodb::velocypack::Builder builder;
|
||||
|
||||
pool->toVelocyPack(builder);
|
||||
pool->toVelocyPack(builder, false);
|
||||
|
||||
generateResult(
|
||||
result.second // new analyzer v.s. existing analyzer
|
||||
|
@ -290,10 +290,8 @@ arangodb::RestStatus RestAnalyzerHandler::execute() {
|
|||
return arangodb::RestStatus::DONE;
|
||||
}
|
||||
|
||||
void RestAnalyzerHandler::getAnalyzer(
|
||||
IResearchAnalyzerFeature& analyzers,
|
||||
std::string const& requestedName
|
||||
) {
|
||||
void RestAnalyzerHandler::getAnalyzer(IResearchAnalyzerFeature& analyzers,
|
||||
std::string const& requestedName) {
|
||||
auto& server = arangodb::application_features::ApplicationServer::server();
|
||||
auto sysVocbase = server.hasFeature<arangodb::SystemDatabaseFeature>()
|
||||
? server.getFeature<arangodb::SystemDatabaseFeature>().use()
|
||||
|
@ -339,28 +337,26 @@ void RestAnalyzerHandler::getAnalyzer(
|
|||
}
|
||||
|
||||
arangodb::velocypack::Builder builder;
|
||||
pool->toVelocyPack(builder);
|
||||
pool->toVelocyPack(builder, false);
|
||||
|
||||
// generate result + 'error' field + 'code' field
|
||||
// 2nd param must be Builder and not Slice
|
||||
generateOk(arangodb::rest::ResponseCode::OK, builder);
|
||||
}
|
||||
|
||||
void RestAnalyzerHandler::getAnalyzers( // get all analyzers
|
||||
IResearchAnalyzerFeature& analyzers // analyzer feature
|
||||
) {
|
||||
void RestAnalyzerHandler::getAnalyzers(IResearchAnalyzerFeature& analyzers) {
|
||||
// ...........................................................................
|
||||
// end of parameter parsing
|
||||
// ...........................................................................
|
||||
|
||||
typedef arangodb::iresearch::IResearchAnalyzerFeature::AnalyzerPool::ptr AnalyzerPoolPtr;
|
||||
typedef arangodb::iresearch::AnalyzerPool::ptr AnalyzerPoolPtr;
|
||||
arangodb::velocypack::Builder builder;
|
||||
auto visitor = [&builder](AnalyzerPoolPtr const& analyzer)->bool {
|
||||
if (!analyzer) {
|
||||
return true; // continue with next analyzer
|
||||
}
|
||||
|
||||
analyzer->toVelocyPack(builder);
|
||||
analyzer->toVelocyPack(builder, false);
|
||||
|
||||
return true; // continue with next analyzer
|
||||
};
|
||||
|
|
|
@ -730,8 +730,7 @@ void RestReplicationHandler::handleCommandClusterInventory() {
|
|||
LogicalView::enumerate(_vocbase, [&resultBuilder](LogicalView::ptr const& view) -> bool {
|
||||
if (view) {
|
||||
resultBuilder.openObject();
|
||||
view->properties(resultBuilder, LogicalDataSource::makeFlags(
|
||||
LogicalDataSource::Serialize::Detailed));
|
||||
view->properties(resultBuilder, LogicalDataSource::Serialization::Inventory);
|
||||
// details, !forPersistence because on restore any datasource ids will
|
||||
// differ, so need an end-user representation
|
||||
resultBuilder.close();
|
||||
|
|
|
@ -82,8 +82,7 @@ void RestViewHandler::getView(std::string const& nameOrId, bool detailed) {
|
|||
|
||||
viewBuilder.openObject();
|
||||
|
||||
auto res = view->properties(viewBuilder, LogicalDataSource::makeFlags(
|
||||
LogicalDataSource::Serialize::Detailed));
|
||||
auto res = view->properties(viewBuilder, LogicalDataSource::Serialization::Properties);
|
||||
|
||||
if (!res.ok()) {
|
||||
generateError(res);
|
||||
|
@ -100,10 +99,9 @@ void RestViewHandler::getView(std::string const& nameOrId, bool detailed) {
|
|||
|
||||
builder.openObject();
|
||||
|
||||
auto res =
|
||||
view->properties(builder, LogicalDataSource::makeFlags(
|
||||
detailed ? LogicalDataSource::Serialize::Detailed
|
||||
: LogicalDataSource::Serialize::Basics));
|
||||
auto const context = detailed ? LogicalDataSource::Serialization::Properties
|
||||
: LogicalDataSource::Serialization::List;
|
||||
auto res = view->properties(builder, context);
|
||||
|
||||
builder.close();
|
||||
|
||||
|
@ -224,8 +222,7 @@ void RestViewHandler::createView() {
|
|||
velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
res = view->properties(builder, LogicalDataSource::makeFlags(
|
||||
LogicalDataSource::Serialize::Detailed));
|
||||
res = view->properties(builder, LogicalDataSource::Serialization::Properties);
|
||||
|
||||
if (!res.ok()) {
|
||||
generateError(res);
|
||||
|
@ -305,8 +302,7 @@ void RestViewHandler::modifyView(bool partialUpdate) {
|
|||
|
||||
viewBuilder.openObject();
|
||||
|
||||
auto res = view->properties(viewBuilder, LogicalDataSource::makeFlags(
|
||||
LogicalDataSource::Serialize::Detailed));
|
||||
auto res = view->properties(viewBuilder, LogicalDataSource::Serialization::Properties);
|
||||
|
||||
if (!res.ok()) {
|
||||
generateError(res);
|
||||
|
@ -347,9 +343,8 @@ void RestViewHandler::modifyView(bool partialUpdate) {
|
|||
|
||||
builderCurrent.openObject();
|
||||
|
||||
auto resCurrent =
|
||||
view->properties(builderCurrent, LogicalDataSource::makeFlags(
|
||||
LogicalDataSource::Serialize::Detailed));
|
||||
auto resCurrent = view->properties(builderCurrent,
|
||||
LogicalDataSource::Serialization::Properties);
|
||||
|
||||
if (!resCurrent.ok()) {
|
||||
generateError(resCurrent);
|
||||
|
@ -378,8 +373,7 @@ void RestViewHandler::modifyView(bool partialUpdate) {
|
|||
|
||||
updated.openObject();
|
||||
|
||||
auto res = view->properties(updated, LogicalDataSource::makeFlags(
|
||||
LogicalDataSource::Serialize::Detailed));
|
||||
auto res = view->properties(updated, LogicalDataSource::Serialization::Properties);
|
||||
|
||||
updated.close();
|
||||
|
||||
|
@ -522,9 +516,7 @@ void RestViewHandler::getViews() {
|
|||
|
||||
viewBuilder.openObject();
|
||||
|
||||
if (!view->properties(viewBuilder, LogicalDataSource::makeFlags(
|
||||
LogicalDataSource::Serialize::Detailed))
|
||||
.ok()) {
|
||||
if (!view->properties(viewBuilder, LogicalDataSource::Serialization::Properties).ok()) {
|
||||
continue; // skip view
|
||||
}
|
||||
} catch (...) {
|
||||
|
@ -536,7 +528,7 @@ void RestViewHandler::getViews() {
|
|||
viewBuilder.openObject();
|
||||
|
||||
try {
|
||||
auto res = view->properties(viewBuilder, LogicalDataSource::makeFlags());
|
||||
auto res = view->properties(viewBuilder, LogicalDataSource::Serialization::List);
|
||||
|
||||
if (!res.ok()) {
|
||||
generateError(res);
|
||||
|
|
|
@ -402,9 +402,7 @@ std::shared_ptr<Index> RocksDBCollection::createIndex(VPackSlice const& info,
|
|||
if (!engine->inRecovery()) { // write new collection marker
|
||||
auto builder = _logicalCollection.toVelocyPackIgnore(
|
||||
{"path", "statusString"},
|
||||
LogicalDataSource::makeFlags(LogicalDataSource::Serialize::Detailed,
|
||||
LogicalDataSource::Serialize::ForPersistence,
|
||||
LogicalDataSource::Serialize::IncludeInProgress));
|
||||
LogicalDataSource::Serialization::Persistence);
|
||||
VPackBuilder indexInfo;
|
||||
idx->toVelocyPack(indexInfo, Index::makeFlags(Index::Serialize::Internals));
|
||||
res = engine->writeCreateCollectionMarker(_logicalCollection.vocbase().id(),
|
||||
|
@ -486,9 +484,7 @@ bool RocksDBCollection::dropIndex(TRI_idx_iid_t iid) {
|
|||
auto builder = // RocksDB path
|
||||
_logicalCollection.toVelocyPackIgnore(
|
||||
{"path", "statusString"},
|
||||
LogicalDataSource::makeFlags(LogicalDataSource::Serialize::Detailed,
|
||||
LogicalDataSource::Serialize::ForPersistence,
|
||||
LogicalDataSource::Serialize::IncludeInProgress));
|
||||
LogicalDataSource::Serialization::Persistence);
|
||||
|
||||
// log this event in the WAL and in the collection meta-data
|
||||
res = engine->writeCreateCollectionMarker( // write marker
|
||||
|
|
|
@ -1248,9 +1248,7 @@ std::string RocksDBEngine::createCollection(TRI_vocbase_t& vocbase,
|
|||
|
||||
auto builder = collection.toVelocyPackIgnore(
|
||||
{"path", "statusString"},
|
||||
LogicalDataSource::makeFlags(LogicalDataSource::Serialize::Detailed,
|
||||
LogicalDataSource::Serialize::ForPersistence,
|
||||
LogicalDataSource::Serialize::IncludeInProgress));
|
||||
LogicalDataSource::Serialization::Persistence);
|
||||
TRI_UpdateTickServer(static_cast<TRI_voc_tick_t>(cid));
|
||||
|
||||
int res =
|
||||
|
@ -1403,9 +1401,7 @@ void RocksDBEngine::changeCollection(TRI_vocbase_t& vocbase,
|
|||
LogicalCollection const& collection, bool doSync) {
|
||||
auto builder = collection.toVelocyPackIgnore(
|
||||
{"path", "statusString"},
|
||||
LogicalDataSource::makeFlags(LogicalDataSource::Serialize::Detailed,
|
||||
LogicalDataSource::Serialize::ForPersistence,
|
||||
LogicalDataSource::Serialize::IncludeInProgress));
|
||||
LogicalDataSource::Serialization::Persistence);
|
||||
int res =
|
||||
writeCreateCollectionMarker(vocbase.id(), collection.id(), builder.slice(),
|
||||
RocksDBLogValue::CollectionChange(vocbase.id(),
|
||||
|
@ -1421,9 +1417,7 @@ arangodb::Result RocksDBEngine::renameCollection(TRI_vocbase_t& vocbase,
|
|||
std::string const& oldName) {
|
||||
auto builder = collection.toVelocyPackIgnore(
|
||||
{"path", "statusString"},
|
||||
LogicalDataSource::makeFlags(LogicalDataSource::Serialize::Detailed,
|
||||
LogicalDataSource::Serialize::ForPersistence,
|
||||
LogicalDataSource::Serialize::IncludeInProgress));
|
||||
LogicalDataSource::Serialization::Persistence);
|
||||
int res = writeCreateCollectionMarker(
|
||||
vocbase.id(), collection.id(), builder.slice(),
|
||||
RocksDBLogValue::CollectionRename(vocbase.id(), collection.id(),
|
||||
|
@ -1451,10 +1445,7 @@ Result RocksDBEngine::createView(TRI_vocbase_t& vocbase, TRI_voc_cid_t id,
|
|||
VPackBuilder props;
|
||||
|
||||
props.openObject();
|
||||
view.properties(props,
|
||||
LogicalDataSource::makeFlags(LogicalDataSource::Serialize::Detailed,
|
||||
LogicalDataSource::Serialize::ForPersistence,
|
||||
LogicalDataSource::Serialize::IncludeInProgress));
|
||||
view.properties(props, LogicalDataSource::Serialization::Persistence);
|
||||
props.close();
|
||||
|
||||
RocksDBValue const value = RocksDBValue::View(props.slice());
|
||||
|
@ -1479,10 +1470,7 @@ arangodb::Result RocksDBEngine::dropView(TRI_vocbase_t const& vocbase,
|
|||
VPackBuilder builder;
|
||||
|
||||
builder.openObject();
|
||||
view.properties(builder,
|
||||
LogicalDataSource::makeFlags(LogicalDataSource::Serialize::Detailed,
|
||||
LogicalDataSource::Serialize::ForPersistence,
|
||||
LogicalDataSource::Serialize::IncludeInProgress));
|
||||
view.properties(builder, LogicalDataSource::Serialization::Persistence);
|
||||
builder.close();
|
||||
|
||||
auto logValue =
|
||||
|
@ -1528,10 +1516,7 @@ Result RocksDBEngine::changeView(TRI_vocbase_t& vocbase,
|
|||
VPackBuilder infoBuilder;
|
||||
|
||||
infoBuilder.openObject();
|
||||
view.properties(infoBuilder,
|
||||
LogicalDataSource::makeFlags(LogicalDataSource::Serialize::Detailed,
|
||||
LogicalDataSource::Serialize::ForPersistence,
|
||||
LogicalDataSource::Serialize::IncludeInProgress));
|
||||
view.properties(infoBuilder, LogicalDataSource::Serialization::Persistence);
|
||||
infoBuilder.close();
|
||||
|
||||
RocksDBLogValue log = RocksDBLogValue::ViewChange(vocbase.id(), view.id());
|
||||
|
|
|
@ -527,26 +527,29 @@ int PhysicalCollection::checkRevision(transaction::Methods*, TRI_voc_rid_t expec
|
|||
}
|
||||
|
||||
/// @brief hands out a list of indexes
|
||||
std::vector<std::shared_ptr<arangodb::Index>> PhysicalCollection::getIndexes() const {
|
||||
std::vector<std::shared_ptr<Index>> PhysicalCollection::getIndexes() const {
|
||||
READ_LOCKER(guard, _indexesLock);
|
||||
return { _indexes.begin(), _indexes.end() };
|
||||
}
|
||||
|
||||
void PhysicalCollection::getIndexesVPack(VPackBuilder& result, unsigned flags,
|
||||
std::function<bool(arangodb::Index const*)> const& filter) const {
|
||||
void PhysicalCollection::getIndexesVPack(VPackBuilder& result,
|
||||
std::function<bool(Index const*, std::underlying_type<Index::Serialize>::type&)> const& filter) const {
|
||||
READ_LOCKER(guard, _indexesLock);
|
||||
result.openArray();
|
||||
for (std::shared_ptr<Index> const& idx : _indexes) {
|
||||
if (!filter(idx.get())) {
|
||||
std::underlying_type<Index::Serialize>::type flags = Index::makeFlags();
|
||||
|
||||
if (!filter(idx.get(), flags)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
idx->toVelocyPack(result, flags);
|
||||
}
|
||||
result.close();
|
||||
}
|
||||
|
||||
/// @brief return the figures for a collection
|
||||
futures::Future<std::shared_ptr<arangodb::velocypack::Builder>> PhysicalCollection::figures() {
|
||||
futures::Future<std::shared_ptr<VPackBuilder>> PhysicalCollection::figures() {
|
||||
auto builder = std::make_shared<VPackBuilder>();
|
||||
builder->openObject();
|
||||
|
||||
|
|
|
@ -126,8 +126,8 @@ class PhysicalCollection {
|
|||
/// @brief get list of all indices
|
||||
std::vector<std::shared_ptr<Index>> getIndexes() const;
|
||||
|
||||
void getIndexesVPack(velocypack::Builder&, unsigned flags,
|
||||
std::function<bool(arangodb::Index const*)> const& filter) const;
|
||||
void getIndexesVPack(velocypack::Builder&,
|
||||
std::function<bool(arangodb::Index const*, std::underlying_type<Index::Serialize>::type&)> const& filter) const;
|
||||
|
||||
/// @brief return the figures for a collection
|
||||
virtual futures::Future<std::shared_ptr<velocypack::Builder>> figures();
|
||||
|
|
|
@ -45,22 +45,19 @@ namespace {
|
|||
/// @brief unwraps an analyser wrapped via WrapAnalyzer(...)
|
||||
/// @return collection or nullptr on failure
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
arangodb::iresearch::IResearchAnalyzerFeature::AnalyzerPool* UnwrapAnalyzer( // unwrap
|
||||
v8::Isolate* isolate, // isolate
|
||||
v8::Local<v8::Object> const& holder // holder
|
||||
) {
|
||||
return TRI_UnwrapClass<arangodb::iresearch::IResearchAnalyzerFeature::AnalyzerPool>( // unwrap class
|
||||
holder, WRP_IRESEARCH_ANALYZER_TYPE, TRI_IGETC // args
|
||||
);
|
||||
arangodb::iresearch::AnalyzerPool* UnwrapAnalyzer(
|
||||
v8::Isolate* isolate,
|
||||
v8::Local<v8::Object> const& holder) {
|
||||
return TRI_UnwrapClass<arangodb::iresearch::AnalyzerPool>(
|
||||
holder, WRP_IRESEARCH_ANALYZER_TYPE, TRI_IGETC);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief wraps an Analyzer
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
v8::Handle<v8::Object> WrapAnalyzer( // wrap analyzer
|
||||
v8::Isolate* isolate, // isolate
|
||||
arangodb::iresearch::IResearchAnalyzerFeature::AnalyzerPool::ptr const& analyzer // analyzer
|
||||
) {
|
||||
v8::Handle<v8::Object> WrapAnalyzer(
|
||||
v8::Isolate* isolate,
|
||||
arangodb::iresearch::AnalyzerPool::ptr const& analyzer) {
|
||||
v8::EscapableHandleScope scope(isolate);
|
||||
TRI_GET_GLOBALS();
|
||||
TRI_GET_GLOBAL(IResearchAnalyzerTempl, v8::ObjectTemplate);
|
||||
|
@ -515,7 +512,7 @@ void JS_List(v8::FunctionCallbackInfo<v8::Value> const& args) {
|
|||
// end of parameter parsing
|
||||
// ...........................................................................
|
||||
|
||||
typedef arangodb::iresearch::IResearchAnalyzerFeature::AnalyzerPool::ptr AnalyzerPoolPtr;
|
||||
typedef arangodb::iresearch::AnalyzerPool::ptr AnalyzerPoolPtr;
|
||||
std::vector<AnalyzerPoolPtr> result;
|
||||
auto visitor = [&result](AnalyzerPoolPtr const& analyzer)->bool {
|
||||
if (analyzer) {
|
||||
|
|
|
@ -390,8 +390,7 @@ static void JS_ViewVocbase(v8::FunctionCallbackInfo<v8::Value> const& args) {
|
|||
|
||||
viewBuilder.openObject();
|
||||
|
||||
auto res = view->properties(viewBuilder, LogicalDataSource::makeFlags(
|
||||
LogicalDataSource::Serialize::Detailed));
|
||||
auto const res = view->properties(viewBuilder, LogicalDataSource::Serialization::Properties);
|
||||
|
||||
if (!res.ok()) {
|
||||
TRI_V8_THROW_EXCEPTION(res); // skip view
|
||||
|
@ -458,9 +457,7 @@ static void JS_ViewsVocbase(v8::FunctionCallbackInfo<v8::Value> const& args) {
|
|||
|
||||
viewBuilder.openObject();
|
||||
|
||||
if (!view->properties(viewBuilder, LogicalDataSource::makeFlags(
|
||||
LogicalDataSource::Serialize::Detailed))
|
||||
.ok()) {
|
||||
if (!view->properties(viewBuilder, LogicalDataSource::Serialization::Properties).ok()) {
|
||||
continue; // skip view
|
||||
}
|
||||
} catch (...) {
|
||||
|
@ -567,9 +564,7 @@ static void JS_PropertiesViewVocbase(v8::FunctionCallbackInfo<v8::Value> const&
|
|||
|
||||
builderCurrent.openObject();
|
||||
|
||||
auto resCurrent =
|
||||
viewPtr->properties(builderCurrent, LogicalDataSource::makeFlags(
|
||||
LogicalDataSource::Serialize::Detailed));
|
||||
auto resCurrent = viewPtr->properties(builderCurrent, LogicalDataSource::Serialization::Properties);
|
||||
|
||||
if (!resCurrent.ok()) {
|
||||
TRI_V8_THROW_EXCEPTION(resCurrent);
|
||||
|
@ -608,8 +603,7 @@ static void JS_PropertiesViewVocbase(v8::FunctionCallbackInfo<v8::Value> const&
|
|||
|
||||
builder.openObject();
|
||||
|
||||
auto res = view->properties(builder, LogicalDataSource::makeFlags(
|
||||
LogicalDataSource::Serialize::Detailed));
|
||||
auto const res = view->properties(builder, LogicalDataSource::Serialization::Properties);
|
||||
|
||||
builder.close();
|
||||
|
||||
|
@ -667,8 +661,7 @@ static void JS_RenameViewVocbase(v8::FunctionCallbackInfo<v8::Value> const& args
|
|||
|
||||
viewBuilder.openObject();
|
||||
|
||||
auto res = view->properties(viewBuilder, LogicalDataSource::makeFlags(
|
||||
LogicalDataSource::Serialize::Detailed));
|
||||
auto const res = view->properties(viewBuilder, LogicalDataSource::Serialization::Properties);
|
||||
|
||||
if (!res.ok()) {
|
||||
TRI_V8_THROW_EXCEPTION(res); // skip view
|
||||
|
|
|
@ -450,9 +450,9 @@ std::vector<std::shared_ptr<arangodb::Index>> LogicalCollection::getIndexes() co
|
|||
}
|
||||
|
||||
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);
|
||||
VPackBuilder& result,
|
||||
std::function<bool(arangodb::Index const*, std::underlying_type<Index::Serialize>::type&)> const& filter) const {
|
||||
getPhysical()->getIndexesVPack(result, filter);
|
||||
}
|
||||
|
||||
bool LogicalCollection::allowUserKeys() const { return _allowUserKeys; }
|
||||
|
@ -576,7 +576,7 @@ void LogicalCollection::toVelocyPackForClusterInventory(VPackBuilder& result,
|
|||
std::unordered_set<std::string> ignoreKeys{
|
||||
"allowUserKeys", "cid", "count", "statusString", "version",
|
||||
"distributeShardsLike", "objectId", "indexes"};
|
||||
VPackBuilder params = toVelocyPackIgnore(ignoreKeys, LogicalDataSource::makeFlags());
|
||||
VPackBuilder params = toVelocyPackIgnore(ignoreKeys, Serialization::List);
|
||||
{
|
||||
VPackObjectBuilder guard(&result);
|
||||
|
||||
|
@ -595,13 +595,21 @@ void LogicalCollection::toVelocyPackForClusterInventory(VPackBuilder& result,
|
|||
}
|
||||
|
||||
result.add(VPackValue("indexes"));
|
||||
getIndexesVPack(result, Index::makeFlags(), [](arangodb::Index const* idx) {
|
||||
getIndexesVPack(result, [](Index const* idx, uint8_t& flags) {
|
||||
// we have to exclude the primary and the edge index here, because otherwise
|
||||
// at least the MMFiles engine will try to create it
|
||||
// AND exclude hidden indexes
|
||||
return (idx->type() != arangodb::Index::TRI_IDX_TYPE_PRIMARY_INDEX &&
|
||||
idx->type() != arangodb::Index::TRI_IDX_TYPE_EDGE_INDEX &&
|
||||
!idx->isHidden() && !idx->inProgress());
|
||||
switch (idx->type()) {
|
||||
case Index::TRI_IDX_TYPE_PRIMARY_INDEX:
|
||||
case Index::TRI_IDX_TYPE_EDGE_INDEX:
|
||||
return false;
|
||||
case Index::TRI_IDX_TYPE_IRESEARCH_LINK:
|
||||
flags = Index::makeFlags(Index::Serialize::Internals);
|
||||
return true;
|
||||
default:
|
||||
flags = Index::makeFlags();
|
||||
return !idx->isHidden() && !idx->inProgress();
|
||||
}
|
||||
});
|
||||
result.add("planVersion", VPackValue(planVersion()));
|
||||
result.add("isReady", VPackValue(isReady));
|
||||
|
@ -610,7 +618,9 @@ void LogicalCollection::toVelocyPackForClusterInventory(VPackBuilder& result,
|
|||
}
|
||||
|
||||
arangodb::Result LogicalCollection::appendVelocyPack(arangodb::velocypack::Builder& result,
|
||||
std::underlying_type<Serialize>::type flags) const {
|
||||
Serialization context) const {
|
||||
bool const forPersistence = (context == Serialization::Persistence);
|
||||
|
||||
// We write into an open object
|
||||
TRI_ASSERT(result.isOpenObject());
|
||||
|
||||
|
@ -624,7 +634,7 @@ arangodb::Result LogicalCollection::appendVelocyPack(arangodb::velocypack::Build
|
|||
// Collection Flags
|
||||
result.add("waitForSync", VPackValue(_waitForSync));
|
||||
|
||||
if (!hasFlag(flags, Serialize::ForPersistence)) {
|
||||
if (!forPersistence) {
|
||||
// with 'forPersistence' added by LogicalDataSource::toVelocyPack
|
||||
// FIXME TODO is this needed in !forPersistence???
|
||||
result.add(StaticStrings::DataSourceDeleted, VPackValue(deleted()));
|
||||
|
@ -649,14 +659,18 @@ arangodb::Result LogicalCollection::appendVelocyPack(arangodb::velocypack::Build
|
|||
auto indexFlags = Index::makeFlags();
|
||||
// hide hidden indexes. In effect hides unfinished indexes,
|
||||
// and iResearch links (only on a single-server and coordinator)
|
||||
auto filter = [&](arangodb::Index const* idx) {
|
||||
return (hasFlag(flags, Serialize::IncludeInProgress) || !idx->inProgress()) &&
|
||||
(hasFlag(flags, Serialize::ForPersistence) || !idx->isHidden());
|
||||
};
|
||||
if (hasFlag(flags, Serialize::ForPersistence)) {
|
||||
if (forPersistence) {
|
||||
indexFlags = Index::makeFlags(Index::Serialize::Internals);
|
||||
}
|
||||
getIndexesVPack(result, indexFlags, filter);
|
||||
auto filter = [indexFlags, forPersistence](arangodb::Index const* idx, decltype(Index::makeFlags())& flags) {
|
||||
if (forPersistence || (!idx->inProgress() && !idx->isHidden())) {
|
||||
flags = indexFlags;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
getIndexesVPack(result, filter);
|
||||
|
||||
// Cluster Specific
|
||||
result.add(StaticStrings::IsSmart, VPackValue(isSmart()));
|
||||
|
@ -665,13 +679,13 @@ arangodb::Result LogicalCollection::appendVelocyPack(arangodb::velocypack::Build
|
|||
result.add(StaticStrings::SmartJoinAttribute, VPackValue(_smartJoinAttribute));
|
||||
}
|
||||
|
||||
if (!hasFlag(flags, Serialize::ForPersistence)) {
|
||||
if (!forPersistence) {
|
||||
// with 'forPersistence' added by LogicalDataSource::toVelocyPack
|
||||
// FIXME TODO is this needed in !forPersistence???
|
||||
result.add(StaticStrings::DataSourcePlanId, VPackValue(std::to_string(planId())));
|
||||
}
|
||||
|
||||
_sharding->toVelocyPack(result, hasFlag(flags, Serialize::Detailed));
|
||||
_sharding->toVelocyPack(result, Serialization::List != context);
|
||||
|
||||
includeVelocyPackEnterprise(result);
|
||||
|
||||
|
@ -683,17 +697,17 @@ arangodb::Result LogicalCollection::appendVelocyPack(arangodb::velocypack::Build
|
|||
|
||||
void LogicalCollection::toVelocyPackIgnore(VPackBuilder& result,
|
||||
std::unordered_set<std::string> const& ignoreKeys,
|
||||
std::underlying_type<Serialize>::type flags) const {
|
||||
Serialization context) const {
|
||||
TRI_ASSERT(result.isOpenObject());
|
||||
VPackBuilder b = toVelocyPackIgnore(ignoreKeys, flags);
|
||||
VPackBuilder b = toVelocyPackIgnore(ignoreKeys, context);
|
||||
result.add(VPackObjectIterator(b.slice()));
|
||||
}
|
||||
|
||||
VPackBuilder LogicalCollection::toVelocyPackIgnore(std::unordered_set<std::string> const& ignoreKeys,
|
||||
std::underlying_type<Serialize>::type flags) const {
|
||||
Serialization context) const {
|
||||
VPackBuilder full;
|
||||
full.openObject();
|
||||
properties(full, flags);
|
||||
properties(full, context);
|
||||
full.close();
|
||||
if (ignoreKeys.empty()) {
|
||||
return full;
|
||||
|
|
|
@ -207,9 +207,8 @@ class LogicalCollection : public LogicalDataSource {
|
|||
/// @brief return all indexes of the collection
|
||||
std::vector<std::shared_ptr<Index>> getIndexes() const;
|
||||
|
||||
void getIndexesVPack(velocypack::Builder&, uint8_t,
|
||||
std::function<bool(arangodb::Index const*)> const& filter =
|
||||
[](arangodb::Index const*) -> bool { return true; }) const;
|
||||
void getIndexesVPack(velocypack::Builder&,
|
||||
std::function<bool(arangodb::Index const*, uint8_t&)> const& filter) const;
|
||||
|
||||
/// @brief a method to skip certain documents in AQL write operations,
|
||||
/// this is only used in the enterprise edition for smart graphs
|
||||
|
@ -228,10 +227,10 @@ class LogicalCollection : public LogicalDataSource {
|
|||
// SECTION: Serialization
|
||||
void toVelocyPackIgnore(velocypack::Builder& result,
|
||||
std::unordered_set<std::string> const& ignoreKeys,
|
||||
std::underlying_type<Serialize>::type flags) const;
|
||||
Serialization context) const;
|
||||
|
||||
velocypack::Builder toVelocyPackIgnore(std::unordered_set<std::string> const& ignoreKeys,
|
||||
std::underlying_type<Serialize>::type flags) const;
|
||||
Serialization context) const;
|
||||
|
||||
virtual void toVelocyPackForClusterInventory(velocypack::Builder&, bool useSystem,
|
||||
bool isReady, bool allInSync) const;
|
||||
|
@ -338,7 +337,7 @@ class LogicalCollection : public LogicalDataSource {
|
|||
|
||||
protected:
|
||||
virtual arangodb::Result appendVelocyPack(arangodb::velocypack::Builder& builder,
|
||||
std::underlying_type<Serialize>::type flags) const override;
|
||||
Serialization context) const override;
|
||||
|
||||
private:
|
||||
void prepareIndexes(velocypack::Slice indexesSlice);
|
||||
|
|
|
@ -193,11 +193,10 @@ LogicalDataSource::LogicalDataSource(Category const& category, Type const& type,
|
|||
}
|
||||
|
||||
Result LogicalDataSource::properties(velocypack::Builder& builder,
|
||||
std::underlying_type<Serialize>::type flags) const {
|
||||
Serialization context) const {
|
||||
if (!builder.isOpenObject()) {
|
||||
return Result(TRI_ERROR_BAD_PARAMETER,
|
||||
std::string(
|
||||
"invalid builder provided for data-source definition"));
|
||||
"invalid builder provided for data-source definition");
|
||||
}
|
||||
|
||||
builder.add(StaticStrings::DataSourceGuid,
|
||||
|
@ -208,7 +207,7 @@ Result LogicalDataSource::properties(velocypack::Builder& builder,
|
|||
// note: includeSystem and forPersistence are not 100% synonymous,
|
||||
// however, for our purposes this is an okay mapping; we only set
|
||||
// includeSystem if we are persisting the properties
|
||||
if (hasFlag(flags, Serialize::ForPersistence)) {
|
||||
if (context == Serialization::Persistence) {
|
||||
builder.add(StaticStrings::DataSourceDeleted, velocypack::Value(deleted()));
|
||||
builder.add(StaticStrings::DataSourceSystem, velocypack::Value(system()));
|
||||
|
||||
|
@ -218,7 +217,7 @@ Result LogicalDataSource::properties(velocypack::Builder& builder,
|
|||
velocypack::Value(std::to_string(planId())));
|
||||
}
|
||||
|
||||
return appendVelocyPack(builder, flags);
|
||||
return appendVelocyPack(builder, context);
|
||||
}
|
||||
|
||||
} // namespace arangodb
|
||||
|
|
|
@ -130,52 +130,27 @@ class LogicalDataSource {
|
|||
TRI_voc_cid_t planId() const noexcept { return _planId; }
|
||||
uint64_t planVersion() const noexcept { return _planVersion; }
|
||||
|
||||
enum class Serialize : uint8_t {
|
||||
// Include the basics for any given data source. Setting additonal flags
|
||||
// will only add additional information.
|
||||
Basics = 0,
|
||||
// Make output more detailed, e.g. for collections this will resolve CIDs
|
||||
// for 'distributeShardsLike', for views this will add view-specific
|
||||
// properties
|
||||
Detailed = 1,
|
||||
// This definition is meant to be persisted; will typically include
|
||||
// otherwise hidden internal properties
|
||||
ForPersistence = 2,
|
||||
// This will include any information about in-progress operations, such as
|
||||
// an index definition for an index being built in the background, which
|
||||
// would otherwise not be exposed yet
|
||||
IncludeInProgress = 4
|
||||
enum class Serialization {
|
||||
// object properties will be shown in a list
|
||||
List = 0,
|
||||
// object properties will be shown
|
||||
Properties,
|
||||
// object will be saved in storage engine
|
||||
Persistence,
|
||||
// object will be replicated or dumped/restored
|
||||
Inventory
|
||||
};
|
||||
|
||||
/// @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;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief append a jSON definition of the data-source to the 'builder'
|
||||
/// @param the buffer to append to, must be an open object
|
||||
/// @param detailed make output more detailed, e.g.
|
||||
/// for collections this will resolve CIDs for 'distributeShardsLike'
|
||||
/// for views this will add view-specific properties
|
||||
/// @param forPersistence this definition is meant to be persisted
|
||||
/// @param inProgress this definition should include indices that are still
|
||||
/// in the process of being created
|
||||
/// @param Serialization defines which properties to serialize
|
||||
/// @return success
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
Result properties(velocypack::Builder& builder,
|
||||
std::underlying_type<Serialize>::type flags) const;
|
||||
Result properties(velocypack::Builder& builder, Serialization context) const;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief updates properties of an existing DataSource
|
||||
|
@ -193,9 +168,8 @@ class LogicalDataSource {
|
|||
//////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief append implementation-specific values to the data-source definition
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
virtual Result appendVelocyPack(velocypack::Builder&,
|
||||
std::underlying_type<Serialize>::type) const {
|
||||
return Result(); // NOOP by default
|
||||
virtual Result appendVelocyPack(velocypack::Builder&, Serialization context) const {
|
||||
return {}; // NOOP by default
|
||||
}
|
||||
|
||||
void deleted(bool deleted) noexcept { _deleted = deleted; }
|
||||
|
|
|
@ -75,7 +75,7 @@ LogicalView::LogicalView(TRI_vocbase_t& vocbase, VPackSlice const& definition, u
|
|||
}
|
||||
|
||||
Result LogicalView::appendVelocyPack(velocypack::Builder& builder,
|
||||
std::underlying_type<Serialize>::type flags) const {
|
||||
Serialization context) const {
|
||||
if (!builder.isOpenObject()) {
|
||||
return Result(TRI_ERROR_BAD_PARAMETER,
|
||||
std::string(
|
||||
|
@ -84,7 +84,7 @@ Result LogicalView::appendVelocyPack(velocypack::Builder& builder,
|
|||
|
||||
builder.add(StaticStrings::DataSourceType, arangodb::velocypack::Value(type().name()));
|
||||
|
||||
return appendVelocyPackImpl(builder, flags);
|
||||
return appendVelocyPackImpl(builder, context);
|
||||
}
|
||||
|
||||
bool LogicalView::canUse(arangodb::auth::Level const& level) {
|
||||
|
@ -260,9 +260,7 @@ Result LogicalView::rename(std::string&& newName) {
|
|||
|
||||
builder.openObject();
|
||||
// include links so that Agency will always have a full definition
|
||||
res = impl->properties(builder,
|
||||
LogicalDataSource::makeFlags(LogicalDataSource::Serialize::Detailed,
|
||||
LogicalDataSource::Serialize::ForPersistence));
|
||||
res = impl->properties(builder, LogicalDataSource::Serialization::Persistence);
|
||||
|
||||
if (!res.ok()) {
|
||||
return res;
|
||||
|
@ -343,10 +341,7 @@ Result LogicalView::rename(std::string&& newName) {
|
|||
|
||||
builder.openObject();
|
||||
|
||||
auto res =
|
||||
view.properties(builder,
|
||||
LogicalDataSource::makeFlags(LogicalDataSource::Serialize::Detailed,
|
||||
LogicalDataSource::Serialize::ForPersistence));
|
||||
auto res = view.properties(builder, LogicalDataSource::Serialization::Persistence);
|
||||
|
||||
if (!res.ok()) {
|
||||
return res;
|
||||
|
|
|
@ -106,7 +106,7 @@ class LogicalView : public LogicalDataSource {
|
|||
/// @brief queries properties of an existing view
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
virtual Result appendVelocyPack(velocypack::Builder& builder,
|
||||
std::underlying_type<Serialize>::type flags) const override final;
|
||||
Serialization context) const override final;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/// @return the current view is granted 'level' access
|
||||
|
@ -176,7 +176,7 @@ class LogicalView : public LogicalDataSource {
|
|||
/// @brief queries properties of an existing view
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
virtual Result appendVelocyPackImpl(velocypack::Builder& builder,
|
||||
std::underlying_type<Serialize>::type flags) const = 0;
|
||||
Serialization context) const = 0;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief drop implementation-specific parts of an existing view
|
||||
|
|
|
@ -594,9 +594,7 @@ Result Collections::properties(Context& ctxt, VPackBuilder& builder) {
|
|||
|
||||
// note that we have an ongoing transaction here if we are in single-server
|
||||
// case
|
||||
VPackBuilder props =
|
||||
coll->toVelocyPackIgnore(ignoreKeys, LogicalDataSource::makeFlags(
|
||||
LogicalDataSource::Serialize::Detailed));
|
||||
VPackBuilder props = coll->toVelocyPackIgnore(ignoreKeys, LogicalDataSource::Serialization::Properties);
|
||||
TRI_ASSERT(builder.isOpenObject());
|
||||
builder.add(VPackObjectIterator(props.slice()));
|
||||
|
||||
|
|
|
@ -127,8 +127,13 @@ arangodb::Result Indexes::getAll(LogicalCollection const* collection,
|
|||
VPackBuilder tmpInner;
|
||||
auto& ci = collection->vocbase().server().getFeature<ClusterFeature>().clusterInfo();
|
||||
auto c = ci.getCollection(databaseName, cid);
|
||||
c->getIndexesVPack(tmpInner, flags, [&](arangodb::Index const* idx) {
|
||||
return withHidden || !idx->isHidden();
|
||||
c->getIndexesVPack(tmpInner, [withHidden, flags](arangodb::Index const* idx, decltype(flags)& indexFlags) {
|
||||
if (withHidden || !idx->isHidden()) {
|
||||
indexFlags = flags;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
tmp.openArray();
|
||||
|
|
|
@ -943,17 +943,24 @@ void TRI_vocbase_t::inventory(VPackBuilder& result, TRI_voc_tick_t maxTick,
|
|||
// why are indexes added separately, when they are added by
|
||||
// collection->toVelocyPackIgnore !?
|
||||
result.add(VPackValue("indexes"));
|
||||
collection->getIndexesVPack(result, Index::makeFlags(), [](arangodb::Index const* idx) {
|
||||
// we have to exclude the primary, edge index and links for dump /
|
||||
// restore
|
||||
return (idx->type() != arangodb::Index::TRI_IDX_TYPE_PRIMARY_INDEX &&
|
||||
idx->type() != arangodb::Index::TRI_IDX_TYPE_EDGE_INDEX &&
|
||||
!idx->isHidden());
|
||||
collection->getIndexesVPack(result, [](arangodb::Index const* idx, decltype(Index::makeFlags())& flags) {
|
||||
// we have to exclude the primary and edge index for dump / restore
|
||||
switch (idx->type()) {
|
||||
case Index::TRI_IDX_TYPE_PRIMARY_INDEX:
|
||||
case Index::TRI_IDX_TYPE_EDGE_INDEX:
|
||||
return false;
|
||||
case Index::TRI_IDX_TYPE_IRESEARCH_LINK:
|
||||
flags = Index::makeFlags(Index::Serialize::Internals);
|
||||
return true;
|
||||
default:
|
||||
flags = Index::makeFlags(Index::Serialize::Basics);
|
||||
return !idx->isHidden();
|
||||
}
|
||||
});
|
||||
result.add("parameters", VPackValue(VPackValueType::Object));
|
||||
collection->toVelocyPackIgnore(
|
||||
result, {"objectId", "path", "statusString", "indexes"},
|
||||
LogicalDataSource::makeFlags(LogicalDataSource::Serialize::Detailed));
|
||||
LogicalDataSource::Serialization::Inventory);
|
||||
result.close();
|
||||
|
||||
result.close();
|
||||
|
@ -965,10 +972,7 @@ void TRI_vocbase_t::inventory(VPackBuilder& result, TRI_voc_tick_t maxTick,
|
|||
LogicalView::enumerate(*this, [&result](LogicalView::ptr const& view) -> bool {
|
||||
if (view) {
|
||||
result.openObject();
|
||||
view->properties(result, LogicalDataSource::makeFlags(
|
||||
LogicalDataSource::Serialize::Detailed));
|
||||
// details, !forPersistence because on restore any datasource ids will
|
||||
// differ, so need an end-user representation
|
||||
view->properties(result, LogicalDataSource::Serialization::Inventory);
|
||||
result.close();
|
||||
}
|
||||
|
||||
|
|
|
@ -913,10 +913,32 @@ arangodb::Result processInputDirectory(
|
|||
std::vector<std::unique_ptr<arangodb::RestoreFeature::JobData>> jobs;
|
||||
jobs.reserve(collections.size());
|
||||
|
||||
// Step 2: create views
|
||||
// @note: done after collection population since views might depend on data
|
||||
// in restored collections
|
||||
if (options.importStructure && !views.empty()) {
|
||||
LOG_TOPIC("f723c", INFO, Logger::RESTORE) << "# Creating views...";
|
||||
|
||||
for (auto const& viewDefinition : views) {
|
||||
LOG_TOPIC("c608d", DEBUG, Logger::RESTORE)
|
||||
<< "# Creating view: " << viewDefinition.toJson();
|
||||
|
||||
auto res = ::restoreView(httpClient, options, viewDefinition.slice());
|
||||
|
||||
if (!res.ok()) {
|
||||
return res;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool didModifyFoxxCollection = false;
|
||||
// Step 2: create collections
|
||||
// Step 3: create collections
|
||||
for (VPackBuilder const& b : collections) {
|
||||
VPackSlice const collection = b.slice();
|
||||
|
||||
LOG_TOPIC("c601a", DEBUG, Logger::RESTORE)
|
||||
<< "# Processing collection: " << collection.toJson();
|
||||
|
||||
VPackSlice params = collection.get("parameters");
|
||||
VPackSlice name = VPackSlice::emptyStringSlice();
|
||||
if (params.isObject()) {
|
||||
|
@ -1015,24 +1037,6 @@ arangodb::Result processInputDirectory(
|
|||
}
|
||||
}
|
||||
|
||||
// Step 5: create views
|
||||
// @note: done after collection population since views might depend on data
|
||||
// in restored collections
|
||||
if (options.importStructure && !views.empty()) {
|
||||
LOG_TOPIC("f723c", INFO, Logger::RESTORE) << "# Creating views...";
|
||||
|
||||
for (auto const& viewDefinition : views) {
|
||||
LOG_TOPIC("c608d", DEBUG, Logger::RESTORE)
|
||||
<< "# Creating view: " << viewDefinition.toJson();
|
||||
|
||||
auto res = ::restoreView(httpClient, options, viewDefinition.slice());
|
||||
|
||||
if (!res.ok()) {
|
||||
return res;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Last step: reload data into _users. Note: this can change the credentials
|
||||
// of the arangorestore user itself
|
||||
if (usersData) {
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
#include "SimpleHttpClient/SimpleHttpResult.h"
|
||||
#include "Ssl/SslInterface.h"
|
||||
#include "V8/v8-conv.h"
|
||||
#include "V8/v8-buffer.h"
|
||||
#include "V8/v8-utils.h"
|
||||
#include "V8/v8-vpack.h"
|
||||
|
||||
|
@ -1531,12 +1532,23 @@ v8::Local<v8::Value> V8ClientConnection::requestData(
|
|||
}
|
||||
req->header.contentType(fuerte::ContentType::Custom);
|
||||
req->addBinary(reinterpret_cast<uint8_t const*>(contents.data()), contents.length());
|
||||
} else if (body->IsString()) { // assume JSON
|
||||
} else if (body->IsString() || body->IsStringObject()) { // assume JSON
|
||||
TRI_Utf8ValueNFC bodyString(isolate, body);
|
||||
req->addBinary(reinterpret_cast<uint8_t const*>(*bodyString), bodyString.length());
|
||||
if (req->header.contentType() == fuerte::ContentType::Unset) {
|
||||
req->header.contentType(fuerte::ContentType::Json);
|
||||
}
|
||||
} else if (body->IsObject() && V8Buffer::hasInstance(isolate, body)) {
|
||||
// supplied body is a Buffer object
|
||||
char const* data = V8Buffer::data(isolate, body.As<v8::Object>());
|
||||
size_t size = V8Buffer::length(isolate, body.As<v8::Object>());
|
||||
|
||||
if (data == nullptr) {
|
||||
TRI_V8_SET_EXCEPTION_MESSAGE(TRI_ERROR_BAD_PARAMETER,
|
||||
"invalid <body> buffer value");
|
||||
return v8::Undefined(isolate);
|
||||
}
|
||||
req->addBinary(reinterpret_cast<uint8_t const*>(data), size);
|
||||
} else if (!body->IsNullOrUndefined()) {
|
||||
VPackBuffer<uint8_t> buffer;
|
||||
VPackBuilder builder(buffer, &_vpackOptions);
|
||||
|
@ -1599,12 +1611,23 @@ v8::Local<v8::Value> V8ClientConnection::requestDataRaw(
|
|||
for (auto& pair : headerFields) {
|
||||
req->header.addMeta(std::move(pair.first), std::move(pair.second));
|
||||
}
|
||||
if (body->IsString()) { // assume JSON
|
||||
if (body->IsString() || body->IsStringObject()) { // assume JSON
|
||||
TRI_Utf8ValueNFC bodyString(isolate, body);
|
||||
req->addBinary(reinterpret_cast<uint8_t const*>(*bodyString), bodyString.length());
|
||||
if (req->header.contentType() == fuerte::ContentType::Unset) {
|
||||
req->header.contentType(fuerte::ContentType::Json);
|
||||
}
|
||||
} else if (body->IsObject() && V8Buffer::hasInstance(isolate, body)) {
|
||||
// supplied body is a Buffer object
|
||||
char const* data = V8Buffer::data(isolate, body.As<v8::Object>());
|
||||
size_t size = V8Buffer::length(isolate, body.As<v8::Object>());
|
||||
|
||||
if (data == nullptr) {
|
||||
TRI_V8_SET_EXCEPTION_MESSAGE(TRI_ERROR_BAD_PARAMETER,
|
||||
"invalid <body> buffer value");
|
||||
return v8::Undefined(isolate);
|
||||
}
|
||||
req->addBinary(reinterpret_cast<uint8_t const*>(data), size);
|
||||
} else if (!body->IsNullOrUndefined()) {
|
||||
VPackBuffer<uint8_t> buffer;
|
||||
VPackBuilder builder(buffer);
|
||||
|
|
|
@ -128,7 +128,7 @@ class ReNormalizingAnalyzer : public irs::analysis::analyzer {
|
|||
_attrs.emplace(_attr);
|
||||
}
|
||||
|
||||
virtual irs::attribute_view const& attributes() const NOEXCEPT override {
|
||||
virtual irs::attribute_view const& attributes() const noexcept override {
|
||||
return _attrs;
|
||||
}
|
||||
|
||||
|
@ -189,7 +189,7 @@ class TestAnalyzer : public irs::analysis::analyzer {
|
|||
_attrs.emplace(_increment); // required by field_data::invert(...)
|
||||
}
|
||||
|
||||
virtual irs::attribute_view const& attributes() const NOEXCEPT override {
|
||||
virtual irs::attribute_view const& attributes() const noexcept override {
|
||||
return _attrs;
|
||||
}
|
||||
|
||||
|
@ -778,10 +778,10 @@ TEST_F(IResearchAnalyzerFeatureTest, test_get_parameter_match) {
|
|||
VPackParser::fromJson("\"abc\"")->slice(),
|
||||
{irs::frequency::type()});
|
||||
EXPECT_TRUE(res.ok());
|
||||
auto read = feature.get(analyzerName(), "identity",
|
||||
ASSERT_FALSE(feature.get(result,
|
||||
analyzerName(), "identity",
|
||||
VPackParser::fromJson("\"abc\"")->slice(),
|
||||
{irs::frequency::type()});
|
||||
ASSERT_EQ(read, nullptr);
|
||||
{irs::frequency::type()}).ok());
|
||||
}
|
||||
|
||||
TEST_F(IResearchAnalyzerFeatureTest, test_get_properties_mismatch) {
|
||||
|
@ -791,10 +791,9 @@ TEST_F(IResearchAnalyzerFeatureTest, test_get_properties_mismatch) {
|
|||
VPackParser::fromJson("\"abc\"")->slice(),
|
||||
{irs::frequency::type()});
|
||||
EXPECT_TRUE(res.ok());
|
||||
auto read = feature.get(analyzerName(), "TestAnalyzer",
|
||||
ASSERT_FALSE(feature.get(result, analyzerName(), "TestAnalyzer",
|
||||
VPackParser::fromJson("\"abcd\"")->slice(),
|
||||
{irs::frequency::type()});
|
||||
ASSERT_EQ(read, nullptr);
|
||||
{irs::frequency::type()}).ok());
|
||||
}
|
||||
|
||||
TEST_F(IResearchAnalyzerFeatureTest, test_get_feature_mismatch) {
|
||||
|
@ -804,10 +803,9 @@ TEST_F(IResearchAnalyzerFeatureTest, test_get_feature_mismatch) {
|
|||
VPackParser::fromJson("\"abc\"")->slice(),
|
||||
{irs::frequency::type()});
|
||||
EXPECT_TRUE(res.ok());
|
||||
auto read = feature.get(analyzerName(), "TestAnalyzer",
|
||||
ASSERT_FALSE(feature.get(result, analyzerName(), "TestAnalyzer",
|
||||
VPackParser::fromJson("\"abc\"")->slice(),
|
||||
{irs::position::type()});
|
||||
ASSERT_EQ(read, nullptr);
|
||||
{irs::position::type()}).ok());
|
||||
}
|
||||
|
||||
TEST_F(IResearchAnalyzerFeatureTest, test_renormalize_for_equal) {
|
||||
|
@ -1046,10 +1044,10 @@ TEST_F(IResearchAnalyzerFeatureGetTest, test_get_static_analyzer_adding_vocbases
|
|||
}
|
||||
|
||||
TEST_F(IResearchAnalyzerFeatureGetTest, test_get_failure_specfic_type_and_properties_mismatch) {
|
||||
auto pool = feature().get(specificName(), "TestAnalyzer",
|
||||
arangodb::iresearch::IResearchAnalyzerFeature::EmplaceResult result;
|
||||
ASSERT_FALSE(feature().get(result, specificName(), "TestAnalyzer",
|
||||
VPackParser::fromJson("{\"args\":\"abc\"}")->slice(),
|
||||
{irs::frequency::type()});
|
||||
ASSERT_EQ(pool, nullptr);
|
||||
{irs::frequency::type()}).ok());
|
||||
}
|
||||
|
||||
TEST_F(IResearchAnalyzerFeatureGetTest, test_get_db_server) {
|
||||
|
@ -1059,11 +1057,12 @@ TEST_F(IResearchAnalyzerFeatureGetTest, test_get_db_server) {
|
|||
arangodb::ServerState::instance()->setRole(before);
|
||||
});
|
||||
|
||||
arangodb::iresearch::IResearchAnalyzerFeature::EmplaceResult result;
|
||||
arangodb::iresearch::IResearchAnalyzerFeature feature(server.server());
|
||||
EXPECT_TRUE(
|
||||
(false == !feature.get("testVocbase::test_analyzer", "TestAnalyzer",
|
||||
VPackParser::fromJson("\"abc\"")->slice(),
|
||||
{irs::frequency::type()})));
|
||||
ASSERT_TRUE(feature.get(result,"testVocbase::test_analyzer", "TestAnalyzer",
|
||||
VPackParser::fromJson("\"abc\"")->slice(),
|
||||
{irs::frequency::type()}).ok());
|
||||
ASSERT_NE(nullptr, result.first);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
@ -1151,9 +1150,10 @@ TEST_F(IResearchAnalyzerFeatureCoordinatorTest, test_ensure_index_add_factory) {
|
|||
auto& feature =
|
||||
collection.vocbase().server().getFeature<arangodb::iresearch::IResearchAnalyzerFeature>();
|
||||
ci.invalidatePlan(); // invalidate plan to test recursive lock aquisition in ClusterInfo::loadPlan()
|
||||
EXPECT_EQ(nullptr, feature.get(arangodb::StaticStrings::SystemDatabase + "::missing",
|
||||
"TestAnalyzer", VPackSlice::noneSlice(),
|
||||
irs::flags()));
|
||||
arangodb::iresearch::IResearchAnalyzerFeature::EmplaceResult result;
|
||||
EXPECT_FALSE(feature.get(result, arangodb::StaticStrings::SystemDatabase + "::missing",
|
||||
"TestAnalyzer", VPackSlice::noneSlice(),
|
||||
irs::flags()).ok());
|
||||
return std::make_shared<TestIndex>(id, collection, definition);
|
||||
}
|
||||
|
||||
|
@ -1578,7 +1578,7 @@ TEST_F(IResearchAnalyzerFeatureTest, test_persistence_invalid_missing_attributes
|
|||
feature.start(); // load persisted analyzers
|
||||
|
||||
feature.visit(
|
||||
[&expected](arangodb::iresearch::IResearchAnalyzerFeature::AnalyzerPool::ptr const& analyzer) -> bool {
|
||||
[&expected](arangodb::iresearch::AnalyzerPool::ptr const& analyzer) -> bool {
|
||||
if (staticAnalyzers().find(analyzer->name()) != staticAnalyzers().end()) {
|
||||
return true; // skip static analyzers
|
||||
}
|
||||
|
@ -1700,7 +1700,7 @@ TEST_F(IResearchAnalyzerFeatureTest, test_persistence_valid_different_parameters
|
|||
feature.start(); // load persisted analyzers
|
||||
|
||||
feature.visit(
|
||||
[&expected](arangodb::iresearch::IResearchAnalyzerFeature::AnalyzerPool::ptr const& analyzer) -> bool {
|
||||
[&expected](arangodb::iresearch::AnalyzerPool::ptr const& analyzer) -> bool {
|
||||
if (staticAnalyzers().find(analyzer->name()) != staticAnalyzers().end()) {
|
||||
return true; // skip static analyzers
|
||||
}
|
||||
|
@ -1758,7 +1758,7 @@ TEST_F(IResearchAnalyzerFeatureTest, test_persistence_add_new_records) {
|
|||
feature.start(); // load persisted analyzers
|
||||
|
||||
feature.visit(
|
||||
[&expected](arangodb::iresearch::IResearchAnalyzerFeature::AnalyzerPool::ptr const& analyzer) -> bool {
|
||||
[&expected](arangodb::iresearch::AnalyzerPool::ptr const& analyzer) -> bool {
|
||||
if (staticAnalyzers().find(analyzer->name()) != staticAnalyzers().end()) {
|
||||
return true; // skip static analyzers
|
||||
}
|
||||
|
@ -1860,7 +1860,7 @@ TEST_F(IResearchAnalyzerFeatureTest, test_persistence_remove_existing_records) {
|
|||
feature.prepare(); // load static analyzers
|
||||
feature.start(); // load persisted analyzers
|
||||
|
||||
feature.visit([&expected](arangodb::iresearch::IResearchAnalyzerFeature::AnalyzerPool::ptr const& analyzer) -> bool {
|
||||
feature.visit([&expected](arangodb::iresearch::AnalyzerPool::ptr const& analyzer) -> bool {
|
||||
if ((analyzer->name() != "identity" &&
|
||||
!irs::starts_with(irs::string_ref(analyzer->name()), "text_")) &&
|
||||
staticAnalyzers().find(analyzer->name()) != staticAnalyzers().end()) {
|
||||
|
@ -1901,7 +1901,7 @@ TEST_F(IResearchAnalyzerFeatureTest, test_persistence_remove_existing_records) {
|
|||
feature.start(); // load persisted analyzers
|
||||
|
||||
feature.visit(
|
||||
[&expected](arangodb::iresearch::IResearchAnalyzerFeature::AnalyzerPool::ptr const& analyzer) -> bool {
|
||||
[&expected](arangodb::iresearch::AnalyzerPool::ptr const& analyzer) -> bool {
|
||||
if (staticAnalyzers().find(analyzer->name()) != staticAnalyzers().end()) {
|
||||
return true; // skip static analyzers
|
||||
}
|
||||
|
@ -2254,7 +2254,7 @@ TEST_F(IResearchAnalyzerFeatureTest, test_prepare) {
|
|||
// check static analyzers
|
||||
auto expected = staticAnalyzers();
|
||||
feature.visit([&expected, &feature](
|
||||
arangodb::iresearch::IResearchAnalyzerFeature::AnalyzerPool::ptr const& analyzer) -> bool {
|
||||
arangodb::iresearch::AnalyzerPool::ptr const& analyzer) -> bool {
|
||||
auto itr = expected.find(analyzer->name());
|
||||
EXPECT_NE(itr, expected.end());
|
||||
EXPECT_EQ(itr->second.type, analyzer->type());
|
||||
|
@ -2308,7 +2308,7 @@ TEST_F(IResearchAnalyzerFeatureTest, test_start) {
|
|||
|
||||
feature.visit(
|
||||
[&expected, &feature](
|
||||
arangodb::iresearch::IResearchAnalyzerFeature::AnalyzerPool::ptr const& analyzer) -> bool {
|
||||
arangodb::iresearch::AnalyzerPool::ptr const& analyzer) -> bool {
|
||||
auto itr = expected.find(analyzer->name());
|
||||
EXPECT_NE(itr, expected.end());
|
||||
EXPECT_EQ(itr->second.type, analyzer->type());
|
||||
|
@ -2373,7 +2373,7 @@ TEST_F(IResearchAnalyzerFeatureTest, test_start) {
|
|||
std::forward_as_tuple("identity", "\"abc\""));
|
||||
feature.visit(
|
||||
[&expected, &feature](
|
||||
arangodb::iresearch::IResearchAnalyzerFeature::AnalyzerPool::ptr const& analyzer) -> bool {
|
||||
arangodb::iresearch::AnalyzerPool::ptr const& analyzer) -> bool {
|
||||
auto itr = expected.find(analyzer->name());
|
||||
EXPECT_NE(itr, expected.end());
|
||||
EXPECT_EQ(itr->second.type, analyzer->type());
|
||||
|
@ -2417,7 +2417,7 @@ TEST_F(IResearchAnalyzerFeatureTest, test_start) {
|
|||
|
||||
feature.visit(
|
||||
[&expected, &feature](
|
||||
arangodb::iresearch::IResearchAnalyzerFeature::AnalyzerPool::ptr const& analyzer) -> bool {
|
||||
arangodb::iresearch::AnalyzerPool::ptr const& analyzer) -> bool {
|
||||
auto itr = expected.find(analyzer->name());
|
||||
EXPECT_NE(itr, expected.end());
|
||||
EXPECT_EQ(itr->second.type, analyzer->type());
|
||||
|
@ -2478,7 +2478,7 @@ TEST_F(IResearchAnalyzerFeatureTest, test_start) {
|
|||
std::forward_as_tuple("identity", "{}"));
|
||||
feature.visit(
|
||||
[&expected, &feature](
|
||||
arangodb::iresearch::IResearchAnalyzerFeature::AnalyzerPool::ptr const& analyzer) -> bool {
|
||||
arangodb::iresearch::AnalyzerPool::ptr const& analyzer) -> bool {
|
||||
auto itr = expected.find(analyzer->name());
|
||||
EXPECT_NE(itr, expected.end());
|
||||
EXPECT_EQ(itr->second.type, analyzer->type());
|
||||
|
@ -3451,7 +3451,7 @@ TEST_F(IResearchAnalyzerFeatureTest, test_visit) {
|
|||
};
|
||||
auto expectedSet = makeVPackPropExpectedSet(expected);
|
||||
auto result = feature.visit(
|
||||
[&expectedSet](arangodb::iresearch::IResearchAnalyzerFeature::AnalyzerPool::ptr const& analyzer) -> bool {
|
||||
[&expectedSet](arangodb::iresearch::AnalyzerPool::ptr const& analyzer) -> bool {
|
||||
if (staticAnalyzers().find(analyzer->name()) != staticAnalyzers().end()) {
|
||||
return true; // skip static analyzers
|
||||
}
|
||||
|
@ -3485,7 +3485,7 @@ TEST_F(IResearchAnalyzerFeatureTest, test_visit) {
|
|||
};
|
||||
auto expectedSet = makeVPackPropExpectedSet(expected);
|
||||
auto result = feature.visit(
|
||||
[&expectedSet](arangodb::iresearch::IResearchAnalyzerFeature::AnalyzerPool::ptr const& analyzer) -> bool {
|
||||
[&expectedSet](arangodb::iresearch::AnalyzerPool::ptr const& analyzer) -> bool {
|
||||
if (staticAnalyzers().find(analyzer->name()) != staticAnalyzers().end()) {
|
||||
return true; // skip static analyzers
|
||||
}
|
||||
|
@ -3534,7 +3534,7 @@ TEST_F(IResearchAnalyzerFeatureTest, test_visit) {
|
|||
{
|
||||
std::set<ExpectedType> expected = {};
|
||||
auto result = feature.visit(
|
||||
[&expected](arangodb::iresearch::IResearchAnalyzerFeature::AnalyzerPool::ptr const& analyzer) -> bool {
|
||||
[&expected](arangodb::iresearch::AnalyzerPool::ptr const& analyzer) -> bool {
|
||||
EXPECT_EQ(analyzer->type(), "TestAnalyzer");
|
||||
EXPECT_EQ(1, expected.erase(
|
||||
ExpectedType(analyzer->name(),
|
||||
|
@ -3555,7 +3555,7 @@ TEST_F(IResearchAnalyzerFeatureTest, test_visit) {
|
|||
};
|
||||
auto expectedSet = makeVPackPropExpectedSet(expected);
|
||||
auto result = feature.visit(
|
||||
[&expectedSet](arangodb::iresearch::IResearchAnalyzerFeature::AnalyzerPool::ptr const& analyzer) -> bool {
|
||||
[&expectedSet](arangodb::iresearch::AnalyzerPool::ptr const& analyzer) -> bool {
|
||||
EXPECT_EQ(analyzer->type(), "TestAnalyzer");
|
||||
EXPECT_EQ(1, expectedSet.erase(
|
||||
ExpectedType(analyzer->name(),
|
||||
|
@ -3641,7 +3641,7 @@ TEST_F(IResearchAnalyzerFeatureTest, test_visit) {
|
|||
ASSERT_EQ(expected.size(), expectedSet.size());
|
||||
|
||||
auto result = feature.visit(
|
||||
[&expectedSet](arangodb::iresearch::IResearchAnalyzerFeature::AnalyzerPool::ptr const& analyzer) -> bool {
|
||||
[&expectedSet](arangodb::iresearch::AnalyzerPool::ptr const& analyzer) -> bool {
|
||||
EXPECT_EQ(1, expectedSet.erase(
|
||||
ExpectedType(analyzer->name(),
|
||||
arangodb::iresearch::ref<char>(analyzer->properties()),
|
||||
|
@ -3654,6 +3654,106 @@ TEST_F(IResearchAnalyzerFeatureTest, test_visit) {
|
|||
}
|
||||
}
|
||||
|
||||
TEST_F(IResearchAnalyzerFeatureTest, custom_analyzers_toVelocyPack) {
|
||||
// create a new instance of an ApplicationServer and fill it with the required features
|
||||
// cannot use the existing server since its features already have some state
|
||||
arangodb::application_features::ApplicationServer newServer(nullptr, nullptr);
|
||||
arangodb::iresearch::IResearchAnalyzerFeature feature(newServer);
|
||||
auto& dbFeature = newServer.addFeature<arangodb::DatabaseFeature>(); // required for IResearchAnalyzerFeature::emplace(...)
|
||||
newServer.addFeature<arangodb::QueryRegistryFeature>(); // required for constructing TRI_vocbase_t
|
||||
auto& sysDatabase = newServer.addFeature<arangodb::SystemDatabaseFeature>(); // required for IResearchAnalyzerFeature::start()
|
||||
newServer.addFeature<arangodb::V8DealerFeature>(); // required for DatabaseFeature::createDatabase>(std::make_unique<arangodb::V8DealerFeature(server)); // required for DatabaseFeature::createDatabase>(...)
|
||||
auto cleanup = arangodb::scopeGuard([&dbFeature]() { dbFeature.unprepare(); });
|
||||
|
||||
// create system vocbase (before feature start)
|
||||
{
|
||||
auto databases = VPackBuilder();
|
||||
databases.openArray();
|
||||
databases.add(systemDatabaseArgs);
|
||||
databases.close();
|
||||
EXPECT_EQ(TRI_ERROR_NO_ERROR, dbFeature.loadDatabases(databases.slice()));
|
||||
sysDatabase.start(); // get system database from DatabaseFeature
|
||||
auto vocbase = dbFeature.useDatabase(arangodb::StaticStrings::SystemDatabase);
|
||||
arangodb::methods::Collections::createSystem(*vocbase, arangodb::tests::AnalyzerCollectionName, false);
|
||||
}
|
||||
|
||||
arangodb::iresearch::IResearchAnalyzerFeature::EmplaceResult result;
|
||||
auto vpack = VPackParser::fromJson(
|
||||
"{\"locale\":\"ru_RU.utf-8\",\"case\":\"upper\",\"accent\":true}");
|
||||
EXPECT_TRUE(feature.emplace(result,
|
||||
arangodb::StaticStrings::SystemDatabase + "::test_norm_analyzer4",
|
||||
"norm", vpack->slice()).ok());
|
||||
EXPECT_TRUE(result.first);
|
||||
EXPECT_EQUAL_SLICES(vpack->slice(), result.first->properties());
|
||||
|
||||
// for persistence
|
||||
{
|
||||
auto expectedVpack = VPackParser::fromJson(
|
||||
"{ \"name\": \"test_norm_analyzer4\", \"type\": \"norm\", "
|
||||
"\"properties\":{\"locale\":\"ru_RU.utf-8\",\"case\":\"upper\",\"accent\":true}, "
|
||||
"\"features\": [] }");
|
||||
|
||||
VPackBuilder builder;
|
||||
result.first->toVelocyPack(builder, true);
|
||||
EXPECT_EQUAL_SLICES(expectedVpack->slice(), builder.slice());
|
||||
}
|
||||
|
||||
// not for persistence
|
||||
{
|
||||
auto expectedVpack = VPackParser::fromJson(
|
||||
"{ \"name\": \"" + arangodb::StaticStrings::SystemDatabase + "::test_norm_analyzer4\", "
|
||||
"\"type\": \"norm\", "
|
||||
"\"properties\":{\"locale\":\"ru_RU.utf-8\",\"case\":\"upper\",\"accent\":true}, "
|
||||
"\"features\": [] }");
|
||||
|
||||
VPackBuilder builder;
|
||||
result.first->toVelocyPack(builder, false);
|
||||
EXPECT_EQUAL_SLICES(expectedVpack->slice(), builder.slice());
|
||||
}
|
||||
|
||||
// for definition (same database)
|
||||
{
|
||||
auto expectedVpack = VPackParser::fromJson(
|
||||
"{ \"name\": \"test_norm_analyzer4\", "
|
||||
"\"type\": \"norm\", "
|
||||
"\"properties\":{\"locale\":\"ru_RU.utf-8\",\"case\":\"upper\",\"accent\":true}, "
|
||||
"\"features\": [] }");
|
||||
|
||||
VPackBuilder builder;
|
||||
result.first->toVelocyPack(builder, sysDatabase.use().get());
|
||||
EXPECT_EQUAL_SLICES(expectedVpack->slice(), builder.slice());
|
||||
}
|
||||
|
||||
// for definition (different database)
|
||||
{
|
||||
TRI_vocbase_t* vocbase;
|
||||
EXPECT_TRUE(dbFeature.createDatabase(createInfo(server.server(), "vocbase0", 1), vocbase).ok());
|
||||
|
||||
auto expectedVpack = VPackParser::fromJson(
|
||||
"{ \"name\": \"::test_norm_analyzer4\", "
|
||||
"\"type\": \"norm\", "
|
||||
"\"properties\":{\"locale\":\"ru_RU.utf-8\",\"case\":\"upper\",\"accent\":true}, "
|
||||
"\"features\": [] }");
|
||||
|
||||
VPackBuilder builder;
|
||||
result.first->toVelocyPack(builder, vocbase);
|
||||
EXPECT_EQUAL_SLICES(expectedVpack->slice(), builder.slice());
|
||||
}
|
||||
|
||||
// for definition (without database)
|
||||
{
|
||||
auto expectedVpack = VPackParser::fromJson(
|
||||
"{ \"name\": \"" + arangodb::StaticStrings::SystemDatabase + "::test_norm_analyzer4\", "
|
||||
"\"type\": \"norm\", "
|
||||
"\"properties\":{\"locale\":\"ru_RU.utf-8\",\"case\":\"upper\",\"accent\":true}, "
|
||||
"\"features\": [] }");
|
||||
|
||||
VPackBuilder builder;
|
||||
result.first->toVelocyPack(builder, nullptr);
|
||||
EXPECT_EQUAL_SLICES(expectedVpack->slice(), builder.slice());
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(IResearchAnalyzerFeatureTest, custom_analyzers_vpack_create) {
|
||||
// create a new instance of an ApplicationServer and fill it with the required features
|
||||
// cannot use the existing server since its features already have some state
|
||||
|
@ -3940,10 +4040,9 @@ TEST_F(IResearchAnalyzerFeatureTest, custom_analyzers_vpack_create) {
|
|||
arangodb::iresearch::IResearchAnalyzerFeature::EmplaceResult result;
|
||||
auto vpack = VPackParser::fromJson(
|
||||
"{\"locale\":\"ru_RU.utf-8\",\"case\":\"upper\",\"accent\":true}");
|
||||
EXPECT_TRUE(feature
|
||||
.emplace(result, arangodb::StaticStrings::SystemDatabase + "::test_norm_analyzer4",
|
||||
"norm", vpack->slice())
|
||||
.ok());
|
||||
EXPECT_TRUE(feature.emplace(result,
|
||||
arangodb::StaticStrings::SystemDatabase + "::test_norm_analyzer4",
|
||||
"norm", vpack->slice()).ok());
|
||||
EXPECT_TRUE(result.first);
|
||||
EXPECT_EQUAL_SLICES(vpack->slice(), result.first->properties());
|
||||
}
|
||||
|
|
|
@ -234,11 +234,7 @@ TEST_F(IResearchFeatureTest, test_upgrade0_1_no_directory) {
|
|||
EXPECT_TRUE(viewDataPath.exists(result) && !result); // ensure no view directory
|
||||
arangodb::velocypack::Builder builder;
|
||||
builder.openObject();
|
||||
EXPECT_TRUE((logicalView0
|
||||
->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed,
|
||||
arangodb::LogicalDataSource::Serialize::ForPersistence))
|
||||
.ok()));
|
||||
EXPECT_TRUE(logicalView0->properties(builder, arangodb::LogicalDataSource::Serialization::Persistence).ok());
|
||||
builder.close();
|
||||
EXPECT_EQ(0, builder.slice().get("version").getNumber<uint32_t>()); // ensure 'version == 0 before upgrade
|
||||
|
||||
|
@ -256,11 +252,7 @@ TEST_F(IResearchFeatureTest, test_upgrade0_1_no_directory) {
|
|||
EXPECT_TRUE(viewDataPath.exists(result) && !result); // ensure view directory not created
|
||||
builder.clear();
|
||||
builder.openObject();
|
||||
EXPECT_TRUE((logicalView1
|
||||
->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed,
|
||||
arangodb::LogicalDataSource::Serialize::ForPersistence))
|
||||
.ok()));
|
||||
EXPECT_TRUE(logicalView1->properties(builder, arangodb::LogicalDataSource::Serialization::Persistence).ok());
|
||||
builder.close();
|
||||
EXPECT_EQ(1, builder.slice().get("version").getNumber<uint32_t>()); // ensure 'version == 1 after upgrade
|
||||
}
|
||||
|
@ -321,11 +313,7 @@ TEST_F(IResearchFeatureTest, test_upgrade0_1_with_directory) {
|
|||
EXPECT_TRUE(viewDataPath.exists(result) && result);
|
||||
arangodb::velocypack::Builder builder;
|
||||
builder.openObject();
|
||||
EXPECT_TRUE((logicalView0
|
||||
->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed,
|
||||
arangodb::LogicalDataSource::Serialize::ForPersistence))
|
||||
.ok()));
|
||||
EXPECT_TRUE(logicalView0->properties(builder, arangodb::LogicalDataSource::Serialization::Persistence).ok());
|
||||
builder.close();
|
||||
EXPECT_EQ(0, builder.slice().get("version").getNumber<uint32_t>()); // ensure 'version == 0 before upgrade
|
||||
|
||||
|
@ -343,11 +331,7 @@ TEST_F(IResearchFeatureTest, test_upgrade0_1_with_directory) {
|
|||
EXPECT_TRUE(viewDataPath.exists(result) && !result); // ensure view directory not created
|
||||
builder.clear();
|
||||
builder.openObject();
|
||||
EXPECT_TRUE((logicalView1
|
||||
->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed,
|
||||
arangodb::LogicalDataSource::Serialize::ForPersistence))
|
||||
.ok()));
|
||||
EXPECT_TRUE(logicalView1->properties(builder, arangodb::LogicalDataSource::Serialization::Persistence).ok());
|
||||
builder.close();
|
||||
EXPECT_EQ(1, builder.slice().get("version").getNumber<uint32_t>()); // ensure 'version == 1 after upgrade
|
||||
}
|
||||
|
@ -843,11 +827,7 @@ TEST_F(IResearchFeatureTestCoordinator, test_upgrade0_1) {
|
|||
|
||||
arangodb::velocypack::Builder builder;
|
||||
builder.openObject();
|
||||
EXPECT_TRUE((logicalView0
|
||||
->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed,
|
||||
arangodb::LogicalDataSource::Serialize::ForPersistence))
|
||||
.ok()));
|
||||
EXPECT_TRUE(logicalView0->properties(builder, arangodb::LogicalDataSource::Serialization::Persistence).ok());
|
||||
builder.close();
|
||||
EXPECT_EQ(0, builder.slice().get("version").getNumber<uint32_t>()); // ensure 'version == 0 before upgrade
|
||||
|
||||
|
@ -872,11 +852,7 @@ TEST_F(IResearchFeatureTestCoordinator, test_upgrade0_1) {
|
|||
EXPECT_EQ(link0->id(), link1->id()); // ensure new link
|
||||
builder.clear();
|
||||
builder.openObject();
|
||||
EXPECT_TRUE((logicalView1
|
||||
->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed,
|
||||
arangodb::LogicalDataSource::Serialize::ForPersistence))
|
||||
.ok()));
|
||||
EXPECT_TRUE(logicalView1->properties(builder, arangodb::LogicalDataSource::Serialization::Persistence).ok());
|
||||
builder.close();
|
||||
EXPECT_EQ(0, builder.slice().get("version").getNumber<uint32_t>()); // ensure 'version == 0 after upgrade
|
||||
}
|
||||
|
@ -1015,11 +991,7 @@ TEST_F(IResearchFeatureTestDBServer, test_upgrade0_1_no_directory) {
|
|||
EXPECT_TRUE(viewDataPath.exists(result) && !result); // ensure no view directory
|
||||
arangodb::velocypack::Builder builder;
|
||||
builder.openObject();
|
||||
EXPECT_TRUE((logicalView
|
||||
->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed,
|
||||
arangodb::LogicalDataSource::Serialize::ForPersistence))
|
||||
.ok()));
|
||||
EXPECT_TRUE(logicalView->properties(builder, arangodb::LogicalDataSource::Serialization::Persistence).ok());
|
||||
builder.close();
|
||||
EXPECT_EQ(0, builder.slice().get("version").getNumber<uint32_t>()); // ensure 'version == 0 before upgrade
|
||||
|
||||
|
@ -1091,11 +1063,7 @@ TEST_F(IResearchFeatureTestDBServer, test_upgrade0_1_with_directory) {
|
|||
EXPECT_TRUE(viewDataPath.exists(result) && result);
|
||||
arangodb::velocypack::Builder builder;
|
||||
builder.openObject();
|
||||
EXPECT_TRUE((logicalView
|
||||
->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed,
|
||||
arangodb::LogicalDataSource::Serialize::ForPersistence))
|
||||
.ok()));
|
||||
EXPECT_TRUE(logicalView->properties(builder, arangodb::LogicalDataSource::Serialization::Persistence).ok());
|
||||
builder.close();
|
||||
EXPECT_EQ(0, builder.slice().get("version").getNumber<uint32_t>()); // ensure 'version == 0 before upgrade
|
||||
|
||||
|
|
|
@ -240,9 +240,8 @@ TEST_F(IResearchLinkHelperTestSingle, test_normalize) {
|
|||
}");
|
||||
arangodb::velocypack::Builder builder;
|
||||
builder.openObject();
|
||||
EXPECT_TRUE((false == arangodb::iresearch::IResearchLinkHelper::normalize(
|
||||
builder, json->slice(), false, sysVocbase)
|
||||
.ok()));
|
||||
EXPECT_TRUE(arangodb::iresearch::IResearchLinkHelper::normalize(
|
||||
builder, json->slice(), false, sysVocbase).ok());
|
||||
EXPECT_FALSE(analyzers.get(arangodb::StaticStrings::SystemDatabase + "::testAnalyzer1"));
|
||||
}
|
||||
|
||||
|
|
|
@ -973,9 +973,9 @@ TEST_F(IResearchLinkMetaTest, test_writeCustomizedValues) {
|
|||
std::unordered_set<std::string> expectedOverrides = {"default", "all",
|
||||
"some", "none"};
|
||||
std::unordered_set<std::string> expectedAnalyzers = {
|
||||
arangodb::StaticStrings::SystemDatabase + "::empty", "identity"};
|
||||
"::empty", "identity"};
|
||||
std::set<std::pair<std::string, std::string>> expectedAnalyzerDefinitions = {
|
||||
{arangodb::StaticStrings::SystemDatabase + "::empty", VPackParser::fromJson("{\"args\":\"en\"}")->slice().toString()},
|
||||
{"::empty", VPackParser::fromJson("{\"args\":\"en\"}")->slice().toString()},
|
||||
{"identity", VPackSlice::emptyObjectSlice().toString()},
|
||||
};
|
||||
TRI_vocbase_t vocbase(TRI_vocbase_type_e::TRI_VOCBASE_TYPE_NORMAL, testDBInfo(server.server()));
|
||||
|
@ -1045,8 +1045,7 @@ TEST_F(IResearchLinkMetaTest, test_writeCustomizedValues) {
|
|||
tmpSlice = sliceOverride.get("analyzers");
|
||||
EXPECT_TRUE((true == tmpSlice.isArray() && 1 == tmpSlice.length() &&
|
||||
tmpSlice.at(0).isString() &&
|
||||
arangodb::StaticStrings::SystemDatabase + "::empty" ==
|
||||
tmpSlice.at(0).copyString()));
|
||||
"::empty" == tmpSlice.at(0).copyString()));
|
||||
} else if ("some" == fieldOverride.copyString()) {
|
||||
EXPECT_EQ(2U, sliceOverride.length());
|
||||
tmpSlice = sliceOverride.get("trackListPositions");
|
||||
|
@ -1252,7 +1251,7 @@ TEST_F(IResearchLinkMetaTest, test_readAnalyzerDefinitions) {
|
|||
arangodb::iresearch::IResearchLinkMeta meta;
|
||||
std::string errorField;
|
||||
EXPECT_FALSE(meta.init(json->slice(), true, errorField, &vocbase));
|
||||
EXPECT_EQ(std::string("analyzers=>empty1"), errorField);
|
||||
EXPECT_EQ(std::string("analyzers.empty1"), errorField);
|
||||
}
|
||||
|
||||
// missing analyzer (name only) inRecovery
|
||||
|
@ -1268,7 +1267,7 @@ TEST_F(IResearchLinkMetaTest, test_readAnalyzerDefinitions) {
|
|||
arangodb::iresearch::IResearchLinkMeta meta;
|
||||
std::string errorField;
|
||||
EXPECT_FALSE(meta.init(json->slice(), true, errorField, &vocbase));
|
||||
EXPECT_EQ(std::string("analyzers=>empty1"), errorField);
|
||||
EXPECT_EQ(std::string("analyzers.empty1"), errorField);
|
||||
}
|
||||
|
||||
// missing analyzer (full) no name (fail) required
|
||||
|
@ -1281,7 +1280,7 @@ TEST_F(IResearchLinkMetaTest, test_readAnalyzerDefinitions) {
|
|||
arangodb::iresearch::IResearchLinkMeta meta;
|
||||
std::string errorField;
|
||||
EXPECT_FALSE(meta.init(json->slice(), true, errorField, &vocbase));
|
||||
EXPECT_EQ(std::string("analyzerDefinitions=>[0]=>name"), errorField);
|
||||
EXPECT_EQ(std::string("analyzerDefinitions[0].name"), errorField);
|
||||
}
|
||||
|
||||
// missing analyzer (full) no type (fail) required
|
||||
|
@ -1294,20 +1293,7 @@ TEST_F(IResearchLinkMetaTest, test_readAnalyzerDefinitions) {
|
|||
arangodb::iresearch::IResearchLinkMeta meta;
|
||||
std::string errorField;
|
||||
EXPECT_FALSE(meta.init(json->slice(), true, errorField, &vocbase));
|
||||
EXPECT_EQ(std::string("analyzerDefinitions=>[0]=>type"), errorField);
|
||||
}
|
||||
|
||||
// missing analyzer (full) analyzer creation not allowed (fail)
|
||||
{
|
||||
auto json = VPackParser::fromJson(
|
||||
"{ \
|
||||
\"analyzerDefinitions\": [ { \"name\": \"missing0\", \"type\": \"empty\", \"properties\": {\"args\":\"ru\"}, \"features\": [ \"frequency\" ] } ], \
|
||||
\"analyzers\": [ \"missing0\" ] \
|
||||
}");
|
||||
arangodb::iresearch::IResearchLinkMeta meta;
|
||||
std::string errorField;
|
||||
EXPECT_FALSE(meta.init(json->slice(), true, errorField, &vocbase));
|
||||
EXPECT_EQ(std::string("analyzerDefinitions=>[0]") ,errorField);
|
||||
EXPECT_EQ(std::string("analyzerDefinitions[0].type"), errorField);
|
||||
}
|
||||
|
||||
// missing analyzer (full) single-server
|
||||
|
@ -1319,8 +1305,15 @@ TEST_F(IResearchLinkMetaTest, test_readAnalyzerDefinitions) {
|
|||
}");
|
||||
arangodb::iresearch::IResearchLinkMeta meta;
|
||||
std::string errorField;
|
||||
EXPECT_FALSE(meta.init(json->slice(), true, errorField, &vocbase));
|
||||
EXPECT_EQ(std::string("analyzerDefinitions=>[0]"), errorField);
|
||||
EXPECT_TRUE(meta.init(json->slice(), true, errorField, &vocbase));
|
||||
EXPECT_EQ(1, meta._analyzers.size());
|
||||
EXPECT_EQ(std::string("testVocbase::missing0"), meta._analyzers[0]._pool->name());
|
||||
EXPECT_EQ(std::string("empty"), meta._analyzers[0]._pool->type());
|
||||
EXPECT_EQUAL_SLICES(VPackParser::fromJson("{\"args\" : \"ru\"}")->slice(),
|
||||
meta._analyzers[0]._pool->properties());
|
||||
EXPECT_EQ(1, meta._analyzers[0]._pool->features().size());
|
||||
EXPECT_TRUE(meta._analyzers[0]._pool->features().check(irs::frequency::type()));
|
||||
EXPECT_EQ(std::string("missing0"), meta._analyzers[0]._shortName);
|
||||
}
|
||||
|
||||
// missing analyzer (full) coordinator
|
||||
|
@ -1339,7 +1332,7 @@ TEST_F(IResearchLinkMetaTest, test_readAnalyzerDefinitions) {
|
|||
arangodb::iresearch::IResearchLinkMeta meta;
|
||||
std::string errorField;
|
||||
EXPECT_FALSE(meta.init(json->slice(), true, errorField, &vocbase));
|
||||
EXPECT_EQ(std::string("analyzerDefinitions=>[0]"), errorField);
|
||||
EXPECT_EQ(std::string("analyzerDefinitions[0]"), errorField);
|
||||
}
|
||||
|
||||
// missing analyzer (full) db-server
|
||||
|
@ -1383,7 +1376,7 @@ TEST_F(IResearchLinkMetaTest, test_readAnalyzerDefinitions) {
|
|||
arangodb::iresearch::IResearchLinkMeta meta;
|
||||
std::string errorField;
|
||||
EXPECT_FALSE(meta.init(json->slice(), true, errorField, &vocbase));
|
||||
EXPECT_EQ(std::string("analyzers=>missing3"), errorField); // not in the persisted collection
|
||||
EXPECT_EQ(std::string("analyzers.missing3"), errorField); // not in the persisted collection
|
||||
}
|
||||
|
||||
// existing analyzer (name only)
|
||||
|
@ -1461,7 +1454,7 @@ TEST_F(IResearchLinkMetaTest, test_readAnalyzerDefinitions) {
|
|||
arangodb::iresearch::IResearchLinkMeta meta;
|
||||
std::string errorField;
|
||||
EXPECT_FALSE(meta.init(json->slice(), false, errorField, &vocbase));
|
||||
EXPECT_EQ(std::string("analyzers=>[0]"), errorField);
|
||||
EXPECT_EQ(std::string("analyzers[0]"), errorField);
|
||||
}
|
||||
|
||||
// existing analyzer (full)
|
||||
|
@ -1520,7 +1513,7 @@ TEST_F(IResearchLinkMetaTest, test_readAnalyzerDefinitions) {
|
|||
arangodb::iresearch::IResearchLinkMeta meta;
|
||||
std::string errorField;
|
||||
EXPECT_FALSE(meta.init(json->slice(), true, errorField, &vocbase));
|
||||
EXPECT_EQ(std::string("analyzerDefinitions=>[0]"), errorField);
|
||||
EXPECT_EQ(std::string("analyzerDefinitions[0]"), errorField);
|
||||
}
|
||||
|
||||
// existing analyzer (definition mismatch) inRecovery
|
||||
|
@ -1537,7 +1530,7 @@ TEST_F(IResearchLinkMetaTest, test_readAnalyzerDefinitions) {
|
|||
arangodb::iresearch::IResearchLinkMeta meta;
|
||||
std::string errorField;
|
||||
EXPECT_FALSE(meta.init(json->slice(), true, errorField, &vocbase));
|
||||
EXPECT_EQ(std::string("analyzerDefinitions=>[0]"), errorField);
|
||||
EXPECT_EQ(std::string("analyzerDefinitions[0]"), errorField);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -104,8 +104,7 @@ TEST_F(IResearchQueryFilterTest, SearchAndFilter) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
view->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed));
|
||||
view->properties(builder, arangodb::LogicalDataSource::Serialization::Properties);
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
|
|
@ -295,8 +295,7 @@ TEST_F(IResearchQueryJoinTest, DuplicateDataSource) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
view->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed));
|
||||
view->properties(builder, arangodb::LogicalDataSource::Serialization::Properties);
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -454,8 +453,7 @@ TEST_F(IResearchQueryJoinTest, test) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
view->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed));
|
||||
view->properties(builder, arangodb::LogicalDataSource::Serialization::Properties);
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
|
|
@ -102,8 +102,7 @@ TEST_F(IResearchQueryNumericTermTest, test) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
view->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed));
|
||||
view->properties(builder, arangodb::LogicalDataSource::Serialization::Properties);
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
|
|
@ -87,8 +87,7 @@ class IResearchQueryOptimizationTest : public IResearchQueryTest {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
view->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed));
|
||||
view->properties(builder, arangodb::LogicalDataSource::Serialization::Properties);
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
|
|
@ -104,8 +104,7 @@ TEST_F(IResearchQueryOptionsTest, Collections) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
view->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed));
|
||||
view->properties(builder, arangodb::LogicalDataSource::Serialization::Properties);
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -707,8 +706,7 @@ TEST_F(IResearchQueryOptionsTest, WaitForSync) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
view->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed));
|
||||
view->properties(builder, arangodb::LogicalDataSource::Serialization::Properties);
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
|
|
@ -99,8 +99,7 @@ TEST_F(IResearchQueryOrTest, test) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
view->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed));
|
||||
view->properties(builder, arangodb::LogicalDataSource::Serialization::Properties);
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
|
|
@ -115,8 +115,7 @@ TEST_F(IResearchQueryScorerTest, test) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
view->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed));
|
||||
view->properties(builder, arangodb::LogicalDataSource::Serialization::Properties);
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
|
|
@ -95,8 +95,7 @@ TEST_F(IResearchQuerySelectAllTest, test) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
view->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed));
|
||||
view->properties(builder, arangodb::LogicalDataSource::Serialization::Properties);
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
|
|
@ -94,8 +94,7 @@ TEST_F(IResearchQueryStartsWithTest, test) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
view->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed));
|
||||
view->properties(builder, arangodb::LogicalDataSource::Serialization::Properties);
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
|
|
@ -105,8 +105,7 @@ TEST_F(IResearchQueryStringTermTest, test) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
view->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed));
|
||||
view->properties(builder, arangodb::LogicalDataSource::Serialization::Properties);
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
|
|
@ -202,9 +202,7 @@ TEST_F(IResearchViewTest, test_defaults) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
view->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed,
|
||||
arangodb::LogicalDataSource::Serialize::ForPersistence));
|
||||
view->properties(builder, arangodb::LogicalDataSource::Serialization::Persistence);
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -234,8 +232,7 @@ TEST_F(IResearchViewTest, test_defaults) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
view->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed));
|
||||
view->properties(builder, arangodb::LogicalDataSource::Serialization::Properties);
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -331,8 +328,7 @@ TEST_F(IResearchViewTest, test_defaults) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
logicalView->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed));
|
||||
logicalView->properties(builder, arangodb::LogicalDataSource::Serialization::Properties);
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -2561,7 +2557,7 @@ TEST_F(IResearchViewTest, test_register_link) {
|
|||
{
|
||||
arangodb::velocypack::Builder builder;
|
||||
builder.openObject();
|
||||
view->properties(builder, arangodb::LogicalDataSource::makeFlags());
|
||||
view->properties(builder, arangodb::LogicalDataSource::Serialization::List);
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -2623,7 +2619,7 @@ TEST_F(IResearchViewTest, test_register_link) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
view->properties(builder, arangodb::LogicalDataSource::makeFlags());
|
||||
view->properties(builder, arangodb::LogicalDataSource::Serialization::List);
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -3338,10 +3334,8 @@ TEST_F(IResearchViewTest, test_overwrite_immutable_properties) {
|
|||
// check immutable properties after creation
|
||||
{
|
||||
builder.openObject();
|
||||
EXPECT_TRUE(logicalView
|
||||
->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed))
|
||||
.ok());
|
||||
|
||||
EXPECT_TRUE(logicalView->properties(builder, arangodb::LogicalDataSource::Serialization::Properties).ok());
|
||||
builder.close();
|
||||
EXPECT_TRUE(true == meta.init(builder.slice(), tmpString));
|
||||
EXPECT_TRUE(std::string("C") == irs::locale_utils::name(meta._locale));
|
||||
|
@ -3390,10 +3384,7 @@ TEST_F(IResearchViewTest, test_overwrite_immutable_properties) {
|
|||
{
|
||||
builder.clear();
|
||||
builder.openObject();
|
||||
EXPECT_TRUE(logicalView
|
||||
->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed))
|
||||
.ok());
|
||||
EXPECT_TRUE(logicalView->properties(builder, arangodb::LogicalDataSource::Serialization::Properties).ok());
|
||||
builder.close();
|
||||
EXPECT_TRUE(true == meta.init(builder.slice(), tmpString));
|
||||
EXPECT_TRUE(std::string("C") == irs::locale_utils::name(meta._locale));
|
||||
|
@ -3978,8 +3969,7 @@ TEST_F(IResearchViewTest, test_update_overwrite) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
view->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed));
|
||||
EXPECT_TRUE(view->properties(builder, arangodb::LogicalDataSource::Serialization::Properties).ok());
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -4002,9 +3992,7 @@ TEST_F(IResearchViewTest, test_update_overwrite) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
view->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed,
|
||||
arangodb::LogicalDataSource::Serialize::ForPersistence));
|
||||
view->properties(builder, arangodb::LogicalDataSource::Serialization::Persistence);
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -4039,8 +4027,7 @@ TEST_F(IResearchViewTest, test_update_overwrite) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
view->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed));
|
||||
view->properties(builder, arangodb::LogicalDataSource::Serialization::Properties);
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -4064,9 +4051,7 @@ TEST_F(IResearchViewTest, test_update_overwrite) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
view->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed,
|
||||
arangodb::LogicalDataSource::Serialize::ForPersistence));
|
||||
view->properties(builder, arangodb::LogicalDataSource::Serialization::Persistence);
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -4105,8 +4090,7 @@ TEST_F(IResearchViewTest, test_update_overwrite) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
logicalView->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed));
|
||||
EXPECT_TRUE(logicalView->properties(builder, arangodb::LogicalDataSource::Serialization::Properties).ok());
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -4130,10 +4114,7 @@ TEST_F(IResearchViewTest, test_update_overwrite) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
logicalView->properties(builder,
|
||||
arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed,
|
||||
arangodb::LogicalDataSource::Serialize::ForPersistence));
|
||||
logicalView->properties(builder, arangodb::LogicalDataSource::Serialization::Persistence);
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -4172,8 +4153,7 @@ TEST_F(IResearchViewTest, test_update_overwrite) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
logicalView->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed));
|
||||
EXPECT_TRUE(logicalView->properties(builder, arangodb::LogicalDataSource::Serialization::Properties).ok());
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -4197,10 +4177,7 @@ TEST_F(IResearchViewTest, test_update_overwrite) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
logicalView->properties(builder,
|
||||
arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed,
|
||||
arangodb::LogicalDataSource::Serialize::ForPersistence));
|
||||
logicalView->properties(builder, arangodb::LogicalDataSource::Serialization::Persistence);
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -4243,8 +4220,7 @@ TEST_F(IResearchViewTest, test_update_overwrite) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
logicalView->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed));
|
||||
logicalView->properties(builder, arangodb::LogicalDataSource::Serialization::Properties);
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -4268,10 +4244,7 @@ TEST_F(IResearchViewTest, test_update_overwrite) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
logicalView->properties(builder,
|
||||
arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed,
|
||||
arangodb::LogicalDataSource::Serialize::ForPersistence));
|
||||
EXPECT_TRUE(logicalView->properties(builder, arangodb::LogicalDataSource::Serialization::Persistence).ok());
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -4318,8 +4291,7 @@ TEST_F(IResearchViewTest, test_update_overwrite) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
logicalView->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed));
|
||||
logicalView->properties(builder, arangodb::LogicalDataSource::Serialization::Properties);
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -4360,10 +4332,7 @@ TEST_F(IResearchViewTest, test_update_overwrite) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
logicalView->properties(builder,
|
||||
arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed,
|
||||
arangodb::LogicalDataSource::Serialize::ForPersistence));
|
||||
logicalView->properties(builder, arangodb::LogicalDataSource::Serialization::Persistence);
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -4401,8 +4370,7 @@ TEST_F(IResearchViewTest, test_update_overwrite) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
logicalView->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed));
|
||||
logicalView->properties(builder, arangodb::LogicalDataSource::Serialization::Properties);
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -4426,10 +4394,7 @@ TEST_F(IResearchViewTest, test_update_overwrite) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
logicalView->properties(builder,
|
||||
arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed,
|
||||
arangodb::LogicalDataSource::Serialize::ForPersistence));
|
||||
logicalView->properties(builder, arangodb::LogicalDataSource::Serialization::Persistence);
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -4481,8 +4446,7 @@ TEST_F(IResearchViewTest, test_update_overwrite) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
view->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed));
|
||||
view->properties(builder, arangodb::LogicalDataSource::Serialization::Properties);
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -4523,9 +4487,7 @@ TEST_F(IResearchViewTest, test_update_overwrite) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
view->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed,
|
||||
arangodb::LogicalDataSource::Serialize::ForPersistence));
|
||||
view->properties(builder, arangodb::LogicalDataSource::Serialization::Persistence);
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -4564,8 +4526,7 @@ TEST_F(IResearchViewTest, test_update_overwrite) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
view->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed));
|
||||
view->properties(builder, arangodb::LogicalDataSource::Serialization::Properties);
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -4606,9 +4567,7 @@ TEST_F(IResearchViewTest, test_update_overwrite) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
view->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed,
|
||||
arangodb::LogicalDataSource::Serialize::ForPersistence));
|
||||
view->properties(builder, arangodb::LogicalDataSource::Serialization::Persistence);
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -4654,8 +4613,7 @@ TEST_F(IResearchViewTest, test_update_overwrite) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
view->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed));
|
||||
view->properties(builder, arangodb::LogicalDataSource::Serialization::Properties);
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -4678,9 +4636,7 @@ TEST_F(IResearchViewTest, test_update_overwrite) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
view->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed,
|
||||
arangodb::LogicalDataSource::Serialize::ForPersistence));
|
||||
view->properties(builder, arangodb::LogicalDataSource::Serialization::Persistence);
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -4707,8 +4663,7 @@ TEST_F(IResearchViewTest, test_update_overwrite) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
view->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed));
|
||||
view->properties(builder, arangodb::LogicalDataSource::Serialization::Properties);
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -4730,9 +4685,7 @@ TEST_F(IResearchViewTest, test_update_overwrite) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
view->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed,
|
||||
arangodb::LogicalDataSource::Serialize::ForPersistence));
|
||||
view->properties(builder, arangodb::LogicalDataSource::Serialization::Persistence);
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -4794,10 +4747,7 @@ TEST_F(IResearchViewTest, test_update_overwrite) {
|
|||
|
||||
arangodb::velocypack::Builder builder;
|
||||
builder.openObject();
|
||||
logicalView->properties(builder,
|
||||
arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed,
|
||||
arangodb::LogicalDataSource::Serialize::ForPersistence)); // 'forPersistence' to avoid auth check
|
||||
logicalView->properties(builder, arangodb::LogicalDataSource::Serialization::Persistence); // 'forPersistence' to avoid auth check
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -4820,10 +4770,7 @@ TEST_F(IResearchViewTest, test_update_overwrite) {
|
|||
|
||||
arangodb::velocypack::Builder builder;
|
||||
builder.openObject();
|
||||
logicalView->properties(builder,
|
||||
arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed,
|
||||
arangodb::LogicalDataSource::Serialize::ForPersistence)); // 'forPersistence' to avoid auth check
|
||||
logicalView->properties(builder, arangodb::LogicalDataSource::Serialization::Persistence); // 'forPersistence' to avoid auth check
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -5287,8 +5234,7 @@ TEST_F(IResearchViewTest, test_update_partial) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
view->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed));
|
||||
view->properties(builder, arangodb::LogicalDataSource::Serialization::Properties);
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -5312,9 +5258,7 @@ TEST_F(IResearchViewTest, test_update_partial) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
view->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed,
|
||||
arangodb::LogicalDataSource::Serialize::ForPersistence));
|
||||
view->properties(builder, arangodb::LogicalDataSource::Serialization::Persistence);
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -5352,8 +5296,7 @@ TEST_F(IResearchViewTest, test_update_partial) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
logicalView->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed));
|
||||
logicalView->properties(builder, arangodb::LogicalDataSource::Serialization::Properties);
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -5377,10 +5320,7 @@ TEST_F(IResearchViewTest, test_update_partial) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
logicalView->properties(builder,
|
||||
arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed,
|
||||
arangodb::LogicalDataSource::Serialize::ForPersistence));
|
||||
logicalView->properties(builder, arangodb::LogicalDataSource::Serialization::Persistence);
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -5419,8 +5359,7 @@ TEST_F(IResearchViewTest, test_update_partial) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
logicalView->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed));
|
||||
logicalView->properties(builder, arangodb::LogicalDataSource::Serialization::Properties);
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -5444,10 +5383,7 @@ TEST_F(IResearchViewTest, test_update_partial) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
logicalView->properties(builder,
|
||||
arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed,
|
||||
arangodb::LogicalDataSource::Serialize::ForPersistence));
|
||||
logicalView->properties(builder, arangodb::LogicalDataSource::Serialization::Persistence);
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -5490,8 +5426,7 @@ TEST_F(IResearchViewTest, test_update_partial) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
logicalView->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed));
|
||||
logicalView->properties(builder, arangodb::LogicalDataSource::Serialization::Properties);
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -5515,10 +5450,7 @@ TEST_F(IResearchViewTest, test_update_partial) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
logicalView->properties(builder,
|
||||
arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed,
|
||||
arangodb::LogicalDataSource::Serialize::ForPersistence));
|
||||
logicalView->properties(builder, arangodb::LogicalDataSource::Serialization::Persistence);
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -5565,8 +5497,7 @@ TEST_F(IResearchViewTest, test_update_partial) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
logicalView->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed));
|
||||
logicalView->properties(builder, arangodb::LogicalDataSource::Serialization::Properties);
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -5607,10 +5538,7 @@ TEST_F(IResearchViewTest, test_update_partial) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
logicalView->properties(builder,
|
||||
arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed,
|
||||
arangodb::LogicalDataSource::Serialize::ForPersistence));
|
||||
logicalView->properties(builder, arangodb::LogicalDataSource::Serialization::Persistence);
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -5651,8 +5579,7 @@ TEST_F(IResearchViewTest, test_update_partial) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
logicalView->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed));
|
||||
logicalView->properties(builder, arangodb::LogicalDataSource::Serialization::Properties);
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -5693,10 +5620,7 @@ TEST_F(IResearchViewTest, test_update_partial) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
logicalView->properties(builder,
|
||||
arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed,
|
||||
arangodb::LogicalDataSource::Serialize::ForPersistence));
|
||||
logicalView->properties(builder, arangodb::LogicalDataSource::Serialization::Persistence);
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -5745,8 +5669,7 @@ TEST_F(IResearchViewTest, test_update_partial) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
view->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed));
|
||||
view->properties(builder, arangodb::LogicalDataSource::Serialization::Properties);
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -5769,9 +5692,7 @@ TEST_F(IResearchViewTest, test_update_partial) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
view->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed,
|
||||
arangodb::LogicalDataSource::Serialize::ForPersistence));
|
||||
view->properties(builder, arangodb::LogicalDataSource::Serialization::Persistence);
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -5815,8 +5736,7 @@ TEST_F(IResearchViewTest, test_update_partial) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
view->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed));
|
||||
view->properties(builder, arangodb::LogicalDataSource::Serialization::Properties);
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -5857,9 +5777,7 @@ TEST_F(IResearchViewTest, test_update_partial) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
view->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed,
|
||||
arangodb::LogicalDataSource::Serialize::ForPersistence));
|
||||
view->properties(builder, arangodb::LogicalDataSource::Serialization::Persistence);
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -5926,8 +5844,7 @@ TEST_F(IResearchViewTest, test_update_partial) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
view->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed));
|
||||
view->properties(builder, arangodb::LogicalDataSource::Serialization::Properties);
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -5968,9 +5885,7 @@ TEST_F(IResearchViewTest, test_update_partial) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
view->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed,
|
||||
arangodb::LogicalDataSource::Serialize::ForPersistence));
|
||||
view->properties(builder, arangodb::LogicalDataSource::Serialization::Persistence);
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -6013,8 +5928,7 @@ TEST_F(IResearchViewTest, test_update_partial) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
view->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed));
|
||||
view->properties(builder, arangodb::LogicalDataSource::Serialization::Properties);
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -6038,9 +5952,7 @@ TEST_F(IResearchViewTest, test_update_partial) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
view->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed,
|
||||
arangodb::LogicalDataSource::Serialize::ForPersistence));
|
||||
view->properties(builder, arangodb::LogicalDataSource::Serialization::Persistence);
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -6083,8 +5995,7 @@ TEST_F(IResearchViewTest, test_update_partial) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
view->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed));
|
||||
view->properties(builder, arangodb::LogicalDataSource::Serialization::Properties);
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -6116,8 +6027,7 @@ TEST_F(IResearchViewTest, test_update_partial) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
view->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed));
|
||||
view->properties(builder, arangodb::LogicalDataSource::Serialization::Properties);
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -6163,8 +6073,7 @@ TEST_F(IResearchViewTest, test_update_partial) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
view->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed));
|
||||
view->properties(builder, arangodb::LogicalDataSource::Serialization::Properties);
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -6188,9 +6097,7 @@ TEST_F(IResearchViewTest, test_update_partial) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
view->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed,
|
||||
arangodb::LogicalDataSource::Serialize::ForPersistence));
|
||||
view->properties(builder, arangodb::LogicalDataSource::Serialization::Persistence);
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -6224,8 +6131,7 @@ TEST_F(IResearchViewTest, test_update_partial) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
view->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed));
|
||||
view->properties(builder, arangodb::LogicalDataSource::Serialization::Properties);
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -6249,9 +6155,7 @@ TEST_F(IResearchViewTest, test_update_partial) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
view->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed,
|
||||
arangodb::LogicalDataSource::Serialize::ForPersistence));
|
||||
view->properties(builder, arangodb::LogicalDataSource::Serialization::Persistence);
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -6292,8 +6196,7 @@ TEST_F(IResearchViewTest, test_update_partial) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
view->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed));
|
||||
view->properties(builder, arangodb::LogicalDataSource::Serialization::Properties);
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -6317,9 +6220,7 @@ TEST_F(IResearchViewTest, test_update_partial) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
view->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed,
|
||||
arangodb::LogicalDataSource::Serialize::ForPersistence));
|
||||
view->properties(builder, arangodb::LogicalDataSource::Serialization::Persistence);
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -6362,8 +6263,7 @@ TEST_F(IResearchViewTest, test_update_partial) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
view->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed));
|
||||
view->properties(builder, arangodb::LogicalDataSource::Serialization::Properties);
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -6387,9 +6287,7 @@ TEST_F(IResearchViewTest, test_update_partial) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
view->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed,
|
||||
arangodb::LogicalDataSource::Serialize::ForPersistence));
|
||||
view->properties(builder, arangodb::LogicalDataSource::Serialization::Persistence);
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -6429,8 +6327,7 @@ TEST_F(IResearchViewTest, test_update_partial) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
view->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed));
|
||||
view->properties(builder, arangodb::LogicalDataSource::Serialization::Properties);
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -6449,9 +6346,7 @@ TEST_F(IResearchViewTest, test_update_partial) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
view->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed,
|
||||
arangodb::LogicalDataSource::Serialize::ForPersistence));
|
||||
view->properties(builder, arangodb::LogicalDataSource::Serialization::Persistence);
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -6485,8 +6380,7 @@ TEST_F(IResearchViewTest, test_update_partial) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
view->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed));
|
||||
view->properties(builder, arangodb::LogicalDataSource::Serialization::Properties);
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -6505,9 +6399,7 @@ TEST_F(IResearchViewTest, test_update_partial) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
view->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed,
|
||||
arangodb::LogicalDataSource::Serialize::ForPersistence));
|
||||
view->properties(builder, arangodb::LogicalDataSource::Serialization::Persistence);
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -6552,8 +6444,7 @@ TEST_F(IResearchViewTest, test_update_partial) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
view->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed));
|
||||
view->properties(builder, arangodb::LogicalDataSource::Serialization::Properties);
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -6576,9 +6467,7 @@ TEST_F(IResearchViewTest, test_update_partial) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
view->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed,
|
||||
arangodb::LogicalDataSource::Serialize::ForPersistence));
|
||||
view->properties(builder, arangodb::LogicalDataSource::Serialization::Persistence);
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -6605,8 +6494,7 @@ TEST_F(IResearchViewTest, test_update_partial) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
view->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed));
|
||||
view->properties(builder, arangodb::LogicalDataSource::Serialization::Properties);
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -6629,9 +6517,7 @@ TEST_F(IResearchViewTest, test_update_partial) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
view->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed,
|
||||
arangodb::LogicalDataSource::Serialize::ForPersistence));
|
||||
view->properties(builder, arangodb::LogicalDataSource::Serialization::Persistence);
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -6694,10 +6580,7 @@ TEST_F(IResearchViewTest, test_update_partial) {
|
|||
|
||||
arangodb::velocypack::Builder builder;
|
||||
builder.openObject();
|
||||
logicalView->properties(builder,
|
||||
arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed,
|
||||
arangodb::LogicalDataSource::Serialize::ForPersistence)); // 'forPersistence' to avoid auth check
|
||||
logicalView->properties(builder, arangodb::LogicalDataSource::Serialization::Persistence); // 'forPersistence' to avoid auth check
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -6720,10 +6603,7 @@ TEST_F(IResearchViewTest, test_update_partial) {
|
|||
|
||||
arangodb::velocypack::Builder builder;
|
||||
builder.openObject();
|
||||
logicalView->properties(builder,
|
||||
arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed,
|
||||
arangodb::LogicalDataSource::Serialize::ForPersistence)); // 'forPersistence' to avoid auth check
|
||||
logicalView->properties(builder, arangodb::LogicalDataSource::Serialization::Persistence); // 'forPersistence' to avoid auth check
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
|
|
@ -240,14 +240,12 @@ TEST_F(IResearchViewCoordinatorTest, test_defaults) {
|
|||
EXPECT_TRUE(
|
||||
(true == view->visitCollections([](TRI_voc_cid_t) { return false; })));
|
||||
|
||||
// +system, +properties
|
||||
// for persistence
|
||||
{
|
||||
arangodb::iresearch::IResearchViewMeta expectedMeta;
|
||||
arangodb::velocypack::Builder builder;
|
||||
builder.openObject();
|
||||
view->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed,
|
||||
arangodb::LogicalDataSource::Serialize::ForPersistence));
|
||||
EXPECT_TRUE(view->properties(builder, arangodb::LogicalDataSource::Serialization::Persistence).ok());
|
||||
builder.close();
|
||||
auto slice = builder.slice();
|
||||
arangodb::iresearch::IResearchViewMeta meta;
|
||||
|
@ -269,13 +267,12 @@ TEST_F(IResearchViewCoordinatorTest, test_defaults) {
|
|||
EXPECT_TRUE((meta.init(slice, error) && expectedMeta == meta));
|
||||
}
|
||||
|
||||
// -system, +properties
|
||||
// properties
|
||||
{
|
||||
arangodb::iresearch::IResearchViewMeta expectedMeta;
|
||||
arangodb::velocypack::Builder builder;
|
||||
builder.openObject();
|
||||
view->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed));
|
||||
EXPECT_TRUE(view->properties(builder, arangodb::LogicalDataSource::Serialization::Properties).ok());
|
||||
builder.close();
|
||||
auto slice = builder.slice();
|
||||
arangodb::iresearch::IResearchViewMeta meta;
|
||||
|
@ -296,11 +293,11 @@ TEST_F(IResearchViewCoordinatorTest, test_defaults) {
|
|||
EXPECT_TRUE((meta.init(slice, error) && expectedMeta == meta));
|
||||
}
|
||||
|
||||
// -system, -properties
|
||||
// list
|
||||
{
|
||||
arangodb::velocypack::Builder builder;
|
||||
builder.openObject();
|
||||
view->properties(builder, arangodb::LogicalDataSource::makeFlags());
|
||||
view->properties(builder, arangodb::LogicalDataSource::Serialization::List);
|
||||
builder.close();
|
||||
auto slice = builder.slice();
|
||||
arangodb::iresearch::IResearchViewMeta meta;
|
||||
|
@ -318,30 +315,6 @@ TEST_F(IResearchViewCoordinatorTest, test_defaults) {
|
|||
EXPECT_TRUE((!slice.hasKey("deleted")));
|
||||
EXPECT_TRUE((!slice.hasKey("properties")));
|
||||
}
|
||||
|
||||
// +system, -properties
|
||||
{
|
||||
arangodb::velocypack::Builder builder;
|
||||
builder.openObject();
|
||||
view->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::ForPersistence));
|
||||
builder.close();
|
||||
auto slice = builder.slice();
|
||||
|
||||
EXPECT_TRUE((7 == slice.length()));
|
||||
EXPECT_TRUE((slice.hasKey("globallyUniqueId") &&
|
||||
slice.get("globallyUniqueId").isString() &&
|
||||
false == slice.get("globallyUniqueId").copyString().empty()));
|
||||
EXPECT_TRUE((slice.get("id").copyString() == "1"));
|
||||
EXPECT_TRUE((slice.hasKey("isSystem") && slice.get("isSystem").isBoolean() &&
|
||||
false == slice.get("isSystem").getBoolean()));
|
||||
EXPECT_TRUE((slice.get("name").copyString() == "testView"));
|
||||
EXPECT_TRUE((slice.get("type").copyString() ==
|
||||
arangodb::iresearch::DATA_SOURCE_TYPE.name()));
|
||||
EXPECT_TRUE((false == slice.get("deleted").getBool()));
|
||||
EXPECT_TRUE((slice.hasKey("planId")));
|
||||
EXPECT_TRUE((!slice.hasKey("properties")));
|
||||
}
|
||||
}
|
||||
|
||||
// new view definition with links to missing collections
|
||||
|
@ -710,8 +683,7 @@ TEST_F(IResearchViewCoordinatorTest, test_create_link_in_background) {
|
|||
ASSERT_NE(nullptr, logicalView);
|
||||
VPackBuilder builder;
|
||||
builder.openObject();
|
||||
logicalView->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed));
|
||||
logicalView->properties(builder, arangodb::LogicalDataSource::Serialization::Properties);
|
||||
builder.close();
|
||||
ASSERT_TRUE(builder.slice().hasKey("links"));
|
||||
auto links = builder.slice().get("links");
|
||||
|
@ -870,8 +842,7 @@ TEST_F(IResearchViewCoordinatorTest, test_update_properties) {
|
|||
{
|
||||
VPackBuilder builder;
|
||||
builder.openObject();
|
||||
view->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed));
|
||||
view->properties(builder, arangodb::LogicalDataSource::Serialization::Properties);
|
||||
builder.close();
|
||||
|
||||
arangodb::iresearch::IResearchViewMeta meta;
|
||||
|
@ -909,9 +880,7 @@ TEST_F(IResearchViewCoordinatorTest, test_update_properties) {
|
|||
{
|
||||
VPackBuilder builder;
|
||||
builder.openObject();
|
||||
fullyUpdatedView->properties(builder,
|
||||
arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed));
|
||||
fullyUpdatedView->properties(builder, arangodb::LogicalDataSource::Serialization::Properties);
|
||||
builder.close();
|
||||
|
||||
arangodb::iresearch::IResearchViewMeta meta;
|
||||
|
@ -928,8 +897,7 @@ TEST_F(IResearchViewCoordinatorTest, test_update_properties) {
|
|||
{
|
||||
VPackBuilder builder;
|
||||
builder.openObject();
|
||||
view->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed));
|
||||
view->properties(builder, arangodb::LogicalDataSource::Serialization::Properties);
|
||||
builder.close();
|
||||
|
||||
arangodb::iresearch::IResearchViewMeta meta;
|
||||
|
@ -965,9 +933,7 @@ TEST_F(IResearchViewCoordinatorTest, test_update_properties) {
|
|||
{
|
||||
VPackBuilder builder;
|
||||
builder.openObject();
|
||||
partiallyUpdatedView->properties(builder,
|
||||
arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed));
|
||||
partiallyUpdatedView->properties(builder, arangodb::LogicalDataSource::Serialization::Properties);
|
||||
builder.close();
|
||||
|
||||
arangodb::iresearch::IResearchViewMeta meta;
|
||||
|
@ -1038,9 +1004,7 @@ TEST_F(IResearchViewCoordinatorTest, test_overwrite_immutable_properties) {
|
|||
VPackBuilder builder;
|
||||
|
||||
builder.openObject();
|
||||
EXPECT_TRUE(view->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed))
|
||||
.ok());
|
||||
EXPECT_TRUE(view->properties(builder, arangodb::LogicalDataSource::Serialization::Properties).ok());
|
||||
builder.close();
|
||||
EXPECT_TRUE(true == meta.init(builder.slice(), tmpString));
|
||||
EXPECT_TRUE(std::string("C") == irs::locale_utils::name(meta._locale));
|
||||
|
@ -1137,10 +1101,7 @@ TEST_F(IResearchViewCoordinatorTest, test_overwrite_immutable_properties) {
|
|||
|
||||
builder.clear();
|
||||
builder.openObject();
|
||||
EXPECT_TRUE(fullyUpdatedView
|
||||
->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed))
|
||||
.ok());
|
||||
EXPECT_TRUE(fullyUpdatedView->properties(builder, arangodb::LogicalDataSource::Serialization::Properties).ok());
|
||||
builder.close();
|
||||
EXPECT_TRUE(true == meta.init(builder.slice(), tmpString));
|
||||
EXPECT_TRUE(std::string("C") == irs::locale_utils::name(meta._locale));
|
||||
|
@ -1317,8 +1278,7 @@ TEST_F(IResearchViewCoordinatorTest, test_update_links_partial_remove) {
|
|||
{
|
||||
VPackBuilder info;
|
||||
info.openObject();
|
||||
view->properties(info, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed));
|
||||
EXPECT_TRUE(view->properties(info, arangodb::LogicalDataSource::Serialization::Properties).ok());
|
||||
info.close();
|
||||
|
||||
auto const properties = info.slice();
|
||||
|
@ -1561,8 +1521,7 @@ TEST_F(IResearchViewCoordinatorTest, test_update_links_partial_remove) {
|
|||
{
|
||||
VPackBuilder info;
|
||||
info.openObject();
|
||||
view->properties(info, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed));
|
||||
EXPECT_TRUE(view->properties(info, arangodb::LogicalDataSource::Serialization::Properties).ok());
|
||||
info.close();
|
||||
|
||||
auto const properties = info.slice();
|
||||
|
@ -1883,8 +1842,7 @@ TEST_F(IResearchViewCoordinatorTest, test_update_links_partial_add) {
|
|||
{
|
||||
VPackBuilder info;
|
||||
info.openObject();
|
||||
view->properties(info, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed));
|
||||
EXPECT_TRUE(view->properties(info, arangodb::LogicalDataSource::Serialization::Properties).ok());
|
||||
info.close();
|
||||
|
||||
auto const properties = info.slice();
|
||||
|
@ -2068,8 +2026,7 @@ TEST_F(IResearchViewCoordinatorTest, test_update_links_partial_add) {
|
|||
{
|
||||
VPackBuilder info;
|
||||
info.openObject();
|
||||
view->properties(info, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed));
|
||||
EXPECT_TRUE(view->properties(info, arangodb::LogicalDataSource::Serialization::Properties).ok());
|
||||
info.close();
|
||||
|
||||
auto const properties = info.slice();
|
||||
|
@ -2507,8 +2464,7 @@ TEST_F(IResearchViewCoordinatorTest, test_update_links_replace) {
|
|||
{
|
||||
VPackBuilder info;
|
||||
info.openObject();
|
||||
view->properties(info, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed));
|
||||
EXPECT_TRUE(view->properties(info, arangodb::LogicalDataSource::Serialization::Properties).ok());
|
||||
info.close();
|
||||
|
||||
auto const properties = info.slice();
|
||||
|
@ -2707,8 +2663,7 @@ TEST_F(IResearchViewCoordinatorTest, test_update_links_replace) {
|
|||
{
|
||||
VPackBuilder info;
|
||||
info.openObject();
|
||||
view->properties(info, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed));
|
||||
EXPECT_TRUE(view->properties(info, arangodb::LogicalDataSource::Serialization::Properties).ok());
|
||||
info.close();
|
||||
|
||||
auto const properties = info.slice();
|
||||
|
@ -2837,8 +2792,7 @@ TEST_F(IResearchViewCoordinatorTest, test_update_links_replace) {
|
|||
{
|
||||
VPackBuilder info;
|
||||
info.openObject();
|
||||
view->properties(info, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed));
|
||||
EXPECT_TRUE(view->properties(info, arangodb::LogicalDataSource::Serialization::Properties).ok());
|
||||
info.close();
|
||||
|
||||
auto const properties = info.slice();
|
||||
|
@ -3102,8 +3056,7 @@ TEST_F(IResearchViewCoordinatorTest, test_update_links_clear) {
|
|||
{
|
||||
VPackBuilder info;
|
||||
info.openObject();
|
||||
view->properties(info, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed));
|
||||
EXPECT_TRUE(view->properties(info, arangodb::LogicalDataSource::Serialization::Properties).ok());
|
||||
info.close();
|
||||
|
||||
auto const properties = info.slice();
|
||||
|
@ -3358,8 +3311,7 @@ TEST_F(IResearchViewCoordinatorTest, test_update_links_clear) {
|
|||
{
|
||||
VPackBuilder info;
|
||||
info.openObject();
|
||||
view->properties(info, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed));
|
||||
EXPECT_TRUE(view->properties(info, arangodb::LogicalDataSource::Serialization::Properties).ok());
|
||||
info.close();
|
||||
|
||||
auto const properties = info.slice();
|
||||
|
@ -3498,8 +3450,7 @@ TEST_F(IResearchViewCoordinatorTest, test_drop_link) {
|
|||
{
|
||||
VPackBuilder info;
|
||||
info.openObject();
|
||||
view->properties(info, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed));
|
||||
EXPECT_TRUE(view->properties(info, arangodb::LogicalDataSource::Serialization::Properties).ok());
|
||||
info.close();
|
||||
|
||||
auto const properties = info.slice();
|
||||
|
@ -3619,8 +3570,7 @@ TEST_F(IResearchViewCoordinatorTest, test_drop_link) {
|
|||
{
|
||||
VPackBuilder info;
|
||||
info.openObject();
|
||||
view->properties(info, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed));
|
||||
EXPECT_TRUE(view->properties(info, arangodb::LogicalDataSource::Serialization::Properties).ok());
|
||||
info.close();
|
||||
|
||||
auto const properties = info.slice();
|
||||
|
@ -3737,10 +3687,7 @@ TEST_F(IResearchViewCoordinatorTest, test_update_overwrite) {
|
|||
|
||||
arangodb::velocypack::Builder builder;
|
||||
builder.openObject();
|
||||
logicalView->properties(builder,
|
||||
arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed,
|
||||
arangodb::LogicalDataSource::Serialize::ForPersistence)); // 'forPersistence' to avoid auth check
|
||||
EXPECT_TRUE(logicalView->properties(builder, arangodb::LogicalDataSource::Serialization::Persistence).ok()); // 'forPersistence' to avoid auth check
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -3796,10 +3743,7 @@ TEST_F(IResearchViewCoordinatorTest, test_update_overwrite) {
|
|||
|
||||
arangodb::velocypack::Builder builder;
|
||||
builder.openObject();
|
||||
logicalView->properties(builder,
|
||||
arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed,
|
||||
arangodb::LogicalDataSource::Serialize::ForPersistence)); // 'forPersistence' to avoid auth check
|
||||
EXPECT_TRUE(logicalView->properties(builder, arangodb::LogicalDataSource::Serialization::Persistence).ok()); // 'forPersistence' to avoid auth check
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -3903,10 +3847,7 @@ TEST_F(IResearchViewCoordinatorTest, test_update_overwrite) {
|
|||
|
||||
arangodb::velocypack::Builder builder;
|
||||
builder.openObject();
|
||||
logicalView->properties(builder,
|
||||
arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed,
|
||||
arangodb::LogicalDataSource::Serialize::ForPersistence)); // 'forPersistence' to avoid auth check
|
||||
EXPECT_TRUE(logicalView->properties(builder, arangodb::LogicalDataSource::Serialization::Persistence).ok()); // 'forPersistence' to avoid auth check
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -3934,10 +3875,7 @@ TEST_F(IResearchViewCoordinatorTest, test_update_overwrite) {
|
|||
|
||||
arangodb::velocypack::Builder builder;
|
||||
builder.openObject();
|
||||
logicalView->properties(builder,
|
||||
arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed,
|
||||
arangodb::LogicalDataSource::Serialize::ForPersistence)); // 'forPersistence' to avoid auth check
|
||||
EXPECT_TRUE(logicalView->properties(builder, arangodb::LogicalDataSource::Serialization::Persistence).ok()); // 'forPersistence' to avoid auth check
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -4484,10 +4422,7 @@ TEST_F(IResearchViewCoordinatorTest, test_update_partial) {
|
|||
|
||||
arangodb::velocypack::Builder builder;
|
||||
builder.openObject();
|
||||
logicalView->properties(builder,
|
||||
arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed,
|
||||
arangodb::LogicalDataSource::Serialize::ForPersistence)); // 'forPersistence' to avoid auth check
|
||||
EXPECT_TRUE(logicalView->properties(builder, arangodb::LogicalDataSource::Serialization::Persistence).ok()); // 'forPersistence' to avoid auth check
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -4544,10 +4479,7 @@ TEST_F(IResearchViewCoordinatorTest, test_update_partial) {
|
|||
|
||||
arangodb::velocypack::Builder builder;
|
||||
builder.openObject();
|
||||
logicalView->properties(builder,
|
||||
arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed,
|
||||
arangodb::LogicalDataSource::Serialize::ForPersistence)); // 'forPersistence' to avoid auth check
|
||||
EXPECT_TRUE(logicalView->properties(builder, arangodb::LogicalDataSource::Serialization::Persistence).ok()); // 'forPersistence' to avoid auth check
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -4650,10 +4582,7 @@ TEST_F(IResearchViewCoordinatorTest, test_update_partial) {
|
|||
|
||||
arangodb::velocypack::Builder builder;
|
||||
builder.openObject();
|
||||
logicalView->properties(builder,
|
||||
arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed,
|
||||
arangodb::LogicalDataSource::Serialize::ForPersistence)); // 'forPersistence' to avoid auth check
|
||||
EXPECT_TRUE(logicalView->properties(builder, arangodb::LogicalDataSource::Serialization::Persistence).ok()); // 'forPersistence' to avoid auth check
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -4681,10 +4610,7 @@ TEST_F(IResearchViewCoordinatorTest, test_update_partial) {
|
|||
|
||||
arangodb::velocypack::Builder builder;
|
||||
builder.openObject();
|
||||
logicalView->properties(builder,
|
||||
arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed,
|
||||
arangodb::LogicalDataSource::Serialize::ForPersistence)); // 'forPersistence' to avoid auth check
|
||||
EXPECT_TRUE(logicalView->properties(builder, arangodb::LogicalDataSource::Serialization::Persistence).ok()); // 'forPersistence' to avoid auth check
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
|
|
@ -673,7 +673,7 @@ TEST_F(IResearchViewDBServerTest, test_rename) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
wiew->properties(builder, arangodb::LogicalDataSource::makeFlags());
|
||||
wiew->properties(builder, arangodb::LogicalDataSource::Serialization::List);
|
||||
builder.close();
|
||||
EXPECT_TRUE(builder.slice().hasKey("name"));
|
||||
EXPECT_EQ(std::string("testView"), builder.slice().get("name").copyString());
|
||||
|
@ -685,7 +685,7 @@ TEST_F(IResearchViewDBServerTest, test_rename) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
wiew->properties(builder, arangodb::LogicalDataSource::makeFlags());
|
||||
wiew->properties(builder, arangodb::LogicalDataSource::Serialization::List);
|
||||
builder.close();
|
||||
EXPECT_TRUE(builder.slice().hasKey("name"));
|
||||
EXPECT_EQ(std::string("testView"), builder.slice().get("name").copyString());
|
||||
|
@ -731,7 +731,7 @@ TEST_F(IResearchViewDBServerTest, test_rename) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
wiew->properties(builder, arangodb::LogicalDataSource::makeFlags());
|
||||
wiew->properties(builder, arangodb::LogicalDataSource::Serialization::List);
|
||||
builder.close();
|
||||
EXPECT_TRUE(builder.slice().hasKey("name"));
|
||||
EXPECT_EQ(std::string("testView"), builder.slice().get("name").copyString());
|
||||
|
@ -743,7 +743,7 @@ TEST_F(IResearchViewDBServerTest, test_rename) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
wiew->properties(builder, arangodb::LogicalDataSource::makeFlags());
|
||||
wiew->properties(builder, arangodb::LogicalDataSource::Serialization::List);
|
||||
builder.close();
|
||||
EXPECT_TRUE(builder.slice().hasKey("name"));
|
||||
EXPECT_EQ(std::string("testView"), builder.slice().get("name").copyString());
|
||||
|
@ -771,7 +771,7 @@ TEST_F(IResearchViewDBServerTest, test_toVelocyPack) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
wiew->properties(builder, arangodb::LogicalDataSource::makeFlags());
|
||||
wiew->properties(builder, arangodb::LogicalDataSource::Serialization::List);
|
||||
builder.close();
|
||||
auto slice = builder.slice();
|
||||
EXPECT_EQ(4U, slice.length());
|
||||
|
@ -787,7 +787,7 @@ TEST_F(IResearchViewDBServerTest, test_toVelocyPack) {
|
|||
slice.get("type").copyString()));
|
||||
}
|
||||
|
||||
// includeProperties
|
||||
// properties
|
||||
{
|
||||
auto json = arangodb::velocypack::Parser::fromJson(
|
||||
"{ \"name\": \"testView\", \"type\": \"arangosearch\", \"unusedKey\": "
|
||||
|
@ -804,8 +804,7 @@ TEST_F(IResearchViewDBServerTest, test_toVelocyPack) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
wiew->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed));
|
||||
EXPECT_TRUE(wiew->properties(builder, arangodb::LogicalDataSource::Serialization::Properties).ok());
|
||||
builder.close();
|
||||
auto slice = builder.slice();
|
||||
EXPECT_EQ(13U, slice.length());
|
||||
|
@ -821,7 +820,7 @@ TEST_F(IResearchViewDBServerTest, test_toVelocyPack) {
|
|||
slice.get("type").copyString()));
|
||||
}
|
||||
|
||||
// includeSystem
|
||||
// persistence
|
||||
{
|
||||
auto json = arangodb::velocypack::Parser::fromJson(
|
||||
"{ \"name\": \"testView\", \"type\": \"arangosearch\", \"unusedKey\": "
|
||||
|
@ -838,27 +837,36 @@ TEST_F(IResearchViewDBServerTest, test_toVelocyPack) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
wiew->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::ForPersistence));
|
||||
EXPECT_TRUE(wiew->properties(builder, arangodb::LogicalDataSource::Serialization::Persistence).ok());
|
||||
builder.close();
|
||||
auto slice = builder.slice();
|
||||
EXPECT_EQ(7, slice.length());
|
||||
EXPECT_TRUE((slice.hasKey("deleted") && slice.get("deleted").isBoolean() &&
|
||||
false == slice.get("deleted").getBoolean()));
|
||||
EXPECT_TRUE((slice.hasKey("globallyUniqueId") &&
|
||||
EXPECT_EQ(17, slice.length());
|
||||
EXPECT_TRUE(slice.hasKey("deleted") && slice.get("deleted").isBoolean() &&
|
||||
false == slice.get("deleted").getBoolean());
|
||||
EXPECT_TRUE(slice.hasKey("globallyUniqueId") &&
|
||||
slice.get("globallyUniqueId").isString() &&
|
||||
false == slice.get("globallyUniqueId").copyString().empty()));
|
||||
EXPECT_TRUE((slice.hasKey("id") && slice.get("id").isString() &&
|
||||
std::string("3") == slice.get("id").copyString()));
|
||||
EXPECT_TRUE((slice.hasKey("isSystem") && slice.get("isSystem").isBoolean() &&
|
||||
false == slice.get("isSystem").getBoolean()));
|
||||
EXPECT_TRUE((slice.hasKey("name") && slice.get("name").isString() &&
|
||||
std::string("testView") == slice.get("name").copyString()));
|
||||
EXPECT_TRUE((slice.hasKey("planId") && slice.get("planId").isString() &&
|
||||
std::string("3") == slice.get("planId").copyString()));
|
||||
EXPECT_TRUE((slice.hasKey("type") && slice.get("type").isString() &&
|
||||
false == slice.get("globallyUniqueId").copyString().empty());
|
||||
EXPECT_TRUE(slice.hasKey("id") && slice.get("id").isString() &&
|
||||
std::string("3") == slice.get("id").copyString());
|
||||
EXPECT_TRUE(slice.hasKey("isSystem") && slice.get("isSystem").isBoolean() &&
|
||||
false == slice.get("isSystem").getBoolean());
|
||||
EXPECT_TRUE(slice.hasKey("name") && slice.get("name").isString() &&
|
||||
std::string("testView") == slice.get("name").copyString());
|
||||
EXPECT_TRUE(slice.hasKey("planId") && slice.get("planId").isString() &&
|
||||
std::string("3") == slice.get("planId").copyString());
|
||||
EXPECT_TRUE(slice.hasKey("type") && slice.get("type").isString() &&
|
||||
arangodb::iresearch::DATA_SOURCE_TYPE.name() ==
|
||||
slice.get("type").copyString()));
|
||||
slice.get("type").copyString());
|
||||
EXPECT_TRUE(slice.hasKey("cleanupIntervalStep") && slice.get("cleanupIntervalStep").isNumber());
|
||||
EXPECT_TRUE(slice.hasKey("commitIntervalMsec") && slice.get("commitIntervalMsec").isNumber());
|
||||
EXPECT_TRUE(slice.hasKey("consolidationIntervalMsec") && slice.get("consolidationIntervalMsec").isNumber());
|
||||
EXPECT_TRUE(slice.hasKey("version") && slice.get("version").isNumber());
|
||||
EXPECT_TRUE(slice.hasKey("consolidationPolicy") && slice.get("consolidationPolicy").isObject());
|
||||
EXPECT_TRUE(slice.hasKey("primarySort") && slice.get("primarySort").isArray());
|
||||
EXPECT_TRUE(slice.hasKey("writebufferActive") && slice.get("writebufferActive").isNumber());
|
||||
EXPECT_TRUE(slice.hasKey("writebufferIdle") && slice.get("writebufferIdle").isNumber());
|
||||
EXPECT_TRUE(slice.hasKey("writebufferSizeMax") && slice.get("writebufferSizeMax").isNumber());
|
||||
EXPECT_TRUE(slice.hasKey("collections") && slice.get("collections").isArray());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1010,8 +1018,7 @@ TEST_F(IResearchViewDBServerTest, test_updateProperties) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
wiew->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed));
|
||||
EXPECT_TRUE(wiew->properties(builder, arangodb::LogicalDataSource::Serialization::Properties).ok());
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -1038,8 +1045,7 @@ TEST_F(IResearchViewDBServerTest, test_updateProperties) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
wiew->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed));
|
||||
EXPECT_TRUE(wiew->properties(builder, arangodb::LogicalDataSource::Serialization::Properties).ok());
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -1065,8 +1071,7 @@ TEST_F(IResearchViewDBServerTest, test_updateProperties) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
wiew->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed));
|
||||
EXPECT_TRUE(wiew->properties(builder, arangodb::LogicalDataSource::Serialization::Properties).ok());
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -1087,9 +1092,7 @@ TEST_F(IResearchViewDBServerTest, test_updateProperties) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
wiew->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed,
|
||||
arangodb::LogicalDataSource::Serialize::ForPersistence));
|
||||
EXPECT_TRUE(wiew->properties(builder, arangodb::LogicalDataSource::Serialization::Persistence).ok());
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -1131,8 +1134,7 @@ TEST_F(IResearchViewDBServerTest, test_updateProperties) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
wiew->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed));
|
||||
EXPECT_TRUE(wiew->properties(builder, arangodb::LogicalDataSource::Serialization::Properties).ok());
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -1159,8 +1161,7 @@ TEST_F(IResearchViewDBServerTest, test_updateProperties) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
wiew->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed));
|
||||
EXPECT_TRUE(wiew->properties(builder, arangodb::LogicalDataSource::Serialization::Properties).ok());
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -1186,8 +1187,7 @@ TEST_F(IResearchViewDBServerTest, test_updateProperties) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
wiew->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed));
|
||||
EXPECT_TRUE(wiew->properties(builder, arangodb::LogicalDataSource::Serialization::Properties).ok());
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -1208,9 +1208,7 @@ TEST_F(IResearchViewDBServerTest, test_updateProperties) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
wiew->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed,
|
||||
arangodb::LogicalDataSource::Serialize::ForPersistence));
|
||||
EXPECT_TRUE(wiew->properties(builder, arangodb::LogicalDataSource::Serialization::Persistence).ok());
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -1263,8 +1261,7 @@ TEST_F(IResearchViewDBServerTest, test_updateProperties) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
wiew->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed));
|
||||
EXPECT_TRUE(wiew->properties(builder, arangodb::LogicalDataSource::Serialization::Properties).ok());
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -1291,8 +1288,7 @@ TEST_F(IResearchViewDBServerTest, test_updateProperties) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
wiew->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed));
|
||||
EXPECT_TRUE(wiew->properties(builder, arangodb::LogicalDataSource::Serialization::Properties).ok());
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -1313,8 +1309,7 @@ TEST_F(IResearchViewDBServerTest, test_updateProperties) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
wiew->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed));
|
||||
EXPECT_TRUE(wiew->properties(builder, arangodb::LogicalDataSource::Serialization::Properties).ok());
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -1335,9 +1330,7 @@ TEST_F(IResearchViewDBServerTest, test_updateProperties) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
wiew->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed,
|
||||
arangodb::LogicalDataSource::Serialize::ForPersistence));
|
||||
EXPECT_TRUE(wiew->properties(builder, arangodb::LogicalDataSource::Serialization::Persistence).ok());
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -1394,8 +1387,7 @@ TEST_F(IResearchViewDBServerTest, test_updateProperties) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
wiew->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed));
|
||||
EXPECT_TRUE(wiew->properties(builder, arangodb::LogicalDataSource::Serialization::Properties).ok());
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -1422,8 +1414,7 @@ TEST_F(IResearchViewDBServerTest, test_updateProperties) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
wiew->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed));
|
||||
EXPECT_TRUE(wiew->properties(builder, arangodb::LogicalDataSource::Serialization::Properties).ok());
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -1444,8 +1435,7 @@ TEST_F(IResearchViewDBServerTest, test_updateProperties) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
wiew->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed));
|
||||
EXPECT_TRUE(wiew->properties(builder, arangodb::LogicalDataSource::Serialization::Properties).ok());
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -1466,9 +1456,7 @@ TEST_F(IResearchViewDBServerTest, test_updateProperties) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
wiew->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed,
|
||||
arangodb::LogicalDataSource::Serialize::ForPersistence));
|
||||
EXPECT_TRUE(wiew->properties(builder, arangodb::LogicalDataSource::Serialization::Persistence).ok());
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
|
|
@ -240,7 +240,7 @@ TEST_F(IResearchViewMetaTest, test_readCustomizedValues) {
|
|||
"\"threshold\": -0.5 } }");
|
||||
EXPECT_TRUE((true == metaState.init(json->slice(), errorField)));
|
||||
EXPECT_TRUE(false == meta.init(json->slice(), errorField));
|
||||
EXPECT_TRUE((std::string("consolidationPolicy=>threshold") == errorField));
|
||||
EXPECT_TRUE((std::string("consolidationPolicy.threshold") == errorField));
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -250,7 +250,7 @@ TEST_F(IResearchViewMetaTest, test_readCustomizedValues) {
|
|||
"\"threshold\": 1.5 } }");
|
||||
EXPECT_TRUE((true == metaState.init(json->slice(), errorField)));
|
||||
EXPECT_TRUE(false == meta.init(json->slice(), errorField));
|
||||
EXPECT_TRUE((std::string("consolidationPolicy=>threshold") == errorField));
|
||||
EXPECT_TRUE((std::string("consolidationPolicy.threshold") == errorField));
|
||||
}
|
||||
|
||||
// consolidation policy "tier"
|
||||
|
@ -262,7 +262,7 @@ TEST_F(IResearchViewMetaTest, test_readCustomizedValues) {
|
|||
"} }");
|
||||
EXPECT_TRUE((true == metaState.init(json->slice(), errorField)));
|
||||
EXPECT_TRUE(false == meta.init(json->slice(), errorField));
|
||||
EXPECT_TRUE((std::string("consolidationPolicy=>segmentsMin") == errorField));
|
||||
EXPECT_TRUE((std::string("consolidationPolicy.segmentsMin") == errorField));
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -272,7 +272,7 @@ TEST_F(IResearchViewMetaTest, test_readCustomizedValues) {
|
|||
"} }");
|
||||
EXPECT_TRUE((true == metaState.init(json->slice(), errorField)));
|
||||
EXPECT_TRUE(false == meta.init(json->slice(), errorField));
|
||||
EXPECT_TRUE((std::string("consolidationPolicy=>segmentsMax") == errorField));
|
||||
EXPECT_TRUE((std::string("consolidationPolicy.segmentsMax") == errorField));
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -282,7 +282,7 @@ TEST_F(IResearchViewMetaTest, test_readCustomizedValues) {
|
|||
"\"segmentsBytesFloor\": -1 } }");
|
||||
EXPECT_TRUE((true == metaState.init(json->slice(), errorField)));
|
||||
EXPECT_TRUE(false == meta.init(json->slice(), errorField));
|
||||
EXPECT_TRUE((std::string("consolidationPolicy=>segmentsBytesFloor") == errorField));
|
||||
EXPECT_TRUE((std::string("consolidationPolicy.segmentsBytesFloor") == errorField));
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -292,7 +292,7 @@ TEST_F(IResearchViewMetaTest, test_readCustomizedValues) {
|
|||
"\"segmentsBytesMax\": -1 } }");
|
||||
EXPECT_TRUE((true == metaState.init(json->slice(), errorField)));
|
||||
EXPECT_TRUE(false == meta.init(json->slice(), errorField));
|
||||
EXPECT_TRUE((std::string("consolidationPolicy=>segmentsBytesMax") == errorField));
|
||||
EXPECT_TRUE((std::string("consolidationPolicy.segmentsBytesMax") == errorField));
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -301,7 +301,7 @@ TEST_F(IResearchViewMetaTest, test_readCustomizedValues) {
|
|||
"{ \"consolidationPolicy\": { \"type\": \"invalid\" } }");
|
||||
EXPECT_TRUE((true == metaState.init(json->slice(), errorField)));
|
||||
EXPECT_TRUE(false == meta.init(json->slice(), errorField));
|
||||
EXPECT_TRUE((std::string("consolidationPolicy=>type") == errorField));
|
||||
EXPECT_EQ(std::string("consolidationPolicy.type"), errorField);
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -335,7 +335,7 @@ TEST_F(IResearchViewMetaTest, test_readCustomizedValues) {
|
|||
arangodb::velocypack::Parser::fromJson("{ \"primarySort\": [ 1 ] }");
|
||||
EXPECT_TRUE((true == metaState.init(json->slice(), errorField)));
|
||||
EXPECT_TRUE(false == meta.init(json->slice(), errorField));
|
||||
EXPECT_TRUE("primarySort=>[0]" == errorField);
|
||||
EXPECT_EQ("primarySort[0]", errorField);
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -344,7 +344,7 @@ TEST_F(IResearchViewMetaTest, test_readCustomizedValues) {
|
|||
"{ \"primarySort\": [ { \"field\":{ }, \"direction\":\"aSc\" } ] }");
|
||||
EXPECT_TRUE((true == metaState.init(json->slice(), errorField)));
|
||||
EXPECT_TRUE(false == meta.init(json->slice(), errorField));
|
||||
EXPECT_TRUE("primarySort=>[0]=>field" == errorField);
|
||||
EXPECT_EQ("primarySort[0].field", errorField);
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -353,7 +353,7 @@ TEST_F(IResearchViewMetaTest, test_readCustomizedValues) {
|
|||
"{ \"primarySort\": [ { \"field\":{ }, \"asc\":true } ] }");
|
||||
EXPECT_TRUE((true == metaState.init(json->slice(), errorField)));
|
||||
EXPECT_TRUE(false == meta.init(json->slice(), errorField));
|
||||
EXPECT_TRUE("primarySort=>[0]=>field" == errorField);
|
||||
EXPECT_EQ("primarySort[0].field", errorField);
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -363,7 +363,7 @@ TEST_F(IResearchViewMetaTest, test_readCustomizedValues) {
|
|||
"\"direction\":\"xxx\" }, 4 ] }");
|
||||
EXPECT_TRUE((true == metaState.init(json->slice(), errorField)));
|
||||
EXPECT_TRUE(false == meta.init(json->slice(), errorField));
|
||||
EXPECT_TRUE("primarySort=>[0]=>direction" == errorField);
|
||||
EXPECT_EQ("primarySort[0].direction", errorField);
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -373,7 +373,7 @@ TEST_F(IResearchViewMetaTest, test_readCustomizedValues) {
|
|||
"4 ] }");
|
||||
EXPECT_TRUE((true == metaState.init(json->slice(), errorField)));
|
||||
EXPECT_TRUE(false == meta.init(json->slice(), errorField));
|
||||
EXPECT_TRUE("primarySort=>[0]=>asc" == errorField);
|
||||
EXPECT_TRUE("primarySort[0].asc" == errorField);
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -383,7 +383,7 @@ TEST_F(IResearchViewMetaTest, test_readCustomizedValues) {
|
|||
"\"direction\":\"aSc\" }, 4 ] }");
|
||||
EXPECT_TRUE((true == metaState.init(json->slice(), errorField)));
|
||||
EXPECT_TRUE(false == meta.init(json->slice(), errorField));
|
||||
EXPECT_TRUE("primarySort=>[1]" == errorField);
|
||||
EXPECT_TRUE("primarySort[1]" == errorField);
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -393,7 +393,7 @@ TEST_F(IResearchViewMetaTest, test_readCustomizedValues) {
|
|||
"\"field\":1, \"direction\":\"aSc\" } ] }");
|
||||
EXPECT_TRUE((true == metaState.init(json->slice(), errorField)));
|
||||
EXPECT_TRUE(false == meta.init(json->slice(), errorField));
|
||||
EXPECT_TRUE("primarySort=>[1]=>field" == errorField);
|
||||
EXPECT_TRUE("primarySort[1].field" == errorField);
|
||||
}
|
||||
|
||||
// .............................................................................
|
||||
|
|
|
@ -183,7 +183,7 @@ TEST(IResearchViewSortTest, deserialize) {
|
|||
]");
|
||||
std::string errorField;
|
||||
EXPECT_FALSE(sort.fromVelocyPack(json->slice(), errorField));
|
||||
EXPECT_EQ("[0]=>field", errorField);
|
||||
EXPECT_EQ("[0].field", errorField);
|
||||
EXPECT_TRUE(sort.empty());
|
||||
EXPECT_EQ(0, sort.size());
|
||||
EXPECT_TRUE(sort.memory() > 0);
|
||||
|
@ -199,7 +199,7 @@ TEST(IResearchViewSortTest, deserialize) {
|
|||
]");
|
||||
std::string errorField;
|
||||
EXPECT_FALSE(sort.fromVelocyPack(json->slice(), errorField));
|
||||
EXPECT_EQ("[0]=>direction", errorField);
|
||||
EXPECT_EQ("[0].direction", errorField);
|
||||
EXPECT_TRUE(sort.empty());
|
||||
EXPECT_EQ(0, sort.size());
|
||||
EXPECT_TRUE(sort.memory() > 0);
|
||||
|
@ -215,7 +215,7 @@ TEST(IResearchViewSortTest, deserialize) {
|
|||
]");
|
||||
std::string errorField;
|
||||
EXPECT_FALSE(sort.fromVelocyPack(json->slice(), errorField));
|
||||
EXPECT_EQ("[1]=>direction", errorField);
|
||||
EXPECT_EQ("[1].direction", errorField);
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -228,7 +228,7 @@ TEST(IResearchViewSortTest, deserialize) {
|
|||
]");
|
||||
std::string errorField;
|
||||
EXPECT_FALSE(sort.fromVelocyPack(json->slice(), errorField));
|
||||
EXPECT_EQ("[2]=>asc", errorField);
|
||||
EXPECT_EQ("[2].asc", errorField);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -189,8 +189,7 @@ TEST_F(IResearchViewSortedTest, SingleField) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
view->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed));
|
||||
EXPECT_TRUE(view->properties(builder, arangodb::LogicalDataSource::Serialization::Properties).ok());
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
@ -477,8 +476,7 @@ TEST_F(IResearchViewSortedTest, MultipleFields) {
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
view->properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed));
|
||||
EXPECT_TRUE(view->properties(builder, arangodb::LogicalDataSource::Serialization::Properties).ok());
|
||||
builder.close();
|
||||
|
||||
auto slice = builder.slice();
|
||||
|
|
|
@ -977,9 +977,10 @@ arangodb::Result StorageEngineMock::changeView(TRI_vocbase_t& vocbase,
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
view.properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed,
|
||||
arangodb::LogicalDataSource::Serialize::ForPersistence));
|
||||
auto res = view.properties(builder, arangodb::LogicalDataSource::Serialization::Persistence);
|
||||
if (!res.ok()) {
|
||||
return res;
|
||||
}
|
||||
builder.close();
|
||||
views[std::make_pair(vocbase.id(), view.id())] = std::move(builder);
|
||||
return {};
|
||||
|
@ -1052,9 +1053,10 @@ arangodb::Result StorageEngineMock::createView(TRI_vocbase_t& vocbase, TRI_voc_c
|
|||
arangodb::velocypack::Builder builder;
|
||||
|
||||
builder.openObject();
|
||||
view.properties(builder, arangodb::LogicalDataSource::makeFlags(
|
||||
arangodb::LogicalDataSource::Serialize::Detailed,
|
||||
arangodb::LogicalDataSource::Serialize::ForPersistence));
|
||||
auto res = view.properties(builder, arangodb::LogicalDataSource::Serialization::Persistence);
|
||||
if (!res.ok()) {
|
||||
return res;
|
||||
}
|
||||
builder.close();
|
||||
views[std::make_pair(vocbase.id(), view.id())] = std::move(builder);
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ struct TestView : public arangodb::LogicalView {
|
|||
: arangodb::LogicalView(vocbase, definition, planVersion) {}
|
||||
virtual arangodb::Result appendVelocyPackImpl(
|
||||
arangodb::velocypack::Builder& builder,
|
||||
std::underlying_type<arangodb::LogicalDataSource::Serialize>::type) const override {
|
||||
Serialization) const override {
|
||||
builder.add("properties", _properties.slice());
|
||||
return _appendVelocyPackResult;
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ struct TestView : public arangodb::LogicalView {
|
|||
: arangodb::LogicalView(vocbase, definition, planVersion) {}
|
||||
virtual arangodb::Result appendVelocyPackImpl(
|
||||
arangodb::velocypack::Builder& builder,
|
||||
std::underlying_type<arangodb::LogicalDataSource::Serialize>::type) const override {
|
||||
Serialization) const override {
|
||||
builder.add("properties", _properties.slice());
|
||||
return _appendVelocyPackResult;
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ struct TestView : public arangodb::LogicalView {
|
|||
: arangodb::LogicalView(vocbase, definition, planVersion) {}
|
||||
virtual arangodb::Result appendVelocyPackImpl(
|
||||
arangodb::velocypack::Builder&,
|
||||
std::underlying_type<arangodb::LogicalDataSource::Serialize>::type) const override {
|
||||
Serialization) const override {
|
||||
return arangodb::Result();
|
||||
}
|
||||
virtual arangodb::Result dropImpl() override {
|
||||
|
|
|
@ -1016,7 +1016,7 @@ TEST_F(V8AnalyzersTest, test_create) {
|
|||
static_cast<int>(args.size()), args.data());
|
||||
EXPECT_FALSE(result.IsEmpty());
|
||||
EXPECT_TRUE(result.ToLocalChecked()->IsObject());
|
||||
auto* v8Analyzer = TRI_UnwrapClass<arangodb::iresearch::IResearchAnalyzerFeature::AnalyzerPool>(
|
||||
auto* v8Analyzer = TRI_UnwrapClass<arangodb::iresearch::AnalyzerPool>(
|
||||
result.ToLocalChecked()->ToObject(TRI_IGETC).FromMaybe(v8::Local<v8::Object>()),
|
||||
WRP_IRESEARCH_ANALYZER_TYPE, TRI_IGETC);
|
||||
EXPECT_FALSE(!v8Analyzer);
|
||||
|
@ -1133,7 +1133,7 @@ TEST_F(V8AnalyzersTest, test_create) {
|
|||
static_cast<int>(args.size()), args.data());
|
||||
EXPECT_FALSE(result.IsEmpty());
|
||||
EXPECT_TRUE(result.ToLocalChecked()->IsObject());
|
||||
auto* v8Analyzer = TRI_UnwrapClass<arangodb::iresearch::IResearchAnalyzerFeature::AnalyzerPool>(
|
||||
auto* v8Analyzer = TRI_UnwrapClass<arangodb::iresearch::AnalyzerPool>(
|
||||
result.ToLocalChecked()->ToObject(TRI_IGETC).FromMaybe(v8::Local<v8::Object>()),
|
||||
WRP_IRESEARCH_ANALYZER_TYPE, TRI_IGETC);
|
||||
EXPECT_FALSE(!v8Analyzer);
|
||||
|
@ -1192,7 +1192,7 @@ TEST_F(V8AnalyzersTest, test_create) {
|
|||
static_cast<int>(args.size()), args.data());
|
||||
EXPECT_FALSE(result.IsEmpty());
|
||||
EXPECT_TRUE(result.ToLocalChecked()->IsObject());
|
||||
auto* v8Analyzer = TRI_UnwrapClass<arangodb::iresearch::IResearchAnalyzerFeature::AnalyzerPool>(
|
||||
auto* v8Analyzer = TRI_UnwrapClass<arangodb::iresearch::AnalyzerPool>(
|
||||
result.ToLocalChecked()->ToObject(TRI_IGETC).FromMaybe(v8::Local<v8::Object>()),
|
||||
WRP_IRESEARCH_ANALYZER_TYPE, TRI_IGETC);
|
||||
EXPECT_FALSE(!v8Analyzer);
|
||||
|
@ -1250,7 +1250,7 @@ TEST_F(V8AnalyzersTest, test_create) {
|
|||
static_cast<int>(args.size()), args.data());
|
||||
EXPECT_FALSE(result.IsEmpty());
|
||||
EXPECT_TRUE(result.ToLocalChecked()->IsObject());
|
||||
auto* v8Analyzer = TRI_UnwrapClass<arangodb::iresearch::IResearchAnalyzerFeature::AnalyzerPool>(
|
||||
auto* v8Analyzer = TRI_UnwrapClass<arangodb::iresearch::AnalyzerPool>(
|
||||
result.ToLocalChecked()->ToObject(TRI_IGETC).FromMaybe(v8::Local<v8::Object>()),
|
||||
WRP_IRESEARCH_ANALYZER_TYPE, TRI_IGETC);
|
||||
EXPECT_FALSE(!v8Analyzer);
|
||||
|
@ -1403,7 +1403,7 @@ TEST_F(V8AnalyzersTest, test_get) {
|
|||
args.data());
|
||||
EXPECT_FALSE(result.IsEmpty());
|
||||
EXPECT_TRUE(result.ToLocalChecked()->IsObject());
|
||||
auto* v8Analyzer = TRI_UnwrapClass<arangodb::iresearch::IResearchAnalyzerFeature::AnalyzerPool>(
|
||||
auto* v8Analyzer = TRI_UnwrapClass<arangodb::iresearch::AnalyzerPool>(
|
||||
result.ToLocalChecked()->ToObject(TRI_IGETC).FromMaybe(v8::Local<v8::Object>()),
|
||||
WRP_IRESEARCH_ANALYZER_TYPE, TRI_IGETC);
|
||||
EXPECT_FALSE(!v8Analyzer);
|
||||
|
@ -1505,7 +1505,7 @@ TEST_F(V8AnalyzersTest, test_get) {
|
|||
args.data());
|
||||
EXPECT_FALSE(result.IsEmpty());
|
||||
EXPECT_TRUE(result.ToLocalChecked()->IsObject());
|
||||
auto* v8Analyzer = TRI_UnwrapClass<arangodb::iresearch::IResearchAnalyzerFeature::AnalyzerPool>(
|
||||
auto* v8Analyzer = TRI_UnwrapClass<arangodb::iresearch::AnalyzerPool>(
|
||||
result.ToLocalChecked()->ToObject(TRI_IGETC).FromMaybe(v8::Local<v8::Object>()),
|
||||
WRP_IRESEARCH_ANALYZER_TYPE, TRI_IGETC);
|
||||
EXPECT_FALSE(!v8Analyzer);
|
||||
|
@ -1619,7 +1619,7 @@ TEST_F(V8AnalyzersTest, test_get) {
|
|||
args.data());
|
||||
EXPECT_FALSE(result.IsEmpty());
|
||||
EXPECT_TRUE(result.ToLocalChecked()->IsObject());
|
||||
auto* v8Analyzer = TRI_UnwrapClass<arangodb::iresearch::IResearchAnalyzerFeature::AnalyzerPool>(
|
||||
auto* v8Analyzer = TRI_UnwrapClass<arangodb::iresearch::AnalyzerPool>(
|
||||
result.ToLocalChecked()->ToObject(TRI_IGETC).FromMaybe(v8::Local<v8::Object>()),
|
||||
WRP_IRESEARCH_ANALYZER_TYPE, TRI_IGETC);
|
||||
EXPECT_FALSE(!v8Analyzer);
|
||||
|
@ -1986,7 +1986,7 @@ TEST_F(V8AnalyzersTest, test_list) {
|
|||
EXPECT_FALSE(v8Analyzer.IsEmpty());
|
||||
EXPECT_TRUE(v8Analyzer->IsObject());
|
||||
auto* analyzer =
|
||||
TRI_UnwrapClass<arangodb::iresearch::IResearchAnalyzerFeature::AnalyzerPool>(
|
||||
TRI_UnwrapClass<arangodb::iresearch::AnalyzerPool>(
|
||||
v8Analyzer->ToObject(TRI_IGETC).FromMaybe(v8::Local<v8::Object>()),
|
||||
WRP_IRESEARCH_ANALYZER_TYPE, TRI_IGETC);
|
||||
EXPECT_FALSE(!analyzer);
|
||||
|
@ -2051,7 +2051,7 @@ TEST_F(V8AnalyzersTest, test_list) {
|
|||
EXPECT_FALSE(v8Analyzer.IsEmpty());
|
||||
EXPECT_TRUE(v8Analyzer->IsObject());
|
||||
auto* analyzer =
|
||||
TRI_UnwrapClass<arangodb::iresearch::IResearchAnalyzerFeature::AnalyzerPool>(
|
||||
TRI_UnwrapClass<arangodb::iresearch::AnalyzerPool>(
|
||||
v8Analyzer->ToObject(TRI_IGETC).FromMaybe(v8::Local<v8::Object>()),
|
||||
WRP_IRESEARCH_ANALYZER_TYPE, TRI_IGETC);
|
||||
EXPECT_FALSE(!analyzer);
|
||||
|
@ -2118,7 +2118,7 @@ TEST_F(V8AnalyzersTest, test_list) {
|
|||
EXPECT_FALSE(v8Analyzer.IsEmpty());
|
||||
EXPECT_TRUE(v8Analyzer->IsObject());
|
||||
auto* analyzer =
|
||||
TRI_UnwrapClass<arangodb::iresearch::IResearchAnalyzerFeature::AnalyzerPool>(
|
||||
TRI_UnwrapClass<arangodb::iresearch::AnalyzerPool>(
|
||||
v8Analyzer->ToObject(TRI_IGETC).FromMaybe(v8::Local<v8::Object>()),
|
||||
WRP_IRESEARCH_ANALYZER_TYPE, TRI_IGETC);
|
||||
EXPECT_FALSE(!analyzer);
|
||||
|
@ -2184,7 +2184,7 @@ TEST_F(V8AnalyzersTest, test_list) {
|
|||
EXPECT_FALSE(v8Analyzer.IsEmpty());
|
||||
EXPECT_TRUE(v8Analyzer->IsObject());
|
||||
auto* analyzer =
|
||||
TRI_UnwrapClass<arangodb::iresearch::IResearchAnalyzerFeature::AnalyzerPool>(
|
||||
TRI_UnwrapClass<arangodb::iresearch::AnalyzerPool>(
|
||||
v8Analyzer->ToObject(TRI_IGETC).FromMaybe(v8::Local<v8::Object>()),
|
||||
WRP_IRESEARCH_ANALYZER_TYPE, TRI_IGETC);
|
||||
EXPECT_FALSE(!analyzer);
|
||||
|
@ -2250,7 +2250,7 @@ TEST_F(V8AnalyzersTest, test_list) {
|
|||
EXPECT_FALSE(v8Analyzer.IsEmpty());
|
||||
EXPECT_TRUE(v8Analyzer->IsObject());
|
||||
auto* analyzer =
|
||||
TRI_UnwrapClass<arangodb::iresearch::IResearchAnalyzerFeature::AnalyzerPool>(
|
||||
TRI_UnwrapClass<arangodb::iresearch::AnalyzerPool>(
|
||||
v8Analyzer->ToObject(TRI_IGETC).FromMaybe(v8::Local<v8::Object>()),
|
||||
WRP_IRESEARCH_ANALYZER_TYPE, TRI_IGETC);
|
||||
EXPECT_FALSE(!analyzer);
|
||||
|
@ -2315,7 +2315,7 @@ TEST_F(V8AnalyzersTest, test_list) {
|
|||
EXPECT_FALSE(v8Analyzer.IsEmpty());
|
||||
EXPECT_TRUE(v8Analyzer->IsObject());
|
||||
auto* analyzer =
|
||||
TRI_UnwrapClass<arangodb::iresearch::IResearchAnalyzerFeature::AnalyzerPool>(
|
||||
TRI_UnwrapClass<arangodb::iresearch::AnalyzerPool>(
|
||||
v8Analyzer->ToObject(TRI_IGETC).FromMaybe(v8::Local<v8::Object>()),
|
||||
WRP_IRESEARCH_ANALYZER_TYPE, TRI_IGETC);
|
||||
EXPECT_FALSE(!analyzer);
|
||||
|
|
|
@ -85,7 +85,7 @@ struct TestView : public arangodb::LogicalView {
|
|||
: arangodb::LogicalView(vocbase, definition, planVersion) {}
|
||||
virtual arangodb::Result appendVelocyPackImpl(
|
||||
arangodb::velocypack::Builder& builder,
|
||||
std::underlying_type<arangodb::LogicalDataSource::Serialize>::type) const override {
|
||||
Serialization) const override {
|
||||
builder.add("properties", _properties.slice());
|
||||
return _appendVelocyPackResult;
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@ struct TestView : public arangodb::LogicalView {
|
|||
: arangodb::LogicalView(vocbase, definition, planVersion) {}
|
||||
virtual arangodb::Result appendVelocyPackImpl(
|
||||
arangodb::velocypack::Builder& builder,
|
||||
std::underlying_type<arangodb::LogicalDataSource::Serialize>::type) const override {
|
||||
Serialization) const override {
|
||||
builder.add("properties", _properties.slice());
|
||||
return _appendVelocyPackResult;
|
||||
}
|
||||
|
|
|
@ -32,9 +32,33 @@
|
|||
#include "VocBase/LogicalView.h"
|
||||
#include "velocypack/Parser.h"
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- setup / tear-down
|
||||
// -----------------------------------------------------------------------------
|
||||
namespace {
|
||||
|
||||
class LogicalViewImpl : public arangodb::LogicalView {
|
||||
public:
|
||||
LogicalViewImpl(TRI_vocbase_t& vocbase, arangodb::velocypack::Slice const& definition)
|
||||
: LogicalView(vocbase, definition, 0) {}
|
||||
virtual arangodb::Result appendVelocyPackImpl(
|
||||
arangodb::velocypack::Builder&, Serialization) const override {
|
||||
return arangodb::Result();
|
||||
}
|
||||
virtual arangodb::Result dropImpl() override {
|
||||
return arangodb::Result();
|
||||
}
|
||||
virtual void open() override {}
|
||||
virtual arangodb::Result renameImpl(std::string const&) override {
|
||||
return arangodb::Result();
|
||||
}
|
||||
virtual arangodb::Result properties(arangodb::velocypack::Slice const& properties,
|
||||
bool partialUpdate) override {
|
||||
return arangodb::Result();
|
||||
}
|
||||
virtual bool visitCollections(CollectionVisitor const& visitor) const override {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
class LogicalDataSourceTest : public ::testing::Test {
|
||||
protected:
|
||||
|
@ -93,31 +117,6 @@ TEST_F(LogicalDataSourceTest, test_category) {
|
|||
|
||||
// LogicalView
|
||||
{
|
||||
class LogicalViewImpl : public arangodb::LogicalView {
|
||||
public:
|
||||
LogicalViewImpl(TRI_vocbase_t& vocbase, arangodb::velocypack::Slice const& definition)
|
||||
: LogicalView(vocbase, definition, 0) {}
|
||||
virtual arangodb::Result appendVelocyPackImpl(
|
||||
arangodb::velocypack::Builder&,
|
||||
std::underlying_type<arangodb::LogicalDataSource::Serialize>::type) const override {
|
||||
return arangodb::Result();
|
||||
}
|
||||
virtual arangodb::Result dropImpl() override {
|
||||
return arangodb::Result();
|
||||
}
|
||||
virtual void open() override {}
|
||||
virtual arangodb::Result renameImpl(std::string const&) override {
|
||||
return arangodb::Result();
|
||||
}
|
||||
virtual arangodb::Result properties(arangodb::velocypack::Slice const& properties,
|
||||
bool partialUpdate) override {
|
||||
return arangodb::Result();
|
||||
}
|
||||
virtual bool visitCollections(CollectionVisitor const& visitor) const override {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
TRI_vocbase_t vocbase(TRI_vocbase_type_e::TRI_VOCBASE_TYPE_NORMAL, testDBInfo(server.server()));
|
||||
auto json =
|
||||
arangodb::velocypack::Parser::fromJson("{ \"name\": \"testView\" }");
|
||||
|
@ -143,31 +142,6 @@ TEST_F(LogicalDataSourceTest, test_construct) {
|
|||
|
||||
// LogicalView
|
||||
{
|
||||
class LogicalViewImpl : public arangodb::LogicalView {
|
||||
public:
|
||||
LogicalViewImpl(TRI_vocbase_t& vocbase, arangodb::velocypack::Slice const& definition)
|
||||
: LogicalView(vocbase, definition, 0) {}
|
||||
virtual arangodb::Result appendVelocyPackImpl(
|
||||
arangodb::velocypack::Builder&,
|
||||
std::underlying_type<arangodb::LogicalDataSource::Serialize>::type) const override {
|
||||
return arangodb::Result();
|
||||
}
|
||||
virtual arangodb::Result dropImpl() override {
|
||||
return arangodb::Result();
|
||||
}
|
||||
virtual void open() override {}
|
||||
virtual arangodb::Result renameImpl(std::string const&) override {
|
||||
return arangodb::Result();
|
||||
}
|
||||
virtual arangodb::Result properties(arangodb::velocypack::Slice const& properties,
|
||||
bool partialUpdate) override {
|
||||
return arangodb::Result();
|
||||
}
|
||||
virtual bool visitCollections(CollectionVisitor const& visitor) const override {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
TRI_vocbase_t vocbase(TRI_vocbase_type_e::TRI_VOCBASE_TYPE_NORMAL, testDBInfo(server.server()));
|
||||
auto json = arangodb::velocypack::Parser::fromJson(
|
||||
"{ \"id\": 1, \"planId\": 2, \"globallyUniqueId\": \"abc\", \"name\": "
|
||||
|
@ -195,31 +169,6 @@ TEST_F(LogicalDataSourceTest, test_defaults) {
|
|||
|
||||
// LogicalView
|
||||
{
|
||||
class LogicalViewImpl : public arangodb::LogicalView {
|
||||
public:
|
||||
LogicalViewImpl(TRI_vocbase_t& vocbase, arangodb::velocypack::Slice const& definition)
|
||||
: LogicalView(vocbase, definition, 0) {}
|
||||
virtual arangodb::Result appendVelocyPackImpl(
|
||||
arangodb::velocypack::Builder&,
|
||||
std::underlying_type<arangodb::LogicalDataSource::Serialize>::type) const override {
|
||||
return arangodb::Result();
|
||||
}
|
||||
virtual arangodb::Result dropImpl() override {
|
||||
return arangodb::Result();
|
||||
}
|
||||
virtual void open() override {}
|
||||
virtual arangodb::Result renameImpl(std::string const&) override {
|
||||
return arangodb::Result();
|
||||
}
|
||||
virtual arangodb::Result properties(arangodb::velocypack::Slice const& properties,
|
||||
bool partialUpdate) override {
|
||||
return arangodb::Result();
|
||||
}
|
||||
virtual bool visitCollections(CollectionVisitor const& visitor) const override {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
TRI_vocbase_t vocbase(TRI_vocbase_type_e::TRI_VOCBASE_TYPE_NORMAL, testDBInfo(server.server()));
|
||||
auto json =
|
||||
arangodb::velocypack::Parser::fromJson("{ \"name\": \"testView\" }");
|
||||
|
|
|
@ -53,7 +53,7 @@ struct TestView : public arangodb::LogicalView {
|
|||
: arangodb::LogicalView(vocbase, definition, planVersion) {}
|
||||
virtual arangodb::Result appendVelocyPackImpl(
|
||||
arangodb::velocypack::Builder& builder,
|
||||
std::underlying_type<arangodb::LogicalDataSource::Serialize>::type) const override {
|
||||
Serialization) const override {
|
||||
builder.add("properties", _properties.slice());
|
||||
return _appendVelocyPackResult;
|
||||
}
|
||||
|
|
|
@ -42,8 +42,7 @@ struct TestView : public arangodb::LogicalView {
|
|||
TestView(TRI_vocbase_t& vocbase, arangodb::velocypack::Slice const& definition, uint64_t planVersion)
|
||||
: arangodb::LogicalView(vocbase, definition, planVersion) {}
|
||||
virtual arangodb::Result appendVelocyPackImpl(
|
||||
arangodb::velocypack::Builder&,
|
||||
std::underlying_type<arangodb::LogicalDataSource::Serialize>::type) const override {
|
||||
arangodb::velocypack::Builder&, Serialization) const override {
|
||||
return arangodb::Result();
|
||||
}
|
||||
virtual arangodb::Result dropImpl() override {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*jshint globalstrict:false, strict:false, maxlen : 4000 */
|
||||
/*global assertEqual, assertTrue, assertFalse */
|
||||
/*global assertEqual, assertNotEqual, assertTrue, assertFalse */
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief tests for dump/reload
|
||||
|
@ -337,12 +337,17 @@ function dumpTestSuite () {
|
|||
let view = db._view("UnitTestsDumpView");
|
||||
assertTrue(view !== null);
|
||||
let props = view.properties();
|
||||
assertEqual("UnitTestsDumpView", view.name());
|
||||
assertEqual(Object.keys(props.links).length, 1);
|
||||
assertTrue(props.hasOwnProperty("links"));
|
||||
assertTrue(props.links.hasOwnProperty("UnitTestsDumpViewCollection"));
|
||||
assertTrue(props.links.UnitTestsDumpViewCollection.hasOwnProperty("includeAllFields"));
|
||||
assertTrue(props.links.UnitTestsDumpViewCollection.hasOwnProperty("fields"));
|
||||
assertTrue(props.links.UnitTestsDumpViewCollection.includeAllFields);
|
||||
assertEqual(Object.keys(props.links.UnitTestsDumpViewCollection.fields).length, 1);
|
||||
assertTrue(props.links.UnitTestsDumpViewCollection.fields.text.analyzers.length, 2);
|
||||
assertTrue("text_en", props.links.UnitTestsDumpViewCollection.fields.text.analyzers[0]);
|
||||
assertTrue("UnitTestsDumpView::custom", props.links.UnitTestsDumpViewCollection.fields.text.analyzers[1]);
|
||||
|
||||
assertEqual(props.consolidationIntervalMsec, 0);
|
||||
assertEqual(props.cleanupIntervalStep, 456);
|
||||
|
@ -727,6 +732,72 @@ function dumpTestEnterpriseSuite () {
|
|||
assertEqual(6, p.numberOfShards);
|
||||
},
|
||||
|
||||
testViewOnSmartEdgeCollection : function() {
|
||||
try {
|
||||
db._createView("check", "arangosearch", {});
|
||||
} catch (err) {}
|
||||
|
||||
let views = db._views();
|
||||
if (views.length === 0) {
|
||||
return; // arangosearch views are not supported
|
||||
}
|
||||
|
||||
let view = db._view("UnitTestsDumpSmartView");
|
||||
assertNotEqual(null, view);
|
||||
let props = view.properties();
|
||||
assertEqual("UnitTestsDumpSmartView", view.name());
|
||||
assertTrue(props.hasOwnProperty("links"));
|
||||
// FIXME: currently view restoration is broken
|
||||
// we must restore 4 collections (virtual + 3 system)
|
||||
//assertEqual(Object.keys(props.links).length, 4); // virtual collecion + 3 system collections
|
||||
assertEqual(Object.keys(props.links).length, 1);
|
||||
|
||||
// UnitTestDumpSmartEdges
|
||||
assertTrue(props.links.hasOwnProperty("UnitTestDumpSmartEdges"));
|
||||
assertTrue(props.links.UnitTestDumpSmartEdges.hasOwnProperty("includeAllFields"));
|
||||
assertTrue(props.links.UnitTestDumpSmartEdges.includeAllFields);
|
||||
assertTrue(props.links.UnitTestDumpSmartEdges.hasOwnProperty("fields"));
|
||||
assertEqual(Object.keys(props.links.UnitTestDumpSmartEdges.fields).length, 1);
|
||||
assertTrue(props.links.UnitTestDumpSmartEdges.fields.text.analyzers.length, 2);
|
||||
assertTrue("text_en", props.links.UnitTestDumpSmartEdges.fields.text.analyzers[0]);
|
||||
assertTrue("UnitTestsDumpView::smartCustom", props.links.UnitTestDumpSmartEdges.fields.text.analyzers[1]);
|
||||
|
||||
// FIXME: currently view restoration is broken for system collections
|
||||
//// _to_UnitTestDumpSmartEdges
|
||||
//assertTrue(props.links.hasOwnProperty("_to_UnitTestDumpSmartEdges"));
|
||||
//assertTrue(props.links._to_UnitTestDumpSmartEdges.hasOwnProperty("includeAllFields"));
|
||||
//assertTrue(props.links._to_UnitTestDumpSmartEdges.includeAllFields);
|
||||
//assertTrue(props.links._to_UnitTestDumpSmartEdges.hasOwnProperty("fields"));
|
||||
//assertEqual(Object.keys(props.links._to_UnitTestDumpSmartEdges.fields).length, 1);
|
||||
//assertTrue(props.links._to_UnitTestDumpSmartEdges.fields.text.analyzers.length, 2);
|
||||
//assertTrue("text_en", props.links._to_UnitTestDumpSmartEdges.fields.text.analyzers[0]);
|
||||
//assertTrue("UnitTestsDumpView::smartCustom", props.links._to_UnitTestDumpSmartEdges.fields.text.analyzers[1]);
|
||||
|
||||
//// _from_UnitTestDumpSmartEdges
|
||||
//assertTrue(props.links.hasOwnProperty("_from_UnitTestDumpSmartEdges"));
|
||||
//assertTrue(props.links._from_UnitTestDumpSmartEdges.hasOwnProperty("includeAllFields"));
|
||||
//assertTrue(props.links._from_UnitTestDumpSmartEdges.includeAllFields);
|
||||
//assertTrue(props.links._from_UnitTestDumpSmartEdges.hasOwnProperty("fields"));
|
||||
//assertEqual(Object.keys(props.links._from_UnitTestDumpSmartEdges.fields).length, 1);
|
||||
//assertTrue(props.links._from_UnitTestDumpSmartEdges.fields.text.analyzers.length, 2);
|
||||
//assertTrue("text_en", props.links._from_UnitTestDumpSmartEdges.fields.text.analyzers[0]);
|
||||
//assertTrue("UnitTestsDumpView::smartCustom", props.links._from_UnitTestDumpSmartEdges.fields.text.analyzers[1]);
|
||||
|
||||
//// _local_UnitTestDumpSmartEdges
|
||||
//assertTrue(props.links.hasOwnProperty("_local_UnitTestDumpSmartEdges"));
|
||||
//assertTrue(props.links._local_UnitTestDumpSmartEdges.hasOwnProperty("includeAllFields"));
|
||||
//assertTrue(props.links._local_UnitTestDumpSmartEdges.includeAllFields);
|
||||
//assertTrue(props.links._local_UnitTestDumpSmartEdges.hasOwnProperty("fields"));
|
||||
//assertEqual(Object.keys(props.links._local_UnitTestDumpSmartEdges.fields).length, 1);
|
||||
//assertTrue(props.links._local_UnitTestDumpSmartEdges.fields.text.analyzers.length, 2);
|
||||
//assertTrue("text_en", props.links._local_UnitTestDumpSmartEdges.fields.text.analyzers[0]);
|
||||
//assertTrue("UnitTestsDumpView::smartCustom", props.links._local_UnitTestDumpSmartEdges.fields.text.analyzers[1]);
|
||||
//assertEqual(props.consolidationIntervalMsec, 0);
|
||||
//assertEqual(props.cleanupIntervalStep, 456);
|
||||
//assertTrue(Math.abs(props.consolidationPolicy.threshold - 0.3) < 0.001);
|
||||
//assertEqual(props.consolidationPolicy.type, "bytes_accum");
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*jshint globalstrict:false, strict:false, maxlen:4000 */
|
||||
/*global assertEqual, assertTrue, assertFalse, assertMatch */
|
||||
/*global assertEqual, assertNotEqual, assertTrue, assertFalse, assertMatch */
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief tests for dump/reload
|
||||
|
@ -452,14 +452,19 @@ function dumpTestSuite () {
|
|||
}
|
||||
|
||||
let view = db._view("UnitTestsDumpView");
|
||||
assertTrue(view !== null);
|
||||
assertNotEqual(null, view);
|
||||
let props = view.properties();
|
||||
assertEqual("UnitTestsDumpView", view.name());
|
||||
assertEqual(Object.keys(props.links).length, 1);
|
||||
assertTrue(props.hasOwnProperty("links"));
|
||||
assertTrue(props.links.hasOwnProperty("UnitTestsDumpViewCollection"));
|
||||
assertTrue(props.links.UnitTestsDumpViewCollection.hasOwnProperty("includeAllFields"));
|
||||
assertTrue(props.links.UnitTestsDumpViewCollection.hasOwnProperty("fields"));
|
||||
assertTrue(props.links.UnitTestsDumpViewCollection.includeAllFields);
|
||||
assertEqual(Object.keys(props.links.UnitTestsDumpViewCollection.fields).length, 1);
|
||||
assertTrue(props.links.UnitTestsDumpViewCollection.fields.text.analyzers.length, 2);
|
||||
assertTrue("text_en", props.links.UnitTestsDumpViewCollection.fields.text.analyzers[0]);
|
||||
assertTrue("UnitTestsDumpView::custom", props.links.UnitTestsDumpViewCollection.fields.text.analyzers[1]);
|
||||
|
||||
assertEqual(props.consolidationIntervalMsec, 0);
|
||||
assertEqual(props.cleanupIntervalStep, 456);
|
||||
|
@ -477,9 +482,25 @@ function dumpTestSuite () {
|
|||
|
||||
res = db._query("FOR doc IN UnitTestsDumpView SEARCH PHRASE(doc.text, 'foxx jumps over', 'text_en') RETURN doc").toArray();
|
||||
assertEqual(1, res.length);
|
||||
},
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief test custom analyzers restoring
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
testAnalyzers: function() {
|
||||
assertEqual(1, db._analyzers.count()); // only 1 stored custom analyzer
|
||||
|
||||
let analyzer = analyzers.analyzer("custom");
|
||||
assertEqual(db._name() + "::custom", analyzer.name());
|
||||
assertEqual("delimiter", analyzer.type());
|
||||
assertEqual(Object.keys(analyzer.properties()).length, 1);
|
||||
assertEqual(" ", analyzer.properties().delimiter);
|
||||
assertEqual(1, analyzer.features().length);
|
||||
assertEqual("frequency", analyzer.features()[0]);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*jshint globalstrict:false, strict:false, maxlen : 4000 */
|
||||
/*global assertEqual, assertTrue, assertFalse */
|
||||
/*global assertEqual, assertNotEqual, assertTrue, assertFalse */
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief tests for dump/reload
|
||||
|
@ -324,12 +324,17 @@ function dumpTestSuite () {
|
|||
let view = db._view("UnitTestsDumpView");
|
||||
assertTrue(view !== null);
|
||||
let props = view.properties();
|
||||
assertEqual("UnitTestsDumpView", view.name());
|
||||
assertEqual(Object.keys(props.links).length, 1);
|
||||
assertTrue(props.hasOwnProperty("links"));
|
||||
assertTrue(props.links.hasOwnProperty("UnitTestsDumpViewCollection"));
|
||||
assertTrue(props.links.UnitTestsDumpViewCollection.hasOwnProperty("includeAllFields"));
|
||||
assertTrue(props.links.UnitTestsDumpViewCollection.hasOwnProperty("fields"));
|
||||
assertTrue(props.links.UnitTestsDumpViewCollection.includeAllFields);
|
||||
assertEqual(Object.keys(props.links.UnitTestsDumpViewCollection.fields).length, 1);
|
||||
assertTrue(props.links.UnitTestsDumpViewCollection.fields.text.analyzers.length, 2);
|
||||
assertTrue("text_en", props.links.UnitTestsDumpViewCollection.fields.text.analyzers[0]);
|
||||
assertTrue("UnitTestsDumpView::custom", props.links.UnitTestsDumpViewCollection.fields.text.analyzers[1]);
|
||||
|
||||
assertEqual(props.consolidationIntervalMsec, 0);
|
||||
assertEqual(props.cleanupIntervalStep, 456);
|
||||
|
@ -721,8 +726,72 @@ function dumpTestEnterpriseSuite () {
|
|||
assertEqual(6, p.numberOfShards);
|
||||
},
|
||||
|
||||
};
|
||||
testViewOnSmartEdgeCollection : function() {
|
||||
try {
|
||||
db._createView("check", "arangosearch", {});
|
||||
} catch (err) {}
|
||||
|
||||
let views = db._views();
|
||||
if (views.length === 0) {
|
||||
return; // arangosearch views are not supported
|
||||
}
|
||||
|
||||
let view = db._view("UnitTestsDumpSmartView");
|
||||
assertNotEqual(null, view);
|
||||
let props = view.properties();
|
||||
assertEqual("UnitTestsDumpSmartView", view.name());
|
||||
assertTrue(props.hasOwnProperty("links"));
|
||||
// FIXME: currently view restoration is broken
|
||||
// we must restore 4 collections (virtual + 3 system)
|
||||
//assertEqual(Object.keys(props.links).length, 4); // virtual collecion + 3 system collections
|
||||
assertEqual(Object.keys(props.links).length, 1);
|
||||
|
||||
// UnitTestDumpSmartEdges
|
||||
assertTrue(props.links.hasOwnProperty("UnitTestDumpSmartEdges"));
|
||||
assertTrue(props.links.UnitTestDumpSmartEdges.hasOwnProperty("includeAllFields"));
|
||||
assertTrue(props.links.UnitTestDumpSmartEdges.includeAllFields);
|
||||
assertTrue(props.links.UnitTestDumpSmartEdges.hasOwnProperty("fields"));
|
||||
assertEqual(Object.keys(props.links.UnitTestDumpSmartEdges.fields).length, 1);
|
||||
assertTrue(props.links.UnitTestDumpSmartEdges.fields.text.analyzers.length, 2);
|
||||
assertTrue("text_en", props.links.UnitTestDumpSmartEdges.fields.text.analyzers[0]);
|
||||
assertTrue("UnitTestsDumpView::smartCustom", props.links.UnitTestDumpSmartEdges.fields.text.analyzers[1]);
|
||||
|
||||
// FIXME: currently view restoration is broken for system collections
|
||||
//// _to_UnitTestDumpSmartEdges
|
||||
//assertTrue(props.links.hasOwnProperty("_to_UnitTestDumpSmartEdges"));
|
||||
//assertTrue(props.links._to_UnitTestDumpSmartEdges.hasOwnProperty("includeAllFields"));
|
||||
//assertTrue(props.links._to_UnitTestDumpSmartEdges.includeAllFields);
|
||||
//assertTrue(props.links._to_UnitTestDumpSmartEdges.hasOwnProperty("fields"));
|
||||
//assertEqual(Object.keys(props.links._to_UnitTestDumpSmartEdges.fields).length, 1);
|
||||
//assertTrue(props.links._to_UnitTestDumpSmartEdges.fields.text.analyzers.length, 2);
|
||||
//assertTrue("text_en", props.links._to_UnitTestDumpSmartEdges.fields.text.analyzers[0]);
|
||||
//assertTrue("UnitTestsDumpView::smartCustom", props.links._to_UnitTestDumpSmartEdges.fields.text.analyzers[1]);
|
||||
|
||||
//// _from_UnitTestDumpSmartEdges
|
||||
//assertTrue(props.links.hasOwnProperty("_from_UnitTestDumpSmartEdges"));
|
||||
//assertTrue(props.links._from_UnitTestDumpSmartEdges.hasOwnProperty("includeAllFields"));
|
||||
//assertTrue(props.links._from_UnitTestDumpSmartEdges.includeAllFields);
|
||||
//assertTrue(props.links._from_UnitTestDumpSmartEdges.hasOwnProperty("fields"));
|
||||
//assertEqual(Object.keys(props.links._from_UnitTestDumpSmartEdges.fields).length, 1);
|
||||
//assertTrue(props.links._from_UnitTestDumpSmartEdges.fields.text.analyzers.length, 2);
|
||||
//assertTrue("text_en", props.links._from_UnitTestDumpSmartEdges.fields.text.analyzers[0]);
|
||||
//assertTrue("UnitTestsDumpView::smartCustom", props.links._from_UnitTestDumpSmartEdges.fields.text.analyzers[1]);
|
||||
|
||||
//// _local_UnitTestDumpSmartEdges
|
||||
//assertTrue(props.links.hasOwnProperty("_local_UnitTestDumpSmartEdges"));
|
||||
//assertTrue(props.links._local_UnitTestDumpSmartEdges.hasOwnProperty("includeAllFields"));
|
||||
//assertTrue(props.links._local_UnitTestDumpSmartEdges.includeAllFields);
|
||||
//assertTrue(props.links._local_UnitTestDumpSmartEdges.hasOwnProperty("fields"));
|
||||
//assertEqual(Object.keys(props.links._local_UnitTestDumpSmartEdges.fields).length, 1);
|
||||
//assertTrue(props.links._local_UnitTestDumpSmartEdges.fields.text.analyzers.length, 2);
|
||||
//assertTrue("text_en", props.links._local_UnitTestDumpSmartEdges.fields.text.analyzers[0]);
|
||||
//assertTrue("UnitTestsDumpView::smartCustom", props.links._local_UnitTestDumpSmartEdges.fields.text.analyzers[1]);
|
||||
//assertEqual(props.consolidationIntervalMsec, 0);
|
||||
//assertEqual(props.cleanupIntervalStep, 456);
|
||||
//assertTrue(Math.abs(props.consolidationPolicy.threshold - 0.3) < 0.001);
|
||||
//assertEqual(props.consolidationPolicy.type, "bytes_accum");
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
jsunity.run(dumpTestSuite);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*jshint globalstrict:false, strict:false, maxlen:4000 */
|
||||
/*global assertEqual, assertTrue, assertFalse */
|
||||
/*global assertEqual, assertNotEqual, assertTrue, assertFalse */
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief tests for dump/reload
|
||||
|
@ -404,14 +404,19 @@ function dumpTestSuite () {
|
|||
}
|
||||
|
||||
let view = db._view("UnitTestsDumpView");
|
||||
assertTrue(view !== null);
|
||||
assertNotEqual(null, view);
|
||||
let props = view.properties();
|
||||
assertEqual("UnitTestsDumpView", view.name());
|
||||
assertEqual(Object.keys(props.links).length, 1);
|
||||
assertTrue(props.hasOwnProperty("links"));
|
||||
assertTrue(props.links.hasOwnProperty("UnitTestsDumpViewCollection"));
|
||||
assertTrue(props.links.UnitTestsDumpViewCollection.hasOwnProperty("includeAllFields"));
|
||||
assertTrue(props.links.UnitTestsDumpViewCollection.hasOwnProperty("fields"));
|
||||
assertTrue(props.links.UnitTestsDumpViewCollection.includeAllFields);
|
||||
assertEqual(Object.keys(props.links.UnitTestsDumpViewCollection.fields).length, 1);
|
||||
assertTrue(props.links.UnitTestsDumpViewCollection.fields.text.analyzers.length, 2);
|
||||
assertTrue("text_en", props.links.UnitTestsDumpViewCollection.fields.text.analyzers[0]);
|
||||
assertTrue("UnitTestsDumpView::custom", props.links.UnitTestsDumpViewCollection.fields.text.analyzers[1]);
|
||||
|
||||
assertEqual(props.consolidationIntervalMsec, 0);
|
||||
assertEqual(props.cleanupIntervalStep, 456);
|
||||
|
@ -442,6 +447,21 @@ function dumpTestSuite () {
|
|||
|
||||
res = db._query("FOR doc IN UnitTestsDumpView SEARCH PHRASE(doc.text, 'foxx jumps over', 'text_en') RETURN doc").toArray();
|
||||
assertEqual(1, res.length);
|
||||
},
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief test custom analyzers restoring
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
testAnalyzers: function() {
|
||||
assertEqual(1, db._analyzers.count()); // only 1 stored custom analyzer
|
||||
|
||||
let analyzer = analyzers.analyzer("custom");
|
||||
assertEqual(db._name() + "::custom", analyzer.name());
|
||||
assertEqual("delimiter", analyzer.type());
|
||||
assertEqual(Object.keys(analyzer.properties()).length, 1);
|
||||
assertEqual(" ", analyzer.properties().delimiter);
|
||||
assertEqual(1, analyzer.features().length);
|
||||
assertEqual("frequency", analyzer.features()[0]);
|
||||
}
|
||||
|
||||
};
|
||||
|
|
|
@ -75,6 +75,43 @@ const setupSmartGraph = function () {
|
|||
db[orphans].save(vDocs);
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Only if enterprise mode:
|
||||
* Creates an arangosearch over smart edge collection
|
||||
*/
|
||||
const setupSmartArangoSearch = function () {
|
||||
if (!isEnterprise) {
|
||||
return;
|
||||
}
|
||||
|
||||
db._dropView("UnitTestsDumpSmartView");
|
||||
|
||||
let analyzers = require("@arangodb/analyzers");
|
||||
try {
|
||||
analyzers.remove("smartCustom");
|
||||
} catch (err) { }
|
||||
let analyzer = analyzers.save("smartCustom", "delimiter", { delimiter : "smart" }, [ "frequency" ]);
|
||||
|
||||
db._createView("UnitTestsDumpSmartView", "arangosearch", {
|
||||
// choose non default values to check if they are corretly dumped and imported
|
||||
cleanupIntervalStep: 456,
|
||||
consolidationPolicy: {
|
||||
threshold: 0.3,
|
||||
type: "bytes_accum"
|
||||
},
|
||||
consolidationIntervalMsec: 0,
|
||||
links : {
|
||||
"UnitTestDumpSmartEdges": {
|
||||
includeAllFields: true,
|
||||
fields: {
|
||||
text: { analyzers: [ "text_en", "smartCustom" ] }
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @brief Only if enterprise mode:
|
||||
* Creates a satellite collection with 100 documents
|
||||
|
@ -221,6 +258,8 @@ function setupSatelliteCollections() {
|
|||
c.save({ _key: "text" + i, value: t });
|
||||
});
|
||||
|
||||
let analyzer = analyzers.save("custom", "delimiter", { delimiter : " " }, [ "frequency" ]);
|
||||
|
||||
// setup a view
|
||||
try {
|
||||
c = db._create("UnitTestsDumpViewCollection");
|
||||
|
@ -238,7 +277,7 @@ function setupSatelliteCollections() {
|
|||
"UnitTestsDumpViewCollection": {
|
||||
includeAllFields: true,
|
||||
fields: {
|
||||
text: { analyzers: [ "text_en" ] }
|
||||
text: { analyzers: [ "text_en", analyzer.name ] }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -249,6 +288,7 @@ function setupSatelliteCollections() {
|
|||
} catch (err) { }
|
||||
|
||||
setupSmartGraph();
|
||||
setupSmartArangoSearch();
|
||||
setupSatelliteCollections();
|
||||
|
||||
db._create("UnitTestsDumpReplicationFactor1", { replicationFactor: 1, numberOfShards: 7 });
|
||||
|
|
|
@ -230,6 +230,8 @@
|
|||
|
||||
c.save(Array(10000).fill().map((e, i, a) => Object({_key: "test" + i, value: i})));
|
||||
|
||||
let analyzer = analyzers.save("custom", "delimiter", { delimiter : " " }, [ "frequency" ]);
|
||||
|
||||
// setup a view
|
||||
try {
|
||||
c = db._create("UnitTestsDumpViewCollection");
|
||||
|
@ -247,7 +249,7 @@
|
|||
"UnitTestsDumpViewCollection": {
|
||||
includeAllFields: true,
|
||||
fields: {
|
||||
text: { analyzers: [ "text_en" ] }
|
||||
text: { analyzers: [ "text_en", analyzer.name ] }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* jshint globalstrict:false, strict:false, unused: false */
|
||||
/* global arango, assertEqual, assertTrue, assertFalse, ARGUMENTS */
|
||||
/* global arango, assertEqual, assertNotEqual, assertTrue, assertFalse, ARGUMENTS */
|
||||
|
||||
// //////////////////////////////////////////////////////////////////////////////
|
||||
// / @brief test the sync method of the replication
|
||||
|
@ -861,10 +861,13 @@ function BaseTestConfig () {
|
|||
testSyncView: function () {
|
||||
connectToMaster();
|
||||
|
||||
// create custom analyzer
|
||||
let analyzer = analyzers.save('custom', 'delimiter', { delimiter: ' ' }, ['frequency']);
|
||||
|
||||
// create view & collection on master
|
||||
db._flushCache();
|
||||
db._create(cn);
|
||||
db._createView(cn + 'View', 'arangosearch');
|
||||
db._createView(cn + 'View', 'arangosearch', {consolidationIntervalMsec:0});
|
||||
|
||||
db._flushCache();
|
||||
connectToSlave();
|
||||
|
@ -879,6 +882,7 @@ function BaseTestConfig () {
|
|||
assertTrue(view !== null);
|
||||
let props = view.properties();
|
||||
assertTrue(props.hasOwnProperty('links'));
|
||||
assertEqual(0, props.consolidationIntervalMsec);
|
||||
assertEqual(Object.keys(props.links).length, 0);
|
||||
}
|
||||
|
||||
|
@ -891,7 +895,7 @@ function BaseTestConfig () {
|
|||
links[cn] = {
|
||||
includeAllFields: true,
|
||||
fields: {
|
||||
text: { analyzers: ['text_en'] }
|
||||
text: { analyzers: ['text_en', 'custom' ] }
|
||||
}
|
||||
};
|
||||
view.properties({ links });
|
||||
|
@ -902,13 +906,28 @@ function BaseTestConfig () {
|
|||
|
||||
replication.sync({ endpoint: masterEndpoint });
|
||||
|
||||
// check replicated analyzer
|
||||
{
|
||||
let analyzerSlave = analyzers.analyzer('custom');
|
||||
assertEqual(analyzer.name, analyzerSlave.name());
|
||||
assertEqual(analyzer.type, analyzerSlave.type());
|
||||
assertEqual(analyzer.properties, analyzerSlave.properties());
|
||||
assertEqual(analyzer.features, analyzerSlave.features());
|
||||
}
|
||||
|
||||
{
|
||||
let view = db._view(cn + 'View');
|
||||
assertTrue(view !== null);
|
||||
assertNotEqual(view, null);
|
||||
let props = view.properties();
|
||||
assertEqual(0, props.consolidationIntervalMsec);
|
||||
assertTrue(props.hasOwnProperty('links'));
|
||||
assertEqual(Object.keys(props.links).length, 1);
|
||||
assertTrue(props.links.hasOwnProperty(cn));
|
||||
assertTrue(props.links[cn].includeAllFields);
|
||||
assertEqual(Object.keys(props.links[cn].fields).length, 1);
|
||||
assertEqual(props.links[cn].fields.text.analyzers.length, 2);
|
||||
assertEqual(props.links[cn].fields.text.analyzers[0], 'text_en');
|
||||
assertEqual(props.links[cn].fields.text.analyzers[1], 'custom');
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -1764,6 +1783,9 @@ function ReplicationSuite () {
|
|||
} catch (ignored) {}
|
||||
db._drop(cn);
|
||||
db._drop(sysCn, {isSystem: true});
|
||||
try {
|
||||
analyzers.remove('custom');
|
||||
} catch (e) { }
|
||||
|
||||
connectToSlave();
|
||||
try {
|
||||
|
@ -1771,6 +1793,9 @@ function ReplicationSuite () {
|
|||
} catch (ignored) {}
|
||||
db._drop(cn);
|
||||
db._drop(sysCn, {isSystem: true});
|
||||
try {
|
||||
analyzers.remove('custom');
|
||||
} catch (e) { }
|
||||
}
|
||||
};
|
||||
deriveTestSuite(BaseTestConfig(), suite, '_Repl');
|
||||
|
|
Loading…
Reference in New Issue