SearchTask.h 1.6 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14
/*******************************************************************************
 * Copyright 上海赜睿信息科技有限公司(Zilliz) - All Rights Reserved
 * Unauthorized copying of this file, via any medium is strictly prohibited.
 * Proprietary and confidential.
 ******************************************************************************/
#pragma once

#include "Task.h"


namespace zilliz {
namespace milvus {
namespace engine {

W
wxyu 已提交
15
// TODO: rewrite
16 17
class XSearchTask : public Task {
public:
W
wxyu 已提交
18 19 20
    explicit
    XSearchTask(TableFileSchemaPtr file);

21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
    void
    Load(LoadType type, uint8_t device_id) override;

    void
    Execute() override;

public:
    static Status ClusterResult(const std::vector<long> &output_ids,
                                const std::vector<float> &output_distence,
                                uint64_t nq,
                                uint64_t topk,
                                SearchContext::ResultSet &result_set);

    static Status MergeResult(SearchContext::Id2DistanceMap &distance_src,
                              SearchContext::Id2DistanceMap &distance_target,
                              uint64_t topk,
                              bool ascending);

    static Status TopkResult(SearchContext::ResultSet &result_src,
                             uint64_t topk,
                             bool ascending,
                             SearchContext::ResultSet &result_target);

public:
    TableFileSchemaPtr file_;

    size_t index_id_ = 0;
    int index_type_ = 0;
    ExecutionEnginePtr index_engine_ = nullptr;
    bool metric_l2 = true;
J
jinhai 已提交
51 52

    static std::mutex merge_mutex_;
53 54 55 56 57
};

}
}
}