blob: b9b7818b9f277c550f7cc35e934ecf7c76d9facf (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include <vespa/searchlib/fef/matchdatalayout.h>
#include <vespa/searchlib/fef/simpletermdata.h>
#include <vespa/searchlib/query/streaming/querynoderesultbase.h>
namespace streaming {
/**
* This class keeps data for a query term that is used by the ranking framework.
**/
class QueryTermData : public search::streaming::QueryNodeResultBase
{
private:
search::fef::SimpleTermData _termData;
public:
QueryTermData * clone() const override { return new QueryTermData(); }
search::fef::SimpleTermData &getTermData() noexcept { return _termData; }
};
class QueryTermDataFactory final : public search::streaming::QueryNodeResultFactory {
public:
using Normalizing = search::Normalizing;
using QueryNormalization = search::QueryNormalization;
QueryTermDataFactory(const QueryNormalization * normalization) noexcept : _normalization(normalization) {}
std::unique_ptr<search::streaming::QueryNodeResultBase> create() const override {
return std::make_unique<QueryTermData>();
}
Normalizing normalizing_mode(vespalib::stringref index) const noexcept override {
return _normalization ? _normalization->normalizing_mode(index) : Normalizing::LOWERCASE_AND_FOLD;
}
bool allow_float_terms_rewrite(vespalib::stringref index ) const noexcept override {
return _normalization && _normalization->is_text_matching(index);
}
private:
const QueryNormalization * _normalization;
};
} // namespace streaming
|