MCPcopy Create free account
hub / github.com/apache/kvrocks / MakeIndexMap

Function MakeIndexMap

tests/cppunit/ir_sema_checker_test.cc:37–65  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35static auto Parse(const std::string& in) { return sql::ParseToIR(peg::string_input(in, "test")); }
36
37static IndexMap MakeIndexMap() {
38 auto f1 = FieldInfo("f1", std::make_unique<redis::TagFieldMetadata>());
39 auto f2 = FieldInfo("f2", std::make_unique<redis::NumericFieldMetadata>());
40 auto f3 = FieldInfo("f3", std::make_unique<redis::NumericFieldMetadata>());
41
42 auto hnsw_field_meta = std::make_unique<redis::HnswVectorFieldMetadata>();
43 hnsw_field_meta->vector_type = redis::VectorType::FLOAT64;
44 hnsw_field_meta->dim = 3;
45 hnsw_field_meta->distance_metric = redis::DistanceMetric::L2;
46 auto f4 = FieldInfo("f4", std::move(hnsw_field_meta));
47
48 hnsw_field_meta = std::make_unique<redis::HnswVectorFieldMetadata>();
49 hnsw_field_meta->vector_type = redis::VectorType::FLOAT64;
50 hnsw_field_meta->dim = 3;
51 hnsw_field_meta->distance_metric = redis::DistanceMetric::COSINE;
52 auto f5 = FieldInfo("f5", std::move(hnsw_field_meta));
53 f5.metadata->noindex = true;
54
55 auto ia = std::make_unique<IndexInfo>("ia", redis::IndexMetadata(), "");
56 ia->Add(std::move(f1));
57 ia->Add(std::move(f2));
58 ia->Add(std::move(f3));
59 ia->Add(std::move(f4));
60 ia->Add(std::move(f5));
61
62 IndexMap res;
63 res.Insert(std::move(ia));
64 return res;
65}
66
67using testing::MatchesRegex;
68

Callers 1

TESTFunction · 0.70

Calls 4

FieldInfoClass · 0.85
IndexMetadataClass · 0.85
AddMethod · 0.45
InsertMethod · 0.45

Tested by

no test coverage detected