aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib/src/vespa/searchlib/attribute/string_search_context.h
blob: 926f6c4d829055e26f5d5b9e42c40415e7388458 (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
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include "search_context.h"
#include "string_matcher.h"
#include <vespa/vespalib/fuzzy/fuzzy_matching_algorithm.h>

namespace search {

template <class EntryT> class EnumStoreT;

}

namespace search::attribute {

class EnumHintSearchContext;

/*
 * StringSearchContext is an abstract base class for search contexts
 * handling a query term on a string attribute vector.
 */
class StringSearchContext : public SearchContext, public StringMatcher
{
protected:
    using MatcherType = StringMatcher;
public:
    StringSearchContext(const AttributeVector& to_be_searched, std::unique_ptr<QueryTermSimple> query_term,
                        bool cased, vespalib::FuzzyMatchingAlgorithm fuzzy_matching_algorithm);
    StringSearchContext(const AttributeVector& to_be_searched, StringMatcher&& matcher);
    StringSearchContext(StringSearchContext &&) noexcept;
    ~StringSearchContext() override;
    const QueryTermUCS4* queryTerm() const override;
    bool valid() const override;

    void setup_enum_hint_sc(const EnumStoreT<const char*>& enum_store, EnumHintSearchContext& enum_hint_sc);
};

}