| 373 | } |
| 374 | |
| 375 | static void BuildIndex(const IndexMeta &meta, IndexHolder::Pointer holder, |
| 376 | const std::string &path) { |
| 377 | auto builder = IndexFactory::CreateBuilder("FlatBuilder"); |
| 378 | auto dumper = IndexFactory::CreateDumper("FileDumper"); |
| 379 | ASSERT_NE(nullptr, builder); |
| 380 | ASSERT_NE(nullptr, dumper); |
| 381 | |
| 382 | Params params; |
| 383 | ASSERT_EQ(0, builder->init(meta, params)); |
| 384 | ASSERT_EQ(0, dumper->create(path)); |
| 385 | ASSERT_EQ(0, IndexBuilder::TrainBuildAndDump(builder, holder, dumper)); |
| 386 | ASSERT_EQ(0, dumper->close()); |
| 387 | } |
| 388 | |
| 389 | //! Create a quantizer and build a flat index with quantized datapoints |
| 390 | static void BuildQuantizedIndex(const std::string &metric_name, |