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

#include "string_matcher.h"
#include <vespa/searchlib/query/query_term_ucs4.h>

namespace search::attribute {

StringMatcher::StringMatcher(std::unique_ptr<QueryTermSimple> query_term, bool cased, vespalib::FuzzyMatchingAlgorithm fuzzy_matching_algorithm)
    : _query_term(static_cast<QueryTermUCS4 *>(query_term.release())),
      _helper(*_query_term, cased, fuzzy_matching_algorithm)
{
}

StringMatcher::StringMatcher(StringMatcher&&) noexcept = default;

StringMatcher::~StringMatcher() = default;

bool
StringMatcher::isValid() const
{
    return (_query_term && (!_query_term->empty()));
}

}