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

Function MakeIndexMap

tests/cppunit/ir_pass_test.cc:190–224  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

188}
189
190static IndexMap MakeIndexMap() {
191 auto f1 = FieldInfo("t1", std::make_unique<redis::TagFieldMetadata>());
192 auto f2 = FieldInfo("t2", std::make_unique<redis::TagFieldMetadata>());
193 f2.metadata->noindex = true;
194 auto f3 = FieldInfo("n1", std::make_unique<redis::NumericFieldMetadata>());
195 auto f4 = FieldInfo("n2", std::make_unique<redis::NumericFieldMetadata>());
196 auto f5 = FieldInfo("n3", std::make_unique<redis::NumericFieldMetadata>());
197 f5.metadata->noindex = true;
198
199 auto hnsw_field_meta = std::make_unique<redis::HnswVectorFieldMetadata>();
200 hnsw_field_meta->vector_type = redis::VectorType::FLOAT64;
201 hnsw_field_meta->dim = 3;
202 hnsw_field_meta->distance_metric = redis::DistanceMetric::L2;
203 auto f6 = FieldInfo("v1", std::move(hnsw_field_meta));
204
205 hnsw_field_meta = std::make_unique<redis::HnswVectorFieldMetadata>();
206 hnsw_field_meta->vector_type = redis::VectorType::FLOAT64;
207 hnsw_field_meta->dim = 3;
208 hnsw_field_meta->distance_metric = redis::DistanceMetric::L2;
209 auto f7 = FieldInfo("v2", std::move(hnsw_field_meta));
210 f7.metadata->noindex = true;
211
212 auto ia = std::make_unique<IndexInfo>("ia", redis::IndexMetadata(), "");
213 ia->Add(std::move(f1));
214 ia->Add(std::move(f2));
215 ia->Add(std::move(f3));
216 ia->Add(std::move(f4));
217 ia->Add(std::move(f5));
218 ia->Add(std::move(f6));
219 ia->Add(std::move(f7));
220
221 IndexMap res;
222 res.Insert(std::move(ia));
223 return res;
224}
225
226std::unique_ptr<Node> ParseS(SemaChecker& sc, const std::string& in) {
227 auto res = *Parse(in);

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