8000 Merge branch 'devel' of https://github.com/arangodb/arangodb into fea… · arangodb/arangodb@26bc5d8 · GitHub
[go: up one dir, main page]

Skip to content

Commit 26bc5d8

Browse files
committed
Merge branch 'devel' of https://github.com/arangodb/arangodb into feature/one-shard-db
* 'devel' of https://github.com/arangodb/arangodb: Bug fix/internal issue #586 (#9401) fix tests that didn't properly use env variable to look for test (#9399)
2 parents 51a57c8 + b70d737 commit 26bc5d8

25 files changed

+272
-1390
lines changed

arangod/IResearch/IResearchAnalyzerFeature.cpp

Lines changed: 30 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,8 @@ irs::analysis::analyzer::ptr text_vpack_builder(irs::string_ref const& args) noe
303303
bool text_vpack_normalizer(const irs::string_ref& args, std::string& out) noexcept {
304304
std::string tmp;
305305
if (irs::analysis::analyzers::normalize(tmp, "text", irs::text_format::json,
306-
arangodb::iresearch::slice<char>(args).toString())) {
306+
arangodb::iresearch::slice<char>(args).toString(),
307+
false)) {
307308
auto vpack = VPackParser::fromJson(tmp);
308309
out.resize(vpack->slice().byteSize());
309310
std::memcpy(&out[0], vpack->slice().begin(), out.size());
@@ -327,7 +328,7 @@ namespace stem_vpack {
327328
bool stem_vpack_normalizer(const irs::string_ref& args, std::string& out) noexcept {
328329
std::string tmp;
329330
if (irs::analysis::analyzers::normalize(tmp, "stem", irs::text_format::json,
330-
arangodb::iresearch::slice<char>(args).toString())) {
331+
arangodb::iresearch::slice<char>(args).toString(), false)) {
331332
auto vpack = VPackParser::fromJson(tmp);
332333
out.resize(vpack->slice().byteSize());
333334
std::memcpy(&out[0], vpack->slice().begin(), out.size());
@@ -351,7 +352,7 @@ namespace norm_vpack {
351352
bool norm_vpack_normalizer(const irs::string_ref& args, std::string& out) noexcept {
352353
std::string tmp;
353354
if (irs::analysis::analyzers::normalize(tmp, "norm", irs::text_format::json,
354-
arangodb::iresearch::slice<char>(args).toString())) {
355+
arangodb::iresearch::slice<char>(args).toString(), false)) {
355356
auto vpack = VPackParser::fromJson(tmp);
356357
out.resize(vpack->slice().byteSize());
357358
std::memcpy(&out[0], vpack->slice().begin(), out.size());
@@ -500,6 +501,9 @@ bool equalAnalyzer(
500501

501502
if (!::normalize(normalizedProperties, type, properties)) {
502503
// failed to normalize definition
504+
LOG_TOPIC("dfac1", WARN, arangodb::iresearch::TOPIC)
505+
<< "failed to normalize properties for analyzer type '" << type << "' properties '"
506+
<< properties.toString() << "'";
503507
return false;
504508
}
505509

@@ -1157,12 +1161,22 @@ arangodb::Result IResearchAnalyzerFeature::emplaceAnalyzer( // emplace
11571161

11581162
erase = false;
11591163
} else if (!equalAnalyzer(*analyzer, type, properties, features)) { // duplicate analyzer with different configuration
1160-
return arangodb::Result(
1161-
TRI_ERROR_BAD_PARAMETER,
1162-
"name collision detected while registering an arangosearch analizer name '" + std::string(name) +
1163-
"' type '" + std::string(type) + "' properties '" + properties.toString() +
1164-
"', previous registration type '" + std::string(analyzer->type()) +
1165-
"' properties '" + analyzer->properties().toString() + "'");
1164+
std::ostringstream errorText;
1165+
errorText << "name collision detected while registering an arangosearch analyzer name '" << name
1166+
<< "' type '" << type << "' properties '" << properties.toString()
1167+
<< "' features '";
1168+
for(auto feature : features) {
1169+
errorText << feature->name() << " ";
1170+
}
1171+
errorText << "', previous registration type '" << analyzer->type()
1172+
<< "' properties '" << analyzer->properties().toString() << "'"
1173+
<< " features '";
1174+
for(auto feature : analyzer->features()) {
1175+
errorText << feature->name() << " ";
1176+
}
1177+
errorText << "'";
1178+
return arangodb::Result(TRI_ERROR_BAD_PARAMETER, errorText.str());
1179+
11661180
}
11671181

11681182
result = itr;
@@ -2227,35 +2241,14 @@ arangodb::Result IResearchAnalyzerFeature::storeAnalyzer(AnalyzerPool& pool) {
22272241

22282242
try {
22292243
auto collection = getAnalyzerCollection(*vocbase);
2230-
22312244
if (!collection) {
2232-
auto collectionCallback = [&collection]( // store collection
2233-
std::shared_ptr<arangodb::LogicalCollection> const& col // args
2234-
)->void {
2235-
collection = col;
2236-
};
2237-
static auto const properties = // analyzer collection properties
2238-
arangodb::velocypack::Parser::fromJson("{ \"isSystem\": true }");
2239-
auto res = arangodb::methods::Collections::create( // create collection
2240-
*vocbase, // collection vocbase
2241-
ANALYZER_COLLECTION_NAME, // collection name
2242-
TRI_col_type_e::TRI_COL_TYPE_DOCUMENT, // collection type
2243-
properties->slice(), // collection properties
2244-
true, // waitsForSyncReplication same as UpgradeTasks::createSystemCollection(...)
2245-
true, // enforceReplicationFactor same as UpgradeTasks::createSystemCollection(...)
2246-
collectionCallback // callback if created
2247-
);
2248-
2249-
if (!res.ok()) {
2250-
return res;
2251-
}
2252-
2253-
if (!collection) {
2254-
return arangodb::Result( // result
2255-
TRI_ERROR_INTERNAL, // code
2256-
std::string("failure to create collection '") + ANALYZER_COLLECTION_NAME + "' in vocbase '" + vocbase->name() + "' vocbase while persising arangosearch analyzer '" + pool.name()+ "'"
2257-
);
2258-
}
2245+
return arangodb::Result( // result
2246+
TRI_ERROR_ARANGO_DATA_SOURCE_NOT_FOUND, // code
2247+
std::string("failure to find collection '") +
2248+
ANALYZER_COLLECTION_NAME +
2249+
"' in vocbase '" + vocbase->name() +
2250+
"' vocbase while persising arangosearch analyzer '" + pool.name()+ "'"
2251+
);
22592252
}
22602253

22612254
arangodb::SingleCollectionTransaction trx( // transaction

0 commit comments

Comments
 (0)
0