Skip to content

Commit df16ebc

Browse files
committed
Support alternate property names for native field match
Allows properties to be specified using either the traditional format 'featureName.propertyName.fieldName' or the alternate format 'featureName(fieldName).propertyName', with fallback to support both naming conventions. This applies to averageFieldLength and firstOccurrenceImportance properties for the native field match feature.
1 parent 0335e73 commit df16ebc

1 file changed

Lines changed: 17 additions & 4 deletions

File tree

searchlib/src/vespa/searchlib/features/nativefieldmatchfeature.cpp

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include "nativefieldmatchfeature.h"
44
#include "valuefeature.h"
55
#include "utils.h"
6+
#include <vespa/searchlib/fef/featurenamebuilder.h>
67
#include <vespa/searchlib/fef/fieldinfo.h>
78
#include <vespa/searchlib/fef/indexproperties.h>
89
#include <vespa/searchlib/fef/itablemanager.h>
@@ -161,14 +162,26 @@ NativeFieldMatchBlueprint::setup(const IIndexEnvironment & env,
161162
{
162163
param.field = false;
163164
}
164-
Property afl = env.getProperties().lookup(getBaseName(), "averageFieldLength", info->name());
165+
std::string alt_name = FeatureNameBuilder()
166+
.baseName(getBaseName())
167+
.parameter(info->name())
168+
.buildName();
169+
170+
Property afl = env.getProperties().lookup(alt_name, "averageFieldLength");
171+
if (!afl.found()) {
172+
afl = env.getProperties().lookup(getBaseName(), "averageFieldLength", info->name());
173+
}
165174
if (afl.found()) {
166175
param.averageFieldLength = util::strToNum<uint32_t>(afl.get());
167176
}
168177

169-
param.firstOccImportance = util::strToNum<feature_t>
170-
(env.getProperties().lookup(getBaseName(), "firstOccurrenceImportance", info->name()).
171-
get(defaultFirstOccImportance));
178+
std::string alt_importance = env.getProperties()
179+
.lookup(alt_name, "firstOccurrenceImportance")
180+
.get(defaultFirstOccImportance);
181+
std::string importance = env.getProperties()
182+
.lookup(getBaseName(), "firstOccurrenceImportance", info->name())
183+
.get(alt_importance);
184+
param.firstOccImportance = util::strToNum<feature_t>(importance);
172185

173186
if (NativeRankBlueprint::useTableNormalization(env)) {
174187
const Table * fo = param.firstOccTable;

0 commit comments

Comments
 (0)