diff options
author | Tor Brede Vekterli <vekterli@vespa.ai> | 2024-01-16 13:16:29 +0000 |
---|---|---|
committer | Tor Brede Vekterli <vekterli@vespa.ai> | 2024-01-16 13:23:32 +0000 |
commit | a71430109aa0310c1f97a0da68f8108cb6a101c4 (patch) | |
tree | 2e5638d8885f7a40d29622d1a3ecfa30344ab7d1 /streamingvisitors/src/vespa/vsm/vsm/fieldsearchspec.cpp | |
parent | 324d3edb7de008da284af9b6e664298538dae0f4 (diff) |
Propagate normalizing mode and max field length to new searcher
Needed to avoid default normalizing mode/max field length being
used in the reconfigured searcher instance.
Diffstat (limited to 'streamingvisitors/src/vespa/vsm/vsm/fieldsearchspec.cpp')
-rw-r--r-- | streamingvisitors/src/vespa/vsm/vsm/fieldsearchspec.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/streamingvisitors/src/vespa/vsm/vsm/fieldsearchspec.cpp b/streamingvisitors/src/vespa/vsm/vsm/fieldsearchspec.cpp index 468d8e0145a..9c8bb2f185a 100644 --- a/streamingvisitors/src/vespa/vsm/vsm/fieldsearchspec.cpp +++ b/streamingvisitors/src/vespa/vsm/vsm/fieldsearchspec.cpp @@ -114,9 +114,7 @@ FieldSearchSpec::FieldSearchSpec(const FieldIdT & fid, const vespalib::string & break; } if (_searcher) { - setMatchType(_searcher, _arg1); - _searcher->maxFieldLength(maxLength()); - _searcher->normalize_mode(_normalize_mode); + propagate_settings_to_searcher(); } } @@ -138,8 +136,7 @@ FieldSearchSpec::reconfig(const QueryTerm & term) term.isRegex()) { _searcher = std::make_unique<UTF8FlexibleStringFieldSearcher>(id()); - // preserve the basic match property of the searcher - setMatchType(_searcher, _arg1); + propagate_settings_to_searcher(); LOG(debug, "Reconfigured to use UTF8FlexibleStringFieldSearcher (%s) for field '%s' with id '%d'", _searcher->prefix() ? "prefix" : "regular", name().c_str(), id()); _reconfigured = true; @@ -150,6 +147,15 @@ FieldSearchSpec::reconfig(const QueryTerm & term) } } +void +FieldSearchSpec::propagate_settings_to_searcher() +{ + // preserve the basic match property and normalization mode of the searcher + setMatchType(_searcher, _arg1); + _searcher->maxFieldLength(maxLength()); + _searcher->normalize_mode(_normalize_mode); +} + vespalib::asciistream & operator <<(vespalib::asciistream & os, const FieldSearchSpec & f) { |