| 92 | |
| 93 | |
| 94 | TEST_F(OptimizerTest, Basic) { |
| 95 | SearchQuery query; |
| 96 | query.output_fields_ = {"*"}; |
| 97 | query.topk_ = 11; |
| 98 | query.target_.field_name_ = "face_feature"; |
| 99 | query.include_vector_ = false; |
| 100 | query.filter_ = "age > 200"; |
| 101 | |
| 102 | auto engine = std::make_shared<SQLEngineImpl>(std::make_shared<Profiler>()); |
| 103 | auto ret = engine->build_query_info(schema, query, nullptr); |
| 104 | ASSERT_TRUE(ret.has_value()); |
| 105 | QueryInfo::Ptr query_info = ret.value(); |
| 106 | |
| 107 | Optimizer::Ptr optimizer = |
| 108 | std::make_shared<MockInvertCondOptimizer>(schema.get()); |
| 109 | |
| 110 | auto segment = std::make_shared<MockSegment>(); |
| 111 | |
| 112 | bool optimized = optimizer->optimize(segment.get(), query_info.get()); |
| 113 | ASSERT_TRUE(optimized); |
| 114 | } |
| 115 | |
| 116 | // case 1. invert subroot same as invert cond, do nothing |
| 117 | TEST_F(OptimizerTest, Case1) { |
nothing calls this directly
no test coverage detected