@@ -303,7 +303,8 @@ irs::analysis::analyzer::ptr text_vpack_builder(irs::string_ref const& args) noe
303
303
bool text_vpack_normalizer (const irs::string_ref& args, std::string& out) noexcept {
304
304
std::string tmp;
305
305
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 )) {
307
308
auto vpack = VPackParser::fromJson (tmp);
308
309
out.resize (vpack->slice ().byteSize ());
309
310
std::memcpy (&out[0 ], vpack->slice ().begin (), out.size ());
@@ -327,7 +328,7 @@ namespace stem_vpack {
327
328
bool stem_vpack_normalizer (const irs::string_ref& args, std::string& out) noexcept {
328
329
std::string tmp;
329
330
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 )) {
331
332
auto vpack = VPackParser::fromJson (tmp);
332
333
out.resize (vpack->slice ().byteSize ());
333
334
std::memcpy (&out[0 ], vpack->slice ().begin (), out.size ());
@@ -351,7 +352,7 @@ namespace norm_vpack {
351
352
bool norm_vpack_normalizer (const irs::string_ref& args, std::string& out) noexcept {
352
353
std::string tmp;
353
354
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 )) {
355
356
auto vpack = VPackParser::fromJson (tmp);
356
357
out.resize (vpack->slice ().byteSize ());
357
358
std::memcpy (&out[0 ], vpack->slice ().begin (), out.size ());
@@ -500,6 +501,9 @@ bool equalAnalyzer(
500
501
501
502
if (!::normalize (normalizedProperties, type, properties)) {
502
503
// 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 () << " '" ;
503
507
return false ;
504
508
}
505
509
@@ -1157,12 +1161,22 @@ arangodb::Result IResearchAnalyzerFeature::emplaceAnalyzer( // emplace
1157
1161
1158
1162
erase = false ;
1159
1163
} 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
+
1166
1180
}
1167
1181
1168
1182
result = itr;
@@ -2227,35 +2241,14 @@ arangodb::Result IResearchAnalyzerFeature::storeAnalyzer(AnalyzerPool& pool) {
2227
2241
2228
2242
try {
2229
2243
auto collection = getAnalyzerCollection (*vocbase);
2230
-
2231
2244
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
+ );
2259
2252
}
2260
2253
2261
2254
arangodb::SingleCollectionTransaction trx ( // transaction
0 commit comments