aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib/src/tests/memoryindex/field_index/field_index_test.cpp
diff options
context:
space:
mode:
authorGeir Storli <geirst@verizonmedia.com>2019-06-21 13:27:46 +0000
committerGeir Storli <geirst@verizonmedia.com>2019-06-21 13:27:46 +0000
commit4373b26bdbd1f919bc574096e56ce6332bb5c5a3 (patch)
treef2c2235b7d2853cafafefee450cf59a7c72e934b /searchlib/src/tests/memoryindex/field_index/field_index_test.cpp
parentbad7460816a4f3e229be227b04c4cbaa27049ed0 (diff)
Instantiate field index type based on config in index schema.
Diffstat (limited to 'searchlib/src/tests/memoryindex/field_index/field_index_test.cpp')
-rw-r--r--searchlib/src/tests/memoryindex/field_index/field_index_test.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/searchlib/src/tests/memoryindex/field_index/field_index_test.cpp b/searchlib/src/tests/memoryindex/field_index/field_index_test.cpp
index ca02573bea2..de3b87194f8 100644
--- a/searchlib/src/tests/memoryindex/field_index/field_index_test.cpp
+++ b/searchlib/src/tests/memoryindex/field_index/field_index_test.cpp
@@ -840,6 +840,40 @@ TEST_F(FieldIndexCollectionTest, require_that_dumping_words_with_no_docs_to_inde
}
}
+
+struct FieldIndexCollectionTypeTest : public ::testing::Test {
+ Schema schema;
+ FieldIndexCollection fic;
+ FieldIndexCollectionTypeTest()
+ : schema(make_schema()),
+ fic(schema, MockFieldLengthInspector())
+ {
+ }
+ Schema make_schema() {
+ Schema result;
+ result.addIndexField(Schema::IndexField("normal", DataType::STRING));
+ Schema::IndexField interleaved("interleaved", DataType::STRING);
+ interleaved.set_experimental_posting_list_format(true);
+ result.addIndexField(interleaved);
+ return result;
+ }
+};
+
+template <typename FieldIndexType>
+void
+expect_field_index_type(const IFieldIndex* field_index)
+{
+ auto* other_type = dynamic_cast<const FieldIndexType*>(field_index);
+ EXPECT_TRUE(other_type != nullptr);
+}
+
+TEST_F(FieldIndexCollectionTypeTest, instantiates_field_index_type_based_on_schema_config)
+{
+ expect_field_index_type<FieldIndex<false>>(fic.getFieldIndex(0));
+ expect_field_index_type<FieldIndex<true>>(fic.getFieldIndex(1));
+}
+
+
class InverterTest : public ::testing::Test {
public:
Schema _schema;