aboutsummaryrefslogtreecommitdiffstats
path: root/searchsummary/src/vespa/searchsummary/docsummary/juniper_query_adapter.h
blob: a544c674aa9fdfda412b9108733eaa6c4091f685 (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
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include <vespa/juniper/query.h>
#include <vespa/vespalib/stllike/string.h>

namespace search {
    class SimpleQueryStackDumpIterator;
    class QueryNormalization;
}
namespace search::fef { class Properties; }

namespace search::docsummary {

class IQueryTermFilter;

/*
 * Class implementing an adapter used by juniper to examine the current
 * query.
 */
class JuniperQueryAdapter : public juniper::IQuery
{
private:
    const QueryNormalization * _query_normalization;
    const IQueryTermFilter *_query_term_filter;
    const vespalib::stringref _buf;
    const search::fef::Properties & _highlightTerms;

public:
    JuniperQueryAdapter(const JuniperQueryAdapter&) = delete;
    JuniperQueryAdapter operator= (const JuniperQueryAdapter&) = delete;
    JuniperQueryAdapter(const QueryNormalization * normalization, const IQueryTermFilter *query_term_filter, vespalib::stringref buf,
                        const search::fef::Properties & highlightTerms);
    ~JuniperQueryAdapter() override;
    bool skipItem(search::SimpleQueryStackDumpIterator *iterator) const;
    bool Traverse(juniper::IQueryVisitor *v) const override;
    bool UsefulIndex(const juniper::QueryItem* item) const override;
};

}