diff options
author | Geir Storli <geirstorli@yahoo.no> | 2017-04-19 10:51:04 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-19 10:51:04 +0200 |
commit | 6adab6f821248cf7c7e6b3105c6e26145b8abaea (patch) | |
tree | e34095fc4dff471c24ebd4ad4d6939f798c44895 /searchcore/src/tests/proton/common/cachedselect_test.cpp | |
parent | 92d2c47b4904e4fb811e4a91849809ca5307a265 (diff) | |
parent | 5188254e1a5969d3504bcbe422c213b61a2ca00b (diff) |
Merge pull request #2177 from yahoo/toregge/add-index-aspect-inspector
Toregge/add index aspect inspector
Diffstat (limited to 'searchcore/src/tests/proton/common/cachedselect_test.cpp')
-rw-r--r-- | searchcore/src/tests/proton/common/cachedselect_test.cpp | 35 |
1 files changed, 11 insertions, 24 deletions
diff --git a/searchcore/src/tests/proton/common/cachedselect_test.cpp b/searchcore/src/tests/proton/common/cachedselect_test.cpp index 6030c9c6fad..6d1f7735479 100644 --- a/searchcore/src/tests/proton/common/cachedselect_test.cpp +++ b/searchcore/src/tests/proton/common/cachedselect_test.cpp @@ -15,6 +15,7 @@ #include <vespa/searchlib/attribute/singlenumericenumattribute.hpp> #include <vespa/searchlib/attribute/singlenumericpostattribute.hpp> #include <vespa/searchlib/attribute/attributevector.hpp> +#include <vespa/searchlib/attribute/attributefactory.h> #include <vespa/searchlib/test/mock_attribute_manager.h> #include <vespa/document/select/parser.h> #include <vespa/document/select/cloningvisitor.h> @@ -22,7 +23,6 @@ #include <vespa/document/fieldvalue/stringfieldvalue.h> #include <vespa/document/fieldvalue/intfieldvalue.h> #include <vespa/document/fieldvalue/document.h> -#include <vespa/searchcommon/common/schema.h> #include <vespa/log/log.h> LOG_SETUP("cachedselect_test"); @@ -48,6 +48,7 @@ using proton::CachedSelect; using proton::SelectContext; using search::AttributeContext; using search::AttributeEnumGuard; +using search::AttributeFactory; using search::AttributeGuard; using search::AttributePosting; using search::AttributeVector; @@ -55,10 +56,10 @@ using search::EnumAttribute; using search::IntegerAttribute; using search::IntegerAttributeTemplate; using search::SingleValueNumericPostingAttribute; +using search::attribute::BasicType; +using search::attribute::CollectionType; using search::attribute::IAttributeContext; using search::attribute::test::MockAttributeManager; -using search::index::Schema; -using search::index::schema::CollectionType; using vespalib::string; using namespace search::index; @@ -75,15 +76,6 @@ typedef SingleValueNumericPostingAttribute<IntEnumAttribute> SvIntAttr; namespace { -void -makeSchema(Schema &s) -{ - s.addIndexField(Schema::IndexField("ia", schema::DataType::STRING)); - s.addAttributeField(Schema::AttributeField("aa", schema::DataType::INT32)); - s.addAttributeField(Schema::AttributeField("aaa", schema::DataType::INT32, CollectionType::ARRAY)); - s.addAttributeField(Schema::AttributeField("aaw", schema::DataType::INT32, CollectionType::WEIGHTEDSET)); -} - const int32_t doc_type_id = 787121340; const string type_name = "test"; const string header_name = type_name + ".header"; @@ -212,6 +204,7 @@ public: class MyAttributeManager : public MockAttributeManager { public: + using MockAttributeManager::addAttribute; void addAttribute(const vespalib::string &name) { if (findAttribute(name).get() != NULL) { return; @@ -230,7 +223,6 @@ class MyDB public: typedef std::unique_ptr<MyDB> UP; - const Schema &_schema; const DocumentTypeRepo &_repo; MyAttributeManager &_amgr; typedef std::map<string, uint32_t> DocIdToLid; @@ -238,11 +230,9 @@ public: DocIdToLid _docIdToLid; LidToDocSP _lidToDocSP; - MyDB(const Schema &schema, - const DocumentTypeRepo &repo, + MyDB(const DocumentTypeRepo &repo, MyAttributeManager &amgr) - : _schema(schema), - _repo(repo), + : _repo(repo), _amgr(amgr) { } @@ -298,7 +288,6 @@ MyDB::getDoc(uint32_t lid) const class TestFixture { public: - Schema _s; DocumentTypeRepo::UP _repoUP; bool _hasFields; MyAttributeManager _amgr; @@ -316,18 +305,18 @@ public: TestFixture::TestFixture(void) - : _s(), - _repoUP(), + : _repoUP(), _hasFields(true), _amgr(), _db() { - makeSchema(_s); _repoUP = makeDocTypeRepo(); _amgr.addAttribute("aa"); + _amgr.addAttribute("aaa", AttributeFactory::createAttribute("aaa", {BasicType::INT32, CollectionType::ARRAY})); + _amgr.addAttribute("aaw", AttributeFactory::createAttribute("aaw", {BasicType::INT32, CollectionType::WSET})); - _db.reset(new MyDB(_s, *_repoUP, _amgr)); + _db.reset(new MyDB(*_repoUP, _amgr)); } @@ -341,7 +330,6 @@ TestFixture::testParse(const string &selection, const string &docTypeName) { const DocumentTypeRepo &repo(*_repoUP); - const Schema &schema(_s); CachedSelect::SP res(new CachedSelect); @@ -353,7 +341,6 @@ TestFixture::testParse(const string &selection, docTypeName, *emptyDoc, repo, - schema, &_amgr, _hasFields); |