diff options
author | Geir Storli <geirst@yahoo-inc.com> | 2017-04-04 19:23:13 +0000 |
---|---|---|
committer | Geir Storli <geirst@yahoo-inc.com> | 2017-04-05 07:49:16 +0000 |
commit | ae812c64492160223a0a3e674f38c2d5a59c2663 (patch) | |
tree | 75835e5e0e833a9c7cc3e2d4a853a489d5aaa202 /searchlib/src/tests/memoryindex | |
parent | d8b05c79c106204ee76726aff4d3f0cb84d8fc99 (diff) |
Change schema::DataType and schema::CollectionType to enum class.
Diffstat (limited to 'searchlib/src/tests/memoryindex')
6 files changed, 52 insertions, 38 deletions
diff --git a/searchlib/src/tests/memoryindex/datastore/featurestore_test.cpp b/searchlib/src/tests/memoryindex/datastore/featurestore_test.cpp index c13aeaa1053..b7207966ece 100644 --- a/searchlib/src/tests/memoryindex/datastore/featurestore_test.cpp +++ b/searchlib/src/tests/memoryindex/datastore/featurestore_test.cpp @@ -9,6 +9,9 @@ using namespace search::btree; using namespace search::datastore; using namespace search::index; +using search::index::schema::CollectionType; +using search::index::schema::DataType; + namespace search { @@ -217,8 +220,8 @@ Test::requireThatAddFeaturesTriggersChangeOfBuffer(void) Test::Test() : _schema() { - _schema.addIndexField(Schema::IndexField("f0", schema::STRING)); - _schema.addIndexField(Schema::IndexField("f1", schema::STRING, schema::WEIGHTEDSET)); + _schema.addIndexField(Schema::IndexField("f0", DataType::STRING)); + _schema.addIndexField(Schema::IndexField("f1", DataType::STRING, CollectionType::WEIGHTEDSET)); } diff --git a/searchlib/src/tests/memoryindex/dictionary/dictionary_test.cpp b/searchlib/src/tests/memoryindex/dictionary/dictionary_test.cpp index 4ef2e4e3617..47a49d25f5f 100644 --- a/searchlib/src/tests/memoryindex/dictionary/dictionary_test.cpp +++ b/searchlib/src/tests/memoryindex/dictionary/dictionary_test.cpp @@ -27,10 +27,13 @@ using namespace btree; using namespace datastore; using namespace fef; using namespace index; -using queryeval::SearchIterator; + using document::Document; -using vespalib::GenerationHandler; +using queryeval::SearchIterator; +using search::index::schema::CollectionType; +using search::index::schema::DataType; using test::SearchIteratorVerifier; +using vespalib::GenerationHandler; namespace memoryindex { @@ -577,10 +580,10 @@ struct Fixture { Schema _schema; Fixture() : _schema() { - _schema.addIndexField(Schema::IndexField("f0", schema::STRING)); - _schema.addIndexField(Schema::IndexField("f1", schema::STRING)); - _schema.addIndexField(Schema::IndexField("f2", schema::STRING, schema::ARRAY)); - _schema.addIndexField(Schema::IndexField("f3", schema::STRING, schema::WEIGHTEDSET)); + _schema.addIndexField(Schema::IndexField("f0", DataType::STRING)); + _schema.addIndexField(Schema::IndexField("f1", DataType::STRING)); + _schema.addIndexField(Schema::IndexField("f2", DataType::STRING, CollectionType::ARRAY)); + _schema.addIndexField(Schema::IndexField("f3", DataType::STRING, CollectionType::WEIGHTEDSET)); } const Schema & getSchema() const { return _schema; } }; @@ -1160,9 +1163,9 @@ public: UriFixture() : _schema() { - _schema.addUriIndexFields(Schema::IndexField("iu", schema::STRING)); - _schema.addUriIndexFields(Schema::IndexField("iau", schema::STRING, schema::ARRAY)); - _schema.addUriIndexFields(Schema::IndexField("iwu", schema::STRING, schema::WEIGHTEDSET)); + _schema.addUriIndexFields(Schema::IndexField("iu", DataType::STRING)); + _schema.addUriIndexFields(Schema::IndexField("iau", DataType::STRING, CollectionType::ARRAY)); + _schema.addUriIndexFields(Schema::IndexField("iwu", DataType::STRING, CollectionType::WEIGHTEDSET)); } const Schema & getSchema() const { return _schema; } }; @@ -1368,7 +1371,7 @@ public: SingleFieldFixture() : _schema() { - _schema.addIndexField(Schema::IndexField("i", schema::STRING)); + _schema.addIndexField(Schema::IndexField("i", DataType::STRING)); } const Schema & getSchema() const { return _schema; } }; diff --git a/searchlib/src/tests/memoryindex/documentinverter/documentinverter_test.cpp b/searchlib/src/tests/memoryindex/documentinverter/documentinverter_test.cpp index d69780b9516..89098848cc5 100644 --- a/searchlib/src/tests/memoryindex/documentinverter/documentinverter_test.cpp +++ b/searchlib/src/tests/memoryindex/documentinverter/documentinverter_test.cpp @@ -13,10 +13,12 @@ namespace search { - using document::Document; using index::DocBuilder; using index::Schema; +using index::schema::CollectionType; +using index::schema::DataType; + using namespace index; namespace memoryindex { @@ -103,10 +105,10 @@ struct Fixture makeSchema() { Schema schema; - schema.addIndexField(Schema::IndexField("f0", schema::STRING)); - schema.addIndexField(Schema::IndexField("f1", schema::STRING)); - schema.addIndexField(Schema::IndexField("f2", schema::STRING, schema::ARRAY)); - schema.addIndexField(Schema::IndexField("f3", schema::STRING, schema::WEIGHTEDSET)); + schema.addIndexField(Schema::IndexField("f0", DataType::STRING)); + schema.addIndexField(Schema::IndexField("f1", DataType::STRING)); + schema.addIndexField(Schema::IndexField("f2", DataType::STRING, CollectionType::ARRAY)); + schema.addIndexField(Schema::IndexField("f3", DataType::STRING, CollectionType::WEIGHTEDSET)); return schema; } diff --git a/searchlib/src/tests/memoryindex/fieldinverter/fieldinverter_test.cpp b/searchlib/src/tests/memoryindex/fieldinverter/fieldinverter_test.cpp index eb86015bb27..df292ec2b1d 100644 --- a/searchlib/src/tests/memoryindex/fieldinverter/fieldinverter_test.cpp +++ b/searchlib/src/tests/memoryindex/fieldinverter/fieldinverter_test.cpp @@ -10,10 +10,12 @@ namespace search { - using document::Document; using index::DocBuilder; using index::Schema; +using index::schema::CollectionType; +using index::schema::DataType; + using namespace index; namespace memoryindex { @@ -111,10 +113,10 @@ struct Fixture makeSchema() { Schema schema; - schema.addIndexField(Schema::IndexField("f0", schema::STRING)); - schema.addIndexField(Schema::IndexField("f1", schema::STRING)); - schema.addIndexField(Schema::IndexField("f2", schema::STRING, schema::ARRAY)); - schema.addIndexField(Schema::IndexField("f3", schema::STRING, schema::WEIGHTEDSET)); + schema.addIndexField(Schema::IndexField("f0", DataType::STRING)); + schema.addIndexField(Schema::IndexField("f1", DataType::STRING)); + schema.addIndexField(Schema::IndexField("f2", DataType::STRING, CollectionType::ARRAY)); + schema.addIndexField(Schema::IndexField("f3", DataType::STRING, CollectionType::WEIGHTEDSET)); return schema; } diff --git a/searchlib/src/tests/memoryindex/memoryindex/memoryindex_test.cpp b/searchlib/src/tests/memoryindex/memoryindex/memoryindex_test.cpp index a1302d7de78..9ed5ff16c9e 100644 --- a/searchlib/src/tests/memoryindex/memoryindex/memoryindex_test.cpp +++ b/searchlib/src/tests/memoryindex/memoryindex/memoryindex_test.cpp @@ -22,11 +22,12 @@ LOG_SETUP("memoryindex_test"); using document::Document; using document::FieldValue; +using search::ScheduleTaskCallback; +using search::index::schema::DataType; +using search::makeLambdaTask; using search::query::Node; using search::query::SimplePhrase; using search::query::SimpleStringTerm; -using search::makeLambdaTask; -using search::ScheduleTaskCallback; using namespace search::fef; using namespace search::index; using namespace search::memoryindex; @@ -37,7 +38,7 @@ using namespace search::queryeval; struct Setup { Schema schema; Setup &field(const std::string &name) { - schema.addIndexField(Schema::IndexField(name, schema::STRING)); + schema.addIndexField(Schema::IndexField(name, DataType::STRING)); return *this; } }; diff --git a/searchlib/src/tests/memoryindex/urlfieldinverter/urlfieldinverter_test.cpp b/searchlib/src/tests/memoryindex/urlfieldinverter/urlfieldinverter_test.cpp index 9e6f401cd4c..c50ebc056c8 100644 --- a/searchlib/src/tests/memoryindex/urlfieldinverter/urlfieldinverter_test.cpp +++ b/searchlib/src/tests/memoryindex/urlfieldinverter/urlfieldinverter_test.cpp @@ -14,6 +14,9 @@ namespace search { using document::Document; +using index::schema::CollectionType; +using index::schema::DataType; + using namespace index; @@ -189,7 +192,7 @@ struct Fixture makeSchema(Schema::CollectionType collectionType) { Schema schema; - schema.addUriIndexFields(Schema::IndexField("url", index::schema::STRING, collectionType)); + schema.addUriIndexFields(Schema::IndexField("url", DataType::STRING, collectionType)); return schema; } @@ -246,7 +249,7 @@ struct Fixture }; -TEST_F("requireThatSingleUrlFieldWorks", Fixture(schema::SINGLE)) +TEST_F("requireThatSingleUrlFieldWorks", Fixture(CollectionType::SINGLE)) { f.invertDocument(10, *makeDoc10Single(f._b)); f.pushDocuments(); @@ -285,7 +288,7 @@ TEST_F("requireThatSingleUrlFieldWorks", Fixture(schema::SINGLE)) } -TEST_F("requireThatArrayUrlFieldWorks", Fixture(schema::ARRAY)) +TEST_F("requireThatArrayUrlFieldWorks", Fixture(CollectionType::ARRAY)) { f.invertDocument(10, *makeDoc10Array(f._b)); f.pushDocuments(); @@ -328,7 +331,7 @@ TEST_F("requireThatArrayUrlFieldWorks", Fixture(schema::ARRAY)) f._inserter.toStr()); } -TEST_F("requireThatWeightedSetFieldWorks", Fixture(schema::WEIGHTEDSET)) +TEST_F("requireThatWeightedSetFieldWorks", Fixture(CollectionType::WEIGHTEDSET)) { f.invertDocument(10, *makeDoc10WeightedSet(f._b)); f.pushDocuments(); @@ -373,7 +376,7 @@ TEST_F("requireThatWeightedSetFieldWorks", Fixture(schema::WEIGHTEDSET)) f._inserter.toStr()); } -TEST_F("requireThatAnnotatedSingleUrlFieldWorks", Fixture(schema::SINGLE)) +TEST_F("requireThatAnnotatedSingleUrlFieldWorks", Fixture(CollectionType::SINGLE)) { f.enableAnnotations(); f.invertDocument(10, *makeDoc10Single(f._b)); @@ -414,7 +417,7 @@ TEST_F("requireThatAnnotatedSingleUrlFieldWorks", Fixture(schema::SINGLE)) } -TEST_F("requireThatAnnotatedArrayUrlFieldWorks", Fixture(schema::ARRAY)) +TEST_F("requireThatAnnotatedArrayUrlFieldWorks", Fixture(CollectionType::ARRAY)) { f.enableAnnotations(); f.invertDocument(10, *makeDoc10Array(f._b)); @@ -460,7 +463,7 @@ TEST_F("requireThatAnnotatedArrayUrlFieldWorks", Fixture(schema::ARRAY)) } TEST_F("requireThatAnnotatedWeightedSetFieldWorks", - Fixture(schema::WEIGHTEDSET)) + Fixture(CollectionType::WEIGHTEDSET)) { f.enableAnnotations(); f._inserter.setVerbose(); @@ -509,14 +512,14 @@ TEST_F("requireThatAnnotatedWeightedSetFieldWorks", } -TEST_F("requireThatEmptySingleFieldWorks", Fixture(schema::SINGLE)) +TEST_F("requireThatEmptySingleFieldWorks", Fixture(CollectionType::SINGLE)) { f.invertDocument(10, *makeDoc10Empty(f._b)); f.pushDocuments(); EXPECT_EQUAL("", f._inserter.toStr()); } -TEST_F("requireThatEmptyArrayFieldWorks", Fixture(schema::ARRAY)) +TEST_F("requireThatEmptyArrayFieldWorks", Fixture(CollectionType::ARRAY)) { f.invertDocument(10, *makeDoc10Empty(f._b)); f.pushDocuments(); @@ -524,14 +527,14 @@ TEST_F("requireThatEmptyArrayFieldWorks", Fixture(schema::ARRAY)) f._inserter.toStr()); } -TEST_F("requireThatEmptyWeightedSetFieldWorks", Fixture(schema::WEIGHTEDSET)) +TEST_F("requireThatEmptyWeightedSetFieldWorks", Fixture(CollectionType::WEIGHTEDSET)) { f.invertDocument(10, *makeDoc10Empty(f._b)); f.pushDocuments(); EXPECT_EQUAL("", f._inserter.toStr()); } -TEST_F("requireThatAnnotatedEmptySingleFieldWorks", Fixture(schema::SINGLE)) +TEST_F("requireThatAnnotatedEmptySingleFieldWorks", Fixture(CollectionType::SINGLE)) { f.enableAnnotations(); f.invertDocument(10, *makeDoc10Empty(f._b)); @@ -539,7 +542,7 @@ TEST_F("requireThatAnnotatedEmptySingleFieldWorks", Fixture(schema::SINGLE)) EXPECT_EQUAL("", f._inserter.toStr()); } -TEST_F("requireThatAnnotatedEmptyArrayFieldWorks", Fixture(schema::ARRAY)) +TEST_F("requireThatAnnotatedEmptyArrayFieldWorks", Fixture(CollectionType::ARRAY)) { f.enableAnnotations(); f.invertDocument(10, *makeDoc10Empty(f._b)); @@ -547,7 +550,7 @@ TEST_F("requireThatAnnotatedEmptyArrayFieldWorks", Fixture(schema::ARRAY)) EXPECT_EQUAL("", f._inserter.toStr()); } -TEST_F("requireThatAnnotatedEmptyWeightedSetFieldWorks", Fixture(schema::WEIGHTEDSET)) +TEST_F("requireThatAnnotatedEmptyWeightedSetFieldWorks", Fixture(CollectionType::WEIGHTEDSET)) { f.enableAnnotations(); f.invertDocument(10, *makeDoc10Empty(f._b)); |