mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'devel' of github.com:arangodb/arangodb into devel
This commit is contained in:
commit
c234bf1304
|
@ -871,6 +871,16 @@ arangodb::Result IResearchAnalyzerFeature::emplaceAnalyzer( // emplace
|
||||||
irs::string_ref const& properties, // analyzer properties
|
irs::string_ref const& properties, // analyzer properties
|
||||||
irs::flags const& features // analyzer features
|
irs::flags const& features // analyzer features
|
||||||
) {
|
) {
|
||||||
|
// validate analyzer name
|
||||||
|
auto split = splitAnalyzerName(name);
|
||||||
|
|
||||||
|
if (!TRI_vocbase_t::IsAllowedName(false, arangodb::velocypack::StringRef(split.second.c_str(), split.second.size()))) {
|
||||||
|
return arangodb::Result( // result
|
||||||
|
TRI_ERROR_BAD_PARAMETER, // code
|
||||||
|
std::string("invalid characters in analyzer name '") + std::string(split.second) + "'"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// validate that features are supported by arangod an ensure that their
|
// validate that features are supported by arangod an ensure that their
|
||||||
// dependencies are met
|
// dependencies are met
|
||||||
for(auto& feature: features) {
|
for(auto& feature: features) {
|
||||||
|
|
|
@ -583,6 +583,14 @@ SECTION("test_emplace") {
|
||||||
CHECK((true == !feature.get(arangodb::StaticStrings::SystemDatabase + "::test_analyzer11")));
|
CHECK((true == !feature.get(arangodb::StaticStrings::SystemDatabase + "::test_analyzer11")));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// add invalid (name has invalid char)
|
||||||
|
{
|
||||||
|
arangodb::iresearch::IResearchAnalyzerFeature::EmplaceResult result;
|
||||||
|
arangodb::iresearch::IResearchAnalyzerFeature feature(s.server);
|
||||||
|
CHECK((false == feature.emplace(result, arangodb::StaticStrings::SystemDatabase + "::test_analyzer12+", "TestAnalyzer", "abc").ok()));
|
||||||
|
CHECK((true == !feature.get(arangodb::StaticStrings::SystemDatabase + "::test_analyzer12+")));
|
||||||
|
}
|
||||||
|
|
||||||
// add static analyzer
|
// add static analyzer
|
||||||
{
|
{
|
||||||
arangodb::iresearch::IResearchAnalyzerFeature::EmplaceResult result;
|
arangodb::iresearch::IResearchAnalyzerFeature::EmplaceResult result;
|
||||||
|
|
Loading…
Reference in New Issue