Coverage Report

Created: 2026-03-14 20:54

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
be/src/storage/index/inverted/query/query.h
Line
Count
Source
1
// Licensed to the Apache Software Foundation (ASF) under one
2
// or more contributor license agreements.  See the NOTICE file
3
// distributed with this work for additional information
4
// regarding copyright ownership.  The ASF licenses this file
5
// to you under the Apache License, Version 2.0 (the
6
// "License"); you may not use this file except in compliance
7
// with the License.  You may obtain a copy of the License at
8
//
9
//   http://www.apache.org/licenses/LICENSE-2.0
10
//
11
// Unless required by applicable law or agreed to in writing,
12
// software distributed under the License is distributed on an
13
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
// KIND, either express or implied.  See the License for the
15
// specific language governing permissions and limitations
16
// under the License.
17
18
#pragma once
19
20
#include <CLucene.h> // IWYU pragma: keep
21
#include <CLucene/index/IndexReader.h>
22
#include <CLucene/index/Term.h>
23
#include <gen_cpp/PaloInternalService_types.h>
24
25
#include <memory>
26
#include <vector>
27
28
#include "common/status.h"
29
#include "io/io_common.h"
30
#include "roaring/roaring.hh"
31
#include "runtime/runtime_state.h"
32
#include "storage/index/index_query_context.h"
33
#include "storage/index/inverted/inverted_index_searcher.h"
34
#include "storage/index/inverted/query/query_info.h"
35
#include "storage/index/inverted/similarity/bm25_similarity.h"
36
#include "storage/index/inverted/util/docid_set_iterator.h"
37
#include "storage/index/inverted/util/string_helper.h"
38
39
CL_NS_USE(index)
40
CL_NS_USE(search)
41
CL_NS_USE(util)
42
43
namespace doris::segment_v2 {
44
45
using SearcherPtr = std::shared_ptr<lucene::search::IndexSearcher>;
46
47
class Query {
48
public:
49
211
    virtual ~Query() = default;
50
51
    // a unified data preparation interface that provides the field names to be queried and the terms for the query.
52
    // @param field_name The name of the field within the data source to search against.
53
    // @param terms a vector of tokenized strings that represent the search terms.
54
    virtual void add(const InvertedIndexQueryInfo& query_info) = 0;
55
56
    // a unified query interface for retrieving the ids obtained from the search.
57
    // @param roaring a Roaring bitmap to be populated with the search results,
58
    virtual void search(roaring::Roaring& roaring) = 0;
59
};
60
61
} // namespace doris::segment_v2