summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2016-11-27 22:24:19 +0100
committerHenning Baldersheim <balder@yahoo-inc.com>2016-12-12 02:55:39 +0100
commit4f0616b274716ab81c9d9775585848bd537c3087 (patch)
tree4ea9046c46468a3e0752ef0149fa6f8d51ad0fdb
parent740d87cc9cac3760b6053a921fd6398f248ca5b6 (diff)
Use schema::DataType
-rw-r--r--searchcore/src/tests/proton/common/cachedselect_test.cpp14
-rw-r--r--searchcore/src/tests/proton/common/document_type_inspector/document_type_inspector_test.cpp7
-rw-r--r--searchcore/src/tests/proton/common/schemautil_test.cpp17
-rw-r--r--searchcore/src/tests/proton/common/selectpruner_test.cpp19
-rw-r--r--searchcore/src/tests/proton/document_iterator/document_iterator_test.cpp14
-rw-r--r--searchcore/src/tests/proton/reprocessing/attribute_reprocessing_initializer/attribute_reprocessing_initializer_test.cpp8
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/schema_config_validator.cpp14
7 files changed, 42 insertions, 51 deletions
diff --git a/searchcore/src/tests/proton/common/cachedselect_test.cpp b/searchcore/src/tests/proton/common/cachedselect_test.cpp
index e2c759f72aa..576d81b3763 100644
--- a/searchcore/src/tests/proton/common/cachedselect_test.cpp
+++ b/searchcore/src/tests/proton/common/cachedselect_test.cpp
@@ -58,6 +58,7 @@ using search::SingleValueNumericPostingAttribute;
using search::IntegerAttribute;
using search::IntegerAttributeTemplate;
using search::attribute::IAttributeContext;
+using namespace search::index;
typedef Node::UP NodeUP;
typedef IntegerAttributeTemplate<int32_t> IATint32;
@@ -69,18 +70,15 @@ extern template class SingleValueNumericPostingAttribute<IntPostingAttribute>;
typedef SingleValueNumericPostingAttribute<IntEnumAttribute> SvIntAttr;
-namespace
-{
+namespace {
void
makeSchema(Schema &s)
{
- s.addIndexField(Schema::IndexField("ia", Schema::STRING));
- s.addAttributeField(Schema::AttributeField("aa", Schema::INT32));
- s.addAttributeField(Schema::AttributeField("aaa", Schema::INT32,
- Schema::ARRAY));
- s.addAttributeField(Schema::AttributeField("aaw", Schema::INT32,
- Schema::WEIGHTEDSET));
+ s.addIndexField(Schema::IndexField("ia", schema::STRING));
+ s.addAttributeField(Schema::AttributeField("aa", schema::INT32));
+ s.addAttributeField(Schema::AttributeField("aaa", schema::INT32, schema::ARRAY));
+ s.addAttributeField(Schema::AttributeField("aaw", schema::INT32, schema::WEIGHTEDSET));
}
const int32_t doc_type_id = 787121340;
diff --git a/searchcore/src/tests/proton/common/document_type_inspector/document_type_inspector_test.cpp b/searchcore/src/tests/proton/common/document_type_inspector/document_type_inspector_test.cpp
index c7fcd9ec72d..8f4d6f1f2fe 100644
--- a/searchcore/src/tests/proton/common/document_type_inspector/document_type_inspector_test.cpp
+++ b/searchcore/src/tests/proton/common/document_type_inspector/document_type_inspector_test.cpp
@@ -1,8 +1,5 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/fastos/fastos.h>
-#include <vespa/log/log.h>
-LOG_SETUP("document_type_inspector_test");
-
#include <vespa/searchcore/proton/common/document_type_inspector.h>
#include <vespa/searchlib/index/docbuilder.h>
#include <vespa/vespalib/testkit/testapp.h>
@@ -15,8 +12,8 @@ Schema
getSchema()
{
Schema schema;
- schema.addSummaryField(Schema::SummaryField("f1", Schema::STRING));
- schema.addSummaryField(Schema::SummaryField("f2", Schema::STRING));
+ schema.addSummaryField(Schema::SummaryField("f1", schema::STRING));
+ schema.addSummaryField(Schema::SummaryField("f2", schema::STRING));
return schema;
}
diff --git a/searchcore/src/tests/proton/common/schemautil_test.cpp b/searchcore/src/tests/proton/common/schemautil_test.cpp
index c6519ecae06..465c7a2a3b0 100644
--- a/searchcore/src/tests/proton/common/schemautil_test.cpp
+++ b/searchcore/src/tests/proton/common/schemautil_test.cpp
@@ -2,14 +2,11 @@
// Unit tests for schemautil.
#include <vespa/fastos/fastos.h>
-#include <vespa/log/log.h>
-LOG_SETUP("schemautil_test");
-
#include <vespa/searchcore/proton/common/schemautil.h>
#include <vespa/vespalib/stllike/string.h>
#include <vespa/vespalib/testkit/testapp.h>
-using search::index::Schema;
+using namespace search::index;
using vespalib::string;
using namespace proton;
@@ -19,15 +16,15 @@ namespace {
void addAllFieldTypes(const string &name, Schema &schema,
fastos::TimeStamp timestamp)
{
- Schema::IndexField index_field(name, Schema::STRING);
+ Schema::IndexField index_field(name, schema::STRING);
index_field.setTimestamp(timestamp);
schema.addIndexField(index_field);
- Schema::AttributeField attribute_field(name, Schema::STRING);
+ Schema::AttributeField attribute_field(name, schema::STRING);
attribute_field.setTimestamp(timestamp);
schema.addAttributeField(attribute_field);
- Schema::SummaryField summary_field(name, Schema::STRING);
+ Schema::SummaryField summary_field(name, schema::STRING);
summary_field.setTimestamp(timestamp);
schema.addSummaryField(summary_field);
}
@@ -112,9 +109,9 @@ assertSchemaResult(const vespalib::string &name,
TEST("require that listSchema can list all fields")
{
Schema schema;
- schema.addIndexField(Schema::IndexField("if", Schema::STRING));
- schema.addAttributeField(Schema::AttributeField("af", Schema::INT32));
- schema.addSummaryField(Schema::SummaryField("sf", Schema::FLOAT, Schema::ARRAY));
+ schema.addIndexField(Schema::IndexField("if", schema::STRING));
+ schema.addAttributeField(Schema::AttributeField("af", schema::INT32));
+ schema.addSummaryField(Schema::SummaryField("sf", schema::FLOAT, schema::ARRAY));
ListSchemaResult r;
SchemaUtil::listSchema(schema, r.fieldNames, r.fieldDataTypes, r.fieldCollectionTypes, r.fieldLocations);
diff --git a/searchcore/src/tests/proton/common/selectpruner_test.cpp b/searchcore/src/tests/proton/common/selectpruner_test.cpp
index e8ec0ae7cb5..7bea3ee12e0 100644
--- a/searchcore/src/tests/proton/common/selectpruner_test.cpp
+++ b/searchcore/src/tests/proton/common/selectpruner_test.cpp
@@ -1,8 +1,5 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/fastos/fastos.h>
-#include <vespa/log/log.h>
-LOG_SETUP("selectpruner_test");
-
#include <vespa/vespalib/stllike/string.h>
#include <vespa/vespalib/testkit/testapp.h>
#include <vespa/document/repo/configbuilder.h>
@@ -11,8 +8,10 @@ LOG_SETUP("selectpruner_test");
#include <vespa/document/select/parser.h>
#include <vespa/document/select/cloningvisitor.h>
+#include <vespa/log/log.h>
+LOG_SETUP("selectpruner_test");
-using search::index::Schema;
+using namespace search::index;
using document::DocumentTypeRepo;
using document::DocumentType;
using document::select::Node;
@@ -38,12 +37,12 @@ namespace
void
makeSchema(Schema &s)
{
- s.addIndexField(Schema::IndexField("ia", Schema::STRING));
- s.addAttributeField(Schema::AttributeField("aa", Schema::INT32));
- s.addAttributeField(Schema::AttributeField("aaa", Schema::INT32,
- Schema::ARRAY));
- s.addAttributeField(Schema::AttributeField("aaw", Schema::INT32,
- Schema::WEIGHTEDSET));
+ s.addIndexField(Schema::IndexField("ia", schema::STRING));
+ s.addAttributeField(Schema::AttributeField("aa", schema::INT32));
+ s.addAttributeField(Schema::AttributeField("aaa", schema::INT32,
+ schema::ARRAY));
+ s.addAttributeField(Schema::AttributeField("aaw", schema::INT32,
+ schema::WEIGHTEDSET));
}
const int32_t doc_type_id = 787121340;
diff --git a/searchcore/src/tests/proton/document_iterator/document_iterator_test.cpp b/searchcore/src/tests/proton/document_iterator/document_iterator_test.cpp
index 12bba229821..684227ca440 100644
--- a/searchcore/src/tests/proton/document_iterator/document_iterator_test.cpp
+++ b/searchcore/src/tests/proton/document_iterator/document_iterator_test.cpp
@@ -37,7 +37,7 @@ using search::attribute::BasicType;
using search::attribute::CollectionType;
using search::attribute::Config;
using search::attribute::IAttributeContext;
-using search::index::Schema;
+using namespace search::index;
using storage::spi::Timestamp;
using storage::spi::Bucket;
using storage::spi::PartitionId;
@@ -229,9 +229,9 @@ struct AttrUnitDR : public UnitDR
: UnitDR(d->getType(), document::Document::UP(d->clone()), t, b, r),
_amgr(), _schema(), _aa(), _dd(), _ss()
{
- createAttribute(_aa, BasicType::INT32, Schema::INT32, "aa");
- createAttribute(_dd, BasicType::DOUBLE, Schema::DOUBLE, "dd");
- createAttribute(_ss, BasicType::STRING, Schema::STRING, "ss");
+ createAttribute(_aa, BasicType::INT32, schema::INT32, "aa");
+ createAttribute(_dd, BasicType::DOUBLE, schema::DOUBLE, "dd");
+ createAttribute(_ss, BasicType::STRING, schema::STRING, "ss");
}
AttrUnitDR(document::Document::UP d, Timestamp t, Bucket b, bool r,
@@ -239,11 +239,11 @@ struct AttrUnitDR : public UnitDR
: UnitDR(d->getType(), document::Document::UP(d->clone()), t, b, r),
_amgr(), _schema(), _aa(), _dd(), _ss()
{
- createAttribute(_aa, BasicType::INT32, Schema::INT32, "aa");
+ createAttribute(_aa, BasicType::INT32, schema::INT32, "aa");
addAttribute<IntFieldValue, int32_t>(*_aa, aa);
- createAttribute(_dd, BasicType::DOUBLE, Schema::DOUBLE, "dd");
+ createAttribute(_dd, BasicType::DOUBLE, schema::DOUBLE, "dd");
addAttribute<DoubleFieldValue, double>(*_dd, dd);
- createAttribute(_ss, BasicType::STRING, Schema::STRING, "ss");
+ createAttribute(_ss, BasicType::STRING, schema::STRING, "ss");
addAttribute<StringFieldValue, vespalib::string>(*_ss, ss);
}
diff --git a/searchcore/src/tests/proton/reprocessing/attribute_reprocessing_initializer/attribute_reprocessing_initializer_test.cpp b/searchcore/src/tests/proton/reprocessing/attribute_reprocessing_initializer/attribute_reprocessing_initializer_test.cpp
index 44eb1353637..5d0056981ed 100644
--- a/searchcore/src/tests/proton/reprocessing/attribute_reprocessing_initializer/attribute_reprocessing_initializer_test.cpp
+++ b/searchcore/src/tests/proton/reprocessing/attribute_reprocessing_initializer/attribute_reprocessing_initializer_test.cpp
@@ -77,18 +77,18 @@ struct MyConfig
for (auto attr : attrs) {
if (attr == "tensor") {
_mgr->addAttribute(attr, test::AttributeUtils::getTensorConfig(), 1);
- _schema.addAttributeField(Schema::AttributeField(attr, Schema::TENSOR));
+ _schema.addAttributeField(Schema::AttributeField(attr, schema::TENSOR));
} else if (attr == "predicate") {
_mgr->addAttribute(attr, test::AttributeUtils::getPredicateConfig(), 1);
- _schema.addAttributeField(Schema::AttributeField(attr, Schema::BOOLEANTREE));
+ _schema.addAttributeField(Schema::AttributeField(attr, schema::BOOLEANTREE));
} else {
_mgr->addAttribute(attr, test::AttributeUtils::getStringConfig(), 1);
- _schema.addAttributeField(Schema::AttributeField(attr, Schema::STRING));
+ _schema.addAttributeField(Schema::AttributeField(attr, schema::STRING));
}
}
}
void addIndexField(const vespalib::string &name) {
- _schema.addIndexField(Schema::IndexField(name, Schema::STRING));
+ _schema.addIndexField(Schema::IndexField(name, schema::STRING));
}
};
diff --git a/searchcore/src/vespa/searchcore/proton/server/schema_config_validator.cpp b/searchcore/src/vespa/searchcore/proton/server/schema_config_validator.cpp
index e0bb45e63c4..f970161bfdb 100644
--- a/searchcore/src/vespa/searchcore/proton/server/schema_config_validator.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/schema_config_validator.cpp
@@ -1,12 +1,12 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/fastos/fastos.h>
-#include <vespa/log/log.h>
-LOG_SETUP(".proton.server.schema_config_validator");
#include "schema_config_validator.h"
#include <vespa/vespalib/util/stringfmt.h>
+#include <vespa/log/log.h>
+LOG_SETUP(".proton.server.schema_config_validator");
-using search::index::Schema;
+using namespace search::index;
using vespalib::make_string;
namespace proton {
@@ -189,8 +189,8 @@ checkDataTypeFunc(const Schema::Field &oldField,
make_string("Trying to add %s field `%s' of data type %s, "
"but it has been of of data type %s earlier",
fieldClass.c_str(), newField.getName().c_str(),
- Schema::getTypeName(newField.getDataType()).c_str(),
- Schema::getTypeName(oldField.getDataType()).c_str()));
+ schema::getTypeName(newField.getDataType()).c_str(),
+ schema::getTypeName(oldField.getDataType()).c_str()));
}
return CV::Result();
}
@@ -205,8 +205,8 @@ checkCollectionTypeFunc(const Schema::Field &oldField,
make_string("Trying to add %s field `%s' of collection type %s, "
"but it has been of of collection type %s earlier",
fieldClass.c_str(), newField.getName().c_str(),
- Schema::getTypeName(newField.getCollectionType()).c_str(),
- Schema::getTypeName(oldField.getCollectionType()).c_str()));
+ schema::getTypeName(newField.getCollectionType()).c_str(),
+ schema::getTypeName(oldField.getCollectionType()).c_str()));
}
return CV::Result();
}