diff options
43 files changed, 236 insertions, 255 deletions
diff --git a/configdefinitions/src/vespa/attributes.def b/configdefinitions/src/vespa/attributes.def index 344322d3873..f9db9eb2f0d 100644 --- a/configdefinitions/src/vespa/attributes.def +++ b/configdefinitions/src/vespa/attributes.def @@ -2,7 +2,7 @@ namespace=vespa.config.search attribute[].name string -attribute[].datatype enum { STRING, BOOL, UINT1, UINT2, UINT4, INT8, INT16, INT32, INT64, FLOAT16, FLOAT, DOUBLE, PREDICATE, TENSOR, REFERENCE, NONE } default=NONE +attribute[].datatype enum { STRING, BOOL, UINT2, UINT4, INT8, INT16, INT32, INT64, FLOAT16, FLOAT, DOUBLE, PREDICATE, TENSOR, REFERENCE, NONE } default=NONE attribute[].collectiontype enum { SINGLE, ARRAY, WEIGHTEDSET } default=SINGLE attribute[].removeifzero bool default=false attribute[].createifnonexistent bool default=false diff --git a/searchcommon/src/tests/schema/schema_test.cpp b/searchcommon/src/tests/schema/schema_test.cpp index 8a70e4f12df..e9997c2e70d 100644 --- a/searchcommon/src/tests/schema/schema_test.cpp +++ b/searchcommon/src/tests/schema/schema_test.cpp @@ -1,16 +1,16 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/log/log.h> #include <vespa/vespalib/stllike/string.h> #include <fstream> #include <vespa/vespalib/testkit/test_kit.h> #include <vespa/config/common/configparser.h> #include <vespa/searchcommon/common/schemaconfigurer.h> +#include <vespa/searchcommon/common/schema.h> +#include <vespa/log/log.h> LOG_SETUP("schema_test"); using vespalib::string; -namespace search { -namespace index { +namespace search::index { using schema::DataType; using schema::CollectionType; @@ -426,7 +426,6 @@ TEST("require that schema can be built with imported attribute fields") TEST_DO(assertField(SIAF("regular", DataType::INT32, CollectionType::SINGLE), regular[0])); } -} // namespace index -} // namespace search +} TEST_MAIN() { TEST_RUN_ALL(); } diff --git a/searchcommon/src/vespa/searchcommon/attribute/basictype.cpp b/searchcommon/src/vespa/searchcommon/attribute/basictype.cpp index 67093c686b5..b3137181ce1 100644 --- a/searchcommon/src/vespa/searchcommon/attribute/basictype.cpp +++ b/searchcommon/src/vespa/searchcommon/attribute/basictype.cpp @@ -8,7 +8,7 @@ namespace search::attribute { const BasicType::TypeInfo BasicType::_typeTable[BasicType::MAX_TYPE] = { { BasicType::NONE, 0, "none" }, { BasicType::STRING, 0, "string" }, - { BasicType::UINT1, sizeof(int8_t), "uint1" }, + { BasicType::BOOL, sizeof(int8_t), "bool" }, { BasicType::UINT2, sizeof(int8_t), "uint2" }, { BasicType::UINT4, sizeof(int8_t), "uint4" }, { BasicType::INT8, sizeof(int8_t), "int8" }, @@ -18,7 +18,7 @@ const BasicType::TypeInfo BasicType::_typeTable[BasicType::MAX_TYPE] = { { BasicType::FLOAT, sizeof(float), "float" }, { BasicType::DOUBLE, sizeof(double), "double" }, { BasicType::PREDICATE, 0, "predicate" }, - { BasicType::TENSOR, 0, "tensor" }, + { BasicType::TENSOR, 0, "tensor" }, { BasicType::REFERENCE, 12, "reference" } }; diff --git a/searchcommon/src/vespa/searchcommon/attribute/basictype.h b/searchcommon/src/vespa/searchcommon/attribute/basictype.h index 5bc51cdbea8..9be26b0816b 100644 --- a/searchcommon/src/vespa/searchcommon/attribute/basictype.h +++ b/searchcommon/src/vespa/searchcommon/attribute/basictype.h @@ -12,7 +12,7 @@ class BasicType enum Type { NONE = 0, STRING = 1, - UINT1 = 2, + BOOL = 2, UINT2 = 3, UINT4 = 4, INT8 = 5, @@ -36,6 +36,7 @@ class BasicType const char * asString() const { return asString(_type); } bool isUnsigned() const { return isUnsigned(_type); } size_t fixedSize() const { return fixedSize(_type); } + static BasicType fromType(bool) { return BOOL; } static BasicType fromType(int8_t) { return INT8; } static BasicType fromType(int16_t) { return INT16; } static BasicType fromType(int32_t) { return INT32; } diff --git a/searchcommon/src/vespa/searchcommon/attribute/iattributevector.h b/searchcommon/src/vespa/searchcommon/attribute/iattributevector.h index 0d3e58331c6..7ac2e701717 100644 --- a/searchcommon/src/vespa/searchcommon/attribute/iattributevector.h +++ b/searchcommon/src/vespa/searchcommon/attribute/iattributevector.h @@ -322,7 +322,7 @@ public: **/ virtual bool isIntegerType() const { BasicType::Type t = getBasicType(); - return t == BasicType::UINT1 || + return t == BasicType::BOOL || t == BasicType::UINT2 || t == BasicType::UINT4 || t == BasicType::INT8 || diff --git a/searchcommon/src/vespa/searchcommon/common/datatype.cpp b/searchcommon/src/vespa/searchcommon/common/datatype.cpp index f3b2099294e..be4ed5c3715 100644 --- a/searchcommon/src/vespa/searchcommon/common/datatype.cpp +++ b/searchcommon/src/vespa/searchcommon/common/datatype.cpp @@ -11,7 +11,7 @@ using config::InvalidConfigException; DataType dataTypeFromName(vespalib::stringref name) { - if (name == "UINT1") { return DataType::UINT1; } + if (name == "BOOL") { return DataType::BOOL; } else if (name == "UINT2") { return DataType::UINT2; } else if (name == "UINT4") { return DataType::UINT4; } else if (name == "INT8") { return DataType::INT8; } @@ -30,7 +30,7 @@ dataTypeFromName(vespalib::stringref name) { } } -const char *datatype_str[] = { "UINT1", +const char *datatype_str[] = { "BOOL", "UINT2", "UINT4", "INT8", diff --git a/searchcommon/src/vespa/searchcommon/common/datatype.h b/searchcommon/src/vespa/searchcommon/common/datatype.h index f21b6b9d5e9..35f885aee53 100644 --- a/searchcommon/src/vespa/searchcommon/common/datatype.h +++ b/searchcommon/src/vespa/searchcommon/common/datatype.h @@ -9,7 +9,8 @@ namespace search::index::schema { /** * Basic data type for a field. **/ -enum class DataType { UINT1 = 0, +enum class DataType { + BOOL = 0, UINT2 = 1, UINT4 = 2, INT8 = 3, diff --git a/searchcommon/src/vespa/searchcommon/common/schemaconfigurer.cpp b/searchcommon/src/vespa/searchcommon/common/schemaconfigurer.cpp index cae2299132f..401003cb74b 100644 --- a/searchcommon/src/vespa/searchcommon/common/schemaconfigurer.cpp +++ b/searchcommon/src/vespa/searchcommon/common/schemaconfigurer.cpp @@ -1,6 +1,14 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "schemaconfigurer.h" +#include <vespa/config-attributes.h> +#include <vespa/config-imported-fields.h> +#include <vespa/config-indexschema.h> +#include <vespa/config-summary.h> +#include <vespa/searchcommon/common/schema.h> +#include <vespa/searchcommon/attribute/collectiontype.h> +#include <vespa/searchcommon/attribute/basictype.h> + #include <vespa/searchcommon/config/subscriptionproxyng.h> #include <vespa/log/log.h> @@ -9,8 +17,7 @@ LOG_SETUP(".index.schemaconfigurer"); using namespace config; using namespace vespa::config::search; -namespace search { -namespace index { +namespace search::index { using schema::DataType; using schema::CollectionType; @@ -53,8 +60,8 @@ convertDataType(const ConfigType &type) switch (type) { case ConfigType::STRING: return DataType::STRING; - case ConfigType::UINT1: - return DataType::UINT1; + case ConfigType::BOOL: + return DataType::BOOL; case ConfigType::UINT2: return DataType::UINT2; case ConfigType::UINT4: @@ -228,8 +235,7 @@ SchemaConfigurer::configure(const SummaryConfig & cfg) SchemaBuilder::build(cfg, _schema); } -SchemaConfigurer::SchemaConfigurer(Schema &schema, - const vespalib::string &configId) +SchemaConfigurer::SchemaConfigurer(Schema &schema, const vespalib::string &configId) : _schema(schema) { search::SubscriptionProxyNg<SchemaConfigurer, IndexschemaConfig> @@ -243,6 +249,4 @@ SchemaConfigurer::SchemaConfigurer(Schema &schema, summarySubscriber.subscribe(configId.c_str()); } - -} // namespace search::index -} // namespace search +} diff --git a/searchcommon/src/vespa/searchcommon/common/schemaconfigurer.h b/searchcommon/src/vespa/searchcommon/common/schemaconfigurer.h index e1999e45296..75d75bc256b 100644 --- a/searchcommon/src/vespa/searchcommon/common/schemaconfigurer.h +++ b/searchcommon/src/vespa/searchcommon/common/schemaconfigurer.h @@ -2,16 +2,17 @@ #pragma once -#include <vespa/config-attributes.h> -#include <vespa/config-imported-fields.h> -#include <vespa/config-indexschema.h> -#include <vespa/config-summary.h> -#include <vespa/searchcommon/common/schema.h> -#include <vespa/searchcommon/attribute/collectiontype.h> -#include <vespa/searchcommon/attribute/basictype.h> +#include <vespa/vespalib/stllike/string.h> -namespace search { -namespace index { +namespace vespa::config::search::internal { + class InternalIndexschemaType; + class InternalAttributesType; + class InternalSummaryType; +} + +namespace search::index { + +class Schema; /** * Schema class used to give a high-level description of the content @@ -20,34 +21,40 @@ namespace index { class SchemaBuilder { public: + using IndexschemaConfig = const vespa::config::search::internal::InternalIndexschemaType; + using AttributesConfig = const vespa::config::search::internal::InternalAttributesType; + using SummaryConfig = const vespa::config::search::internal::InternalSummaryType; /** * Build from indexschema config. * - * @param indexCfg vespa::config::search::IndexschemaConfig to use + * @param indexCfg IndexschemaConfig to use */ - static void build(const vespa::config::search::IndexschemaConfig &cfg, Schema &schema); + static void build(const IndexschemaConfig &cfg, Schema &schema); /** * Build from attribute config. * - * @param attributeCfg vespa::config::search::AttributesConfig to use + * @param attributeCfg AttributesConfig to use **/ - static void build(const vespa::config::search::AttributesConfig &cfg, Schema &schema); + static void build(const AttributesConfig &cfg, Schema &schema); /** * Build from summary config. * - * @param summaryCfg vespa::config::search::SummaryConfig to use + * @param summaryCfg SummaryConfig to use **/ - static void build(const vespa::config::search::SummaryConfig &cfg, Schema &schema); + static void build(const SummaryConfig &cfg, Schema &schema); }; class SchemaConfigurer { private: + using IndexschemaConfig = SchemaBuilder::IndexschemaConfig; + using AttributesConfig = SchemaBuilder::AttributesConfig; + using SummaryConfig = SchemaBuilder::SummaryConfig; Schema & _schema; - void configure(const vespa::config::search::IndexschemaConfig & cfg); - void configure(const vespa::config::search::AttributesConfig & cfg); - void configure(const vespa::config::search::SummaryConfig & cfg); + void configure(const IndexschemaConfig & cfg); + void configure(const AttributesConfig & cfg); + void configure(const SummaryConfig & cfg); public: /** @@ -58,6 +65,4 @@ public: SchemaConfigurer(Schema & schema, const vespalib::string &configId); }; -} // namespace search::index -} // namespace search - +} diff --git a/searchcore/src/apps/tests/persistenceconformance_test.cpp b/searchcore/src/apps/tests/persistenceconformance_test.cpp index 828ca384bc5..52ba963ff01 100644 --- a/searchcore/src/apps/tests/persistenceconformance_test.cpp +++ b/searchcore/src/apps/tests/persistenceconformance_test.cpp @@ -28,6 +28,9 @@ #include <vespa/searchlib/transactionlog/translogserver.h> #include <vespa/searchsummary/config/config-juniperrc.h> #include <vespa/config-bucketspaces.h> +#include <vespa/config-attributes.h> +#include <vespa/config-indexschema.h> +#include <vespa/config-summary.h> #include <vespa/vespalib/io/fileutil.h> #include <vespa/log/log.h> diff --git a/searchcore/src/vespa/searchcore/proton/attribute/document_field_retriever.cpp b/searchcore/src/vespa/searchcore/proton/attribute/document_field_retriever.cpp index d05fc98f152..3ce54b790c1 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/document_field_retriever.cpp +++ b/searchcore/src/vespa/searchcore/proton/attribute/document_field_retriever.cpp @@ -110,15 +110,14 @@ DocumentFieldRetriever::populate(DocumentIdT lid, bool isIndexField) { switch (attr.getBasicType()) { - case BasicType::UINT1: + case BasicType::BOOL: case BasicType::UINT2: case BasicType::UINT4: case BasicType::INT8: case BasicType::INT16: case BasicType::INT32: case BasicType::INT64: - setValue<IAttributeVector::largeint_t>( - lid, doc, fieldName, attr); + setValue<IAttributeVector::largeint_t>(lid, doc, fieldName, attr); break; case BasicType::FLOAT: case BasicType::DOUBLE: diff --git a/searchcore/src/vespa/searchcore/proton/common/attributefieldvaluenode.cpp b/searchcore/src/vespa/searchcore/proton/common/attributefieldvaluenode.cpp index b76451b377d..21789364442 100644 --- a/searchcore/src/vespa/searchcore/proton/common/attributefieldvaluenode.cpp +++ b/searchcore/src/vespa/searchcore/proton/common/attributefieldvaluenode.cpp @@ -58,7 +58,7 @@ getValue(const Context &context) const return Value::UP(new StringValue(content[0])); } while (0); break; - case BasicType::UINT1: + case BasicType::BOOL: case BasicType::UINT2: case BasicType::UINT4: case BasicType::INT8: diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/CMakeLists.txt b/searchcore/src/vespa/searchcore/proton/documentmetastore/CMakeLists.txt index 9507829bbf9..d257f29c9df 100644 --- a/searchcore/src/vespa/searchcore/proton/documentmetastore/CMakeLists.txt +++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/CMakeLists.txt @@ -15,6 +15,7 @@ vespa_add_library(searchcore_documentmetastore STATIC lid_reuse_delayer_config.cpp lidreusedelayer.cpp lidstatevector.cpp + lid_hold_list.cpp DEPENDS searchcore_attribute searchcore_bucketdb diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastore.h b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastore.h index 2fd3bcdae64..a3c470575a4 100644 --- a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastore.h +++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastore.h @@ -8,7 +8,6 @@ #include "lid_allocator.h" #include "lid_gid_key_comparator.h" #include "lid_hold_list.h" -#include "lidstatevector.h" #include "raw_document_meta_data.h" #include <vespa/searchcore/proton/bucketdb/bucket_db_owner.h> #include <vespa/searchcore/proton/common/subdbtype.h> diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_allocator.cpp b/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_allocator.cpp index 63d815ffe82..de1a09ab6d3 100644 --- a/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_allocator.cpp +++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_allocator.cpp @@ -56,8 +56,7 @@ LidAllocator::peekFreeLid(DocId lidLimit) } void -LidAllocator::ensureSpace(uint32_t newSize, - uint32_t newCapacity) +LidAllocator::ensureSpace(uint32_t newSize, uint32_t newCapacity) { _freeLids.resizeVector(newSize, newCapacity); _usedLids.resizeVector(newSize, newCapacity); diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_hold_list.cpp b/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_hold_list.cpp new file mode 100644 index 00000000000..53c8bbc8ae4 --- /dev/null +++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_hold_list.cpp @@ -0,0 +1,34 @@ +// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. + +#include "lid_hold_list.h" +#include "lidstatevector.h" + +namespace proton { + +LidHoldList::LidHoldList() = default; +LidHoldList::~LidHoldList() = default; + +void +LidHoldList::add(const uint32_t data, generation_t generation) { + if (!_holdList.empty()) { + assert(generation >= _holdList.back().second); + } + _holdList.push_back(std::make_pair(data, generation)); +} + +void +LidHoldList::clear() { + _holdList.clear(); +} + +void +LidHoldList::trimHoldLists(generation_t firstUsed, LidStateVector &freeLids) +{ + while (!_holdList.empty() && _holdList.front().second < firstUsed) { + uint32_t lid = _holdList.front().first; + freeLids.setBit(lid); + _holdList.pop_front(); + } +} + +} diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_hold_list.h b/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_hold_list.h index 01a3c645f45..ff14f3af3b6 100644 --- a/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_hold_list.h +++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_hold_list.h @@ -1,12 +1,13 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include "lidstatevector.h" #include <vespa/vespalib/util/generationhandler.h> #include <deque> namespace proton { +class LidStateVector; + /** * Class used to hold <lid, generation> pairs before reuse. * A lid is free for reuse if the associated generation < first used @@ -22,21 +23,14 @@ private: ElementDeque _holdList; public: - LidHoldList() - : _holdList() - { - } + LidHoldList(); + ~LidHoldList(); /** * Adds a new element with the given generation. * Elements must be added with ascending generations. **/ - void add(const uint32_t data, generation_t generation) { - if (!_holdList.empty()) { - assert(generation >= _holdList.back().second); - } - _holdList.push_back(std::make_pair(data, generation)); - } + void add(const uint32_t data, generation_t generation); /** * Returns the total number of elements. @@ -46,19 +40,12 @@ public: /** * Clears the free list. **/ - void clear() { _holdList.clear(); } + void clear(); /** * Frees up elements with generation < first used generation for reuse. **/ - void trimHoldLists(generation_t firstUsed, LidStateVector &freeLids) - { - while (!_holdList.empty() && _holdList.front().second < firstUsed) { - uint32_t lid = _holdList.front().first; - freeLids.setBit(lid); - _holdList.pop_front(); - } - } + void trimHoldLists(generation_t firstUsed, LidStateVector &freeLids); }; diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/lidstatevector.cpp b/searchcore/src/vespa/searchcore/proton/documentmetastore/lidstatevector.cpp index 5208c1165da..24ae86760c9 100644 --- a/searchcore/src/vespa/searchcore/proton/documentmetastore/lidstatevector.cpp +++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/lidstatevector.cpp @@ -6,11 +6,9 @@ namespace proton { using vespalib::GenerationHolder; -LidStateVector::LidStateVector(unsigned int newSize, - unsigned int newCapacity, +LidStateVector::LidStateVector(unsigned int newSize, unsigned int newCapacity, GenerationHolder &generationHolder, - bool trackLowest, - bool trackHighest) + bool trackLowest, bool trackHighest) : _bv(newSize, newCapacity, generationHolder), _lowest(trackLowest ? newSize : 0u), _highest(0), @@ -20,11 +18,7 @@ LidStateVector::LidStateVector(unsigned int newSize, { } - -LidStateVector::~LidStateVector() -{ -} - +LidStateVector::~LidStateVector() = default; void LidStateVector::resizeVector(uint32_t newSize, uint32_t newCapacity) diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/lidstatevector.h b/searchcore/src/vespa/searchcore/proton/documentmetastore/lidstatevector.h index 0a5242323e6..53f94896131 100644 --- a/searchcore/src/vespa/searchcore/proton/documentmetastore/lidstatevector.h +++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/lidstatevector.h @@ -4,8 +4,7 @@ #include <vespa/searchlib/common/growablebitvector.h> -namespace proton -{ +namespace proton { class LidStateVector { @@ -16,22 +15,14 @@ class LidStateVector bool _trackLowest; bool _trackHighest; - void - updateLowest(); - - void - updateHighest(); - - inline void - maybeUpdateLowest() - { + void updateLowest(); + void updateHighest(); + void maybeUpdateLowest() { if (_trackLowest && _lowest < _bv.size() && !_bv.testBit(_lowest)) updateLowest(); } - inline void - maybeUpdateHighest() - { + void maybeUpdateHighest() { if (_trackHighest && _highest != 0 && !_bv.testBit(_highest)) updateHighest(); } @@ -40,64 +31,34 @@ class LidStateVector * Get number of bits set in vector. Should only be called by * write thread. */ - uint32_t - internalCount(); + uint32_t internalCount(); public: - LidStateVector(unsigned int newSize, - unsigned int newCapacity, + LidStateVector(unsigned int newSize, unsigned int newCapacity, vespalib::GenerationHolder &generationHolder, - bool trackLowest, - bool trackHighest); + bool trackLowest, bool trackHighest); ~LidStateVector(); - void - resizeVector(uint32_t newSize, uint32_t newCapacity); - - void - setBit(unsigned int idx); - - void - clearBit(unsigned int idx); - - inline bool - testBit(unsigned int idx) const - { - return _bv.testBit(idx); - } - - inline unsigned int - size() const - { - return _bv.size(); - } - - inline unsigned int - byteSize() const - { + void resizeVector(uint32_t newSize, uint32_t newCapacity); + void setBit(unsigned int idx); + void clearBit(unsigned int idx); + bool testBit(unsigned int idx) const { return _bv.testBit(idx); } + unsigned int size() const { return _bv.size(); } + unsigned int byteSize() const { return _bv.extraByteSize() + sizeof(LidStateVector); } - - bool - empty() const; - - unsigned int - getLowest() const; - - unsigned int - getHighest() const; + bool empty() const; + unsigned int getLowest() const; + unsigned int getHighest() const; /** * Get cached number of bits set in vector. Called by read or * write thread. Write thread must updated cached number as needed. */ - uint32_t - count() const; + uint32_t count() const; - unsigned int - getNextTrueBit(unsigned int idx) const - { + unsigned int getNextTrueBit(unsigned int idx) const { return _bv.getNextTrueBit(idx); } @@ -105,4 +66,3 @@ public: }; } - diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdbconfigmanager.cpp b/searchcore/src/vespa/searchcore/proton/server/documentdbconfigmanager.cpp index 99c4cfb8130..0429ccb4a61 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentdbconfigmanager.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/documentdbconfigmanager.cpp @@ -9,6 +9,10 @@ #include <vespa/config-summarymap.h> #include <vespa/config/file_acquirer/file_acquirer.h> #include <vespa/config/helper/legacy.h> +#include <vespa/config-attributes.h> +#include <vespa/config-imported-fields.h> +#include <vespa/config-indexschema.h> +#include <vespa/config-summary.h> #include <vespa/searchcommon/common/schemaconfigurer.h> #include <vespa/searchlib/index/schemautil.h> #include <vespa/searchsummary/config/config-juniperrc.h> diff --git a/searchcore/src/vespa/searchcore/proton/server/fileconfigmanager.cpp b/searchcore/src/vespa/searchcore/proton/server/fileconfigmanager.cpp index 72f48df3295..9208daf5f26 100644 --- a/searchcore/src/vespa/searchcore/proton/server/fileconfigmanager.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/fileconfigmanager.cpp @@ -12,6 +12,10 @@ #include <vespa/vespalib/io/fileutil.h> #include <vespa/config-summarymap.h> #include <vespa/config-rank-profiles.h> +#include <vespa/config-attributes.h> +#include <vespa/config-imported-fields.h> +#include <vespa/config-indexschema.h> +#include <vespa/config-summary.h> #include <vespa/searchsummary/config/config-juniperrc.h> #include <vespa/config/helper/configgetter.hpp> #include <sstream> diff --git a/searchlib/src/tests/attribute/attribute_test.cpp b/searchlib/src/tests/attribute/attribute_test.cpp index d4f716acb7a..8637a230bf5 100644 --- a/searchlib/src/tests/attribute/attribute_test.cpp +++ b/searchlib/src/tests/attribute/attribute_test.cpp @@ -45,7 +45,7 @@ bool isUnsignedSmallIntAttribute(const BasicType::Type &type) { switch (type) { - case BasicType::UINT1: + case BasicType::BOOL: case BasicType::UINT2: case BasicType::UINT4: return true; @@ -531,9 +531,9 @@ void AttributeTest::testReload() testReloadInt(iv1, iv2, iv3, 100); } { - AttributePtr iv1 = createAttribute("suint1_1", Config(BasicType::UINT1, CollectionType::SINGLE)); - AttributePtr iv2 = createAttribute("suint1_2", Config(BasicType::UINT1, CollectionType::SINGLE)); - AttributePtr iv3 = createAttribute("suint1_3", Config(BasicType::UINT1, CollectionType::SINGLE)); + AttributePtr iv1 = createAttribute("suint1_1", Config(BasicType::BOOL, CollectionType::SINGLE)); + AttributePtr iv2 = createAttribute("suint1_2", Config(BasicType::BOOL, CollectionType::SINGLE)); + AttributePtr iv3 = createAttribute("suint1_3", Config(BasicType::BOOL, CollectionType::SINGLE)); testReloadInt(iv1, iv2, iv3, 0); testReloadInt(iv1, iv2, iv3, 100); } @@ -2038,7 +2038,7 @@ void AttributeTest::testCompactLidSpace(const Config &config) { switch (config.basicType().type()) { - case BasicType::UINT1: + case BasicType::BOOL: case BasicType::UINT2: case BasicType::UINT4: case BasicType::INT8: @@ -2074,7 +2074,7 @@ AttributeTest::testCompactLidSpace(const Config &config) void AttributeTest::testCompactLidSpace() { - TEST_DO(testCompactLidSpace(Config(BasicType::UINT1, CollectionType::SINGLE))); + TEST_DO(testCompactLidSpace(Config(BasicType::BOOL, CollectionType::SINGLE))); TEST_DO(testCompactLidSpace(Config(BasicType::UINT2, CollectionType::SINGLE))); TEST_DO(testCompactLidSpace(Config(BasicType::UINT4, CollectionType::SINGLE))); TEST_DO(testCompactLidSpace(Config(BasicType::INT8, CollectionType::SINGLE))); diff --git a/searchlib/src/tests/attribute/searchcontext/searchcontext.cpp b/searchlib/src/tests/attribute/searchcontext/searchcontext.cpp index 29849139fc5..d0dc7044fb5 100644 --- a/searchlib/src/tests/attribute/searchcontext/searchcontext.cpp +++ b/searchlib/src/tests/attribute/searchcontext/searchcontext.cpp @@ -31,7 +31,7 @@ isUnsignedSmallIntAttribute(const AttributeVector &a) { switch (a.getBasicType()) { - case attribute::BasicType::UINT1: + case attribute::BasicType::BOOL: case attribute::BasicType::UINT2: case attribute::BasicType::UINT4: return true; diff --git a/searchlib/src/tests/common/bitvector/bitvector_test.cpp b/searchlib/src/tests/common/bitvector/bitvector_test.cpp index c1170869c26..ea70806aec2 100644 --- a/searchlib/src/tests/common/bitvector/bitvector_test.cpp +++ b/searchlib/src/tests/common/bitvector/bitvector_test.cpp @@ -555,33 +555,33 @@ TEST("requireThatGrowWorks") v.invalidateCachedCount(); EXPECT_TRUE(assertBV("[7,39,71,103]", v)); EXPECT_EQUAL(4u, v.countTrueBits()); - v.reserve(204); + EXPECT_TRUE(v.reserve(204)); EXPECT_EQUAL(200u, v.size()); EXPECT_EQUAL(204u, v.capacity()); EXPECT_TRUE(assertBV("[7,39,71,103]", v)); EXPECT_EQUAL(4u, v.countTrueBits()); - v.extend(202); + EXPECT_FALSE(v.extend(202)); EXPECT_EQUAL(202u, v.size()); EXPECT_EQUAL(204u, v.capacity()); EXPECT_TRUE(assertBV("[7,39,71,103]", v)); EXPECT_EQUAL(4u, v.countTrueBits()); - v.shrink(200); + EXPECT_FALSE(v.shrink(200)); EXPECT_EQUAL(200u, v.size()); EXPECT_EQUAL(204u, v.capacity()); EXPECT_TRUE(assertBV("[7,39,71,103]", v)); EXPECT_EQUAL(4u, v.countTrueBits()); - v.reserve(204); + EXPECT_FALSE(v.reserve(204)); EXPECT_EQUAL(200u, v.size()); EXPECT_EQUAL(204u, v.capacity()); EXPECT_TRUE(assertBV("[7,39,71,103]", v)); EXPECT_EQUAL(4u, v.countTrueBits()); - v.shrink(202); + EXPECT_FALSE(v.shrink(202)); EXPECT_EQUAL(202u, v.size()); EXPECT_EQUAL(204u, v.capacity()); EXPECT_TRUE(assertBV("[7,39,71,103]", v)); EXPECT_EQUAL(4u, v.countTrueBits()); - v.shrink(100); + EXPECT_FALSE(v.shrink(100)); EXPECT_EQUAL(100u, v.size()); EXPECT_EQUAL(204u, v.capacity()); EXPECT_TRUE(assertBV("[7,39,71]", v)); diff --git a/searchlib/src/tests/queryeval/queryeval.cpp b/searchlib/src/tests/queryeval/queryeval.cpp index 9f4d8403d76..8dad5427afa 100644 --- a/searchlib/src/tests/queryeval/queryeval.cpp +++ b/searchlib/src/tests/queryeval/queryeval.cpp @@ -94,9 +94,9 @@ TEST("test that OR.andWith is a NOOP") { ch.push_back(new TrueSearch(tfmd)); ch.push_back(new TrueSearch(tfmd)); SearchIterator::UP search(OrSearch::create(ch, true)); - SearchIterator::UP filter(new TrueSearch(tfmd)); + auto filter = std::make_unique<TrueSearch>(tfmd); - EXPECT_TRUE(nullptr != search->andWith(std::move(filter), 1).get()); + EXPECT_TRUE(search->andWith(std::move(filter), 1)); } TEST("test that non-strict AND.andWith is a NOOP") { @@ -105,9 +105,9 @@ TEST("test that non-strict AND.andWith is a NOOP") { ch.push_back(new TrueSearch(tfmd)); ch.push_back(new TrueSearch(tfmd)); SearchIterator::UP search(AndSearch::create(ch, false)); - SearchIterator::UP filter(new TrueSearch(tfmd)); + SearchIterator::UP filter = std::make_unique<TrueSearch>(tfmd); filter = search->andWith(std::move(filter), 8); - EXPECT_TRUE(nullptr != filter.get()); + EXPECT_TRUE(filter); } TEST("test that strict AND.andWith steals filter and places it correctly based on estimate") { @@ -117,7 +117,7 @@ TEST("test that strict AND.andWith steals filter and places it correctly based o ch.push_back(new TrueSearch(tfmd)); SearchIterator::UP search(AndSearch::create(ch, true)); static_cast<AndSearch &>(*search).estimate(7); - SearchIterator::UP filter(new TrueSearch(tfmd)); + auto filter = std::make_unique<TrueSearch>(tfmd); SearchIterator * filterP = filter.get(); EXPECT_TRUE(nullptr == search->andWith(std::move(filter), 8).get()); @@ -127,7 +127,7 @@ TEST("test that strict AND.andWith steals filter and places it correctly based o EXPECT_EQUAL(filterP, andChildren[1]); EXPECT_EQUAL(ch[1], andChildren[2]); - SearchIterator::UP filter2(new TrueSearch(tfmd)); + auto filter2 = std::make_unique<TrueSearch>(tfmd); SearchIterator * filter2P = filter2.get(); EXPECT_TRUE(nullptr == search->andWith(std::move(filter2), 6).get()); EXPECT_EQUAL(4u, andChildren.size()); @@ -151,7 +151,7 @@ TEST("test that strict AND.andWith does not place non-strict iterator first") { ch.push_back(new TrueSearch(tfmd)); SearchIterator::UP search(AndSearch::create(ch, true)); static_cast<AndSearch &>(*search).estimate(7); - SearchIterator::UP filter(new NonStrictTrueSearch(tfmd)); + auto filter = std::make_unique<NonStrictTrueSearch>(tfmd); SearchIterator * filterP = filter.get(); EXPECT_TRUE(nullptr == search->andWith(std::move(filter), 6).get()); const MultiSearch::Children & andChildren = static_cast<MultiSearch &>(*search).getChildren(); @@ -170,7 +170,7 @@ TEST("test that strict rank search forwards to its greedy first child") { .add(new TrueSearch(tfmd)), true) ); - SearchIterator::UP filter(new TrueSearch(tfmd)); + auto filter = std::make_unique<TrueSearch>(tfmd); EXPECT_TRUE(nullptr == search->andWith(std::move(filter), 8).get()); } @@ -183,7 +183,7 @@ TEST("test that non-strict rank search does NOT forward to its greedy first chil .add(new TrueSearch(tfmd)), false) ); - SearchIterator::UP filter(new TrueSearch(tfmd)); + auto filter = std::make_unique<TrueSearch>(tfmd); EXPECT_TRUE(nullptr != search->andWith(std::move(filter), 8).get()); } @@ -196,7 +196,7 @@ TEST("test that strict andnot search forwards to its greedy first child") { .add(new TrueSearch(tfmd)), true) ); - SearchIterator::UP filter(new TrueSearch(tfmd)); + auto filter = std::make_unique<TrueSearch>(tfmd); EXPECT_TRUE(nullptr == search->andWith(std::move(filter), 8).get()); } @@ -209,7 +209,7 @@ TEST("test that non-strict andnot search does NOT forward to its greedy first ch .add(new TrueSearch(tfmd)), false) ); - SearchIterator::UP filter(new TrueSearch(tfmd)); + auto filter = std::make_unique<TrueSearch>(tfmd); EXPECT_TRUE(nullptr != search->andWith(std::move(filter), 8).get()); } @@ -220,12 +220,11 @@ TEST("testAnd") { b.addHit(3).addHit(5).addHit(17).addHit(30).addHit(52); MatchData::UP md(MatchData::makeTestInstance(100, 10)); - AndBlueprint *and_b = new AndBlueprint(); - and_b->addChild(Blueprint::UP(new SimpleBlueprint(a))); - and_b->addChild(Blueprint::UP(new SimpleBlueprint(b))); - Blueprint::UP bp(and_b); - bp->fetchPostings(true); - SearchIterator::UP and_ab = bp->createSearch(*md, true); + auto and_b = std::make_unique<AndBlueprint>(); + and_b->addChild(std::make_unique<SimpleBlueprint>(a)); + and_b->addChild(std::make_unique<SimpleBlueprint>(b)); + and_b->fetchPostings(true); + SearchIterator::UP and_ab = and_b->createSearch(*md, true); EXPECT_TRUE(dynamic_cast<const AndSearch *>(and_ab.get()) != nullptr); EXPECT_EQUAL(4u, dynamic_cast<AndSearch &>(*and_ab).estimate()); @@ -248,12 +247,11 @@ TEST("testOr") { b.addHit(5).addHit(17).addHit(30); MatchData::UP md(MatchData::makeTestInstance(100, 10)); - OrBlueprint *or_b = new OrBlueprint(); - or_b->addChild(Blueprint::UP(new SimpleBlueprint(a))); - or_b->addChild(Blueprint::UP(new SimpleBlueprint(b))); - Blueprint::UP bp(or_b); - bp->fetchPostings(true); - SearchIterator::UP or_ab = bp->createSearch(*md, true); + auto or_b = std::make_unique<OrBlueprint>(); + or_b->addChild(std::make_unique<SimpleBlueprint>(a)); + or_b->addChild(std::make_unique<SimpleBlueprint>(b)); + or_b->fetchPostings(true); + SearchIterator::UP or_ab = or_b->createSearch(*md, true); SimpleResult res; res.search(*or_ab); @@ -281,12 +279,12 @@ public: _accumRemove(0), _accumInsert(0) { } - virtual void onRemove(size_t index) override { _accumRemove += index; } - virtual void onInsert(size_t index) override { _accumInsert += index; } + void onRemove(size_t index) override { _accumRemove += index; } + void onInsert(size_t index) override { _accumInsert += index; } size_t _accumRemove; size_t _accumInsert; private: - virtual void doSeek(uint32_t docid) override { (void) docid; } + void doSeek(uint32_t docid) override { (void) docid; } }; struct MultiSearchRemoveTest { @@ -339,7 +337,7 @@ public: _a.update(docId, 1); } _a.commit(); - _sc = _a.getSearch(search::QueryTermSimple::UP(new search::QueryTermSimple("1", search::QueryTermSimple::WORD)), + _sc = _a.getSearch(std::make_unique<search::QueryTermSimple>("1", search::QueryTermSimple::WORD), SearchContextParams().useBitVector(true)); } virtual SearchIterator::UP @@ -363,12 +361,11 @@ TEST("testAndNot") { b.addHit(5).addHit(17).addHit(30); MatchData::UP md(MatchData::makeTestInstance(100, 10)); - AndNotBlueprint *andnot_b = new AndNotBlueprint(); - andnot_b->addChild(Blueprint::UP(new SimpleBlueprint(a))); - andnot_b->addChild(Blueprint::UP(new SimpleBlueprint(b))); - Blueprint::UP bp(andnot_b); - bp->fetchPostings(true); - SearchIterator::UP andnot_ab = bp->createSearch(*md, true); + auto andnot_b = std::make_unique<AndNotBlueprint>(); + andnot_b->addChild(std::make_unique<SimpleBlueprint>(a)); + andnot_b->addChild(std::make_unique<SimpleBlueprint>(b)); + andnot_b->fetchPostings(true); + SearchIterator::UP andnot_ab = andnot_b->createSearch(*md, true); SimpleResult res; res.search(*andnot_ab); @@ -384,13 +381,12 @@ TEST("testAndNot") { b.addHit(5).addHit(17).addHit(30); MatchData::UP md(MatchData::makeTestInstance(100, 10)); - AndNotBlueprint *andnot_b = new AndNotBlueprint(); - andnot_b->addChild(Blueprint::UP(new SimpleBlueprint(a))); - andnot_b->addChild(Blueprint::UP(new DummySingleValueBitNumericAttributeBlueprint(b))); - Blueprint::UP bp(andnot_b); - bp->fetchPostings(true); - SearchIterator::UP andnot_ab = bp->createSearch(*md, true); - EXPECT_TRUE(dynamic_cast<const OptimizedAndNotForBlackListing *>(andnot_ab.get()) != NULL); + auto andnot_b = std::make_unique<AndNotBlueprint>(); + andnot_b->addChild(std::make_unique<SimpleBlueprint>(a)); + andnot_b->addChild(std::make_unique<DummySingleValueBitNumericAttributeBlueprint>(b)); + andnot_b->fetchPostings(true); + SearchIterator::UP andnot_ab = andnot_b->createSearch(*md, true); + EXPECT_TRUE(dynamic_cast<const OptimizedAndNotForBlackListing *>(andnot_ab.get()) != nullptr); SimpleResult res; res.search(*andnot_ab); @@ -408,16 +404,15 @@ TEST("testAndNot") { c.addHit(1).addHit(5).addHit(10).addHit(17).addHit(30); MatchData::UP md(MatchData::makeTestInstance(100, 10)); - AndNotBlueprint *andnot_b = new AndNotBlueprint(); - andnot_b->addChild(Blueprint::UP(new SimpleBlueprint(a))); - andnot_b->addChild(Blueprint::UP(new SimpleBlueprint(b))); + auto andnot_b = std::make_unique<AndNotBlueprint>(); + andnot_b->addChild(std::make_unique<SimpleBlueprint>(a)); + andnot_b->addChild(std::make_unique<SimpleBlueprint>(b)); - AndBlueprint *and_b = new AndBlueprint(); - and_b->addChild(Blueprint::UP(new SimpleBlueprint(c))); - and_b->addChild(Blueprint::UP(andnot_b)); - Blueprint::UP bp(and_b); - bp->fetchPostings(true); - SearchIterator::UP and_cab = bp->createSearch(*md, true); + auto and_b = std::make_unique<AndBlueprint>(); + and_b->addChild(std::make_unique<SimpleBlueprint>(c)); + and_b->addChild(std::move(andnot_b)); + and_b->fetchPostings(true); + SearchIterator::UP and_cab = and_b->createSearch(*md, true); SimpleResult res; res.search(*and_cab); @@ -438,12 +433,11 @@ TEST("testRank") { b.addHit(3).addHit(5).addHit(17).addHit(30).addHit(52); MatchData::UP md(MatchData::makeTestInstance(100, 10)); - RankBlueprint *rank_b = new RankBlueprint(); - rank_b->addChild(Blueprint::UP(new SimpleBlueprint(a))); - rank_b->addChild(Blueprint::UP(new SimpleBlueprint(b))); - Blueprint::UP bp(rank_b); - bp->fetchPostings(true); - SearchIterator::UP rank_ab = bp->createSearch(*md, true); + auto rank_b = std::make_unique<RankBlueprint>(); + rank_b->addChild(std::make_unique<SimpleBlueprint>(a)); + rank_b->addChild(std::make_unique<SimpleBlueprint>(b)); + rank_b->fetchPostings(true); + SearchIterator::UP rank_ab = rank_b->createSearch(*md, true); SimpleResult res; res.search(*rank_ab); diff --git a/searchlib/src/vespa/searchlib/attribute/attributefile.cpp b/searchlib/src/vespa/searchlib/attribute/attributefile.cpp index cf3ed0957b3..8e65942f60c 100644 --- a/searchlib/src/vespa/searchlib/attribute/attributefile.cpp +++ b/searchlib/src/vespa/searchlib/attribute/attributefile.cpp @@ -319,7 +319,7 @@ AttributeFile::getRecord() { std::unique_ptr<Record> record; switch (_config.basicType().type()) { - case BasicType::UINT1: + case BasicType::BOOL: case BasicType::UINT2: case BasicType::UINT4: case BasicType::INT8: diff --git a/searchlib/src/vespa/searchlib/attribute/configconverter.cpp b/searchlib/src/vespa/searchlib/attribute/configconverter.cpp index 5c1e0e09b62..ae08204f5bc 100644 --- a/searchlib/src/vespa/searchlib/attribute/configconverter.cpp +++ b/searchlib/src/vespa/searchlib/attribute/configconverter.cpp @@ -20,7 +20,7 @@ getDataTypeMap() { DataTypeMap map; map[AttributesConfig::Attribute::STRING] = BasicType::STRING; - map[AttributesConfig::Attribute::UINT1] = BasicType::UINT1; + map[AttributesConfig::Attribute::BOOL] = BasicType::BOOL; map[AttributesConfig::Attribute::UINT2] = BasicType::UINT2; map[AttributesConfig::Attribute::UINT4] = BasicType::UINT4; map[AttributesConfig::Attribute::INT8] = BasicType::INT8; diff --git a/searchlib/src/vespa/searchlib/attribute/createarrayfastsearch.cpp b/searchlib/src/vespa/searchlib/attribute/createarrayfastsearch.cpp index 17e6c91daba..0f74cfc7612 100644 --- a/searchlib/src/vespa/searchlib/attribute/createarrayfastsearch.cpp +++ b/searchlib/src/vespa/searchlib/attribute/createarrayfastsearch.cpp @@ -34,7 +34,7 @@ AttributeFactory::createArrayFastSearch(stringref name, const Config & info) assert(info.fastSearch()); AttributeVector::SP ret; switch(info.basicType().type()) { - case BasicType::UINT1: + case BasicType::BOOL: case BasicType::UINT2: case BasicType::UINT4: break; diff --git a/searchlib/src/vespa/searchlib/attribute/createarraystd.cpp b/searchlib/src/vespa/searchlib/attribute/createarraystd.cpp index ac82e4ba27a..f6b37658645 100644 --- a/searchlib/src/vespa/searchlib/attribute/createarraystd.cpp +++ b/searchlib/src/vespa/searchlib/attribute/createarraystd.cpp @@ -27,7 +27,7 @@ AttributeFactory::createArrayStd(stringref name, const Config & info) assert(info.collectionType().type() == attribute::CollectionType::ARRAY); AttributeVector::SP ret; switch(info.basicType().type()) { - case BasicType::UINT1: + case BasicType::BOOL: case BasicType::UINT2: case BasicType::UINT4: break; diff --git a/searchlib/src/vespa/searchlib/attribute/createsetfastsearch.cpp b/searchlib/src/vespa/searchlib/attribute/createsetfastsearch.cpp index 323d073589f..d8bc65bce78 100644 --- a/searchlib/src/vespa/searchlib/attribute/createsetfastsearch.cpp +++ b/searchlib/src/vespa/searchlib/attribute/createsetfastsearch.cpp @@ -35,7 +35,7 @@ AttributeFactory::createSetFastSearch(stringref name, const Config & info) assert(info.fastSearch()); AttributeVector::SP ret; switch(info.basicType().type()) { - case BasicType::UINT1: + case BasicType::BOOL: case BasicType::UINT2: case BasicType::UINT4: break; diff --git a/searchlib/src/vespa/searchlib/attribute/createsetstd.cpp b/searchlib/src/vespa/searchlib/attribute/createsetstd.cpp index 74e478c67b8..2c8636cb756 100644 --- a/searchlib/src/vespa/searchlib/attribute/createsetstd.cpp +++ b/searchlib/src/vespa/searchlib/attribute/createsetstd.cpp @@ -26,7 +26,7 @@ AttributeFactory::createSetStd(stringref name, const Config & info) assert(info.collectionType().type() == attribute::CollectionType::WSET); AttributeVector::SP ret; switch(info.basicType().type()) { - case BasicType::UINT1: + case BasicType::BOOL: case BasicType::UINT2: case BasicType::UINT4: break; diff --git a/searchlib/src/vespa/searchlib/attribute/createsinglefastsearch.cpp b/searchlib/src/vespa/searchlib/attribute/createsinglefastsearch.cpp index f3dd642828e..cdb7e1807ba 100644 --- a/searchlib/src/vespa/searchlib/attribute/createsinglefastsearch.cpp +++ b/searchlib/src/vespa/searchlib/attribute/createsinglefastsearch.cpp @@ -29,7 +29,7 @@ AttributeFactory::createSingleFastSearch(stringref name, const Config & info) assert(info.fastSearch()); AttributeVector::SP ret; switch(info.basicType().type()) { - case BasicType::UINT1: + case BasicType::BOOL: case BasicType::UINT2: case BasicType::UINT4: break; diff --git a/searchlib/src/vespa/searchlib/attribute/createsinglestd.cpp b/searchlib/src/vespa/searchlib/attribute/createsinglestd.cpp index cc3d9fe4b37..8ea41a9dab0 100644 --- a/searchlib/src/vespa/searchlib/attribute/createsinglestd.cpp +++ b/searchlib/src/vespa/searchlib/attribute/createsinglestd.cpp @@ -23,7 +23,7 @@ AttributeFactory::createSingleStd(stringref name, const Config & info) assert(info.collectionType().type() == attribute::CollectionType::SINGLE); AttributeVector::SP ret; switch(info.basicType().type()) { - case BasicType::UINT1: + case BasicType::BOOL: ret.reset(new SingleValueBitNumericAttribute(name, info.getGrowStrategy())); break; case BasicType::UINT2: diff --git a/searchlib/src/vespa/searchlib/attribute/integerbase.h b/searchlib/src/vespa/searchlib/attribute/integerbase.h index c3299d9fdf7..0ee2672f744 100644 --- a/searchlib/src/vespa/searchlib/attribute/integerbase.h +++ b/searchlib/src/vespa/searchlib/attribute/integerbase.h @@ -78,9 +78,7 @@ protected: { assert(c.basicType() == BasicType::fromType(T())); } - IntegerAttributeTemplate(const vespalib::string & name, - const Config & c, - const BasicType &realType) + IntegerAttributeTemplate(const vespalib::string & name, const Config & c, const BasicType &realType) : IntegerAttribute(name, c), _defaultValue(ChangeBase::UPDATE, 0, 0u) { diff --git a/searchlib/src/vespa/searchlib/attribute/ipostinglistsearchcontext.h b/searchlib/src/vespa/searchlib/attribute/ipostinglistsearchcontext.h index e779e41bb90..097cc35d8cb 100644 --- a/searchlib/src/vespa/searchlib/attribute/ipostinglistsearchcontext.h +++ b/searchlib/src/vespa/searchlib/attribute/ipostinglistsearchcontext.h @@ -4,12 +4,10 @@ #include <memory> -namespace search { +namespace search::queryeval { class SearchIterator; } +namespace search::fef { class TermFieldMatchData; } -namespace queryeval { class SearchIterator; } -namespace fef { class TermFieldMatchData; } - -namespace attribute { +namespace search::attribute { /** @@ -32,5 +30,4 @@ public: virtual unsigned int approximateHits() const = 0; }; -} // namespace attribute -} // namespace search +} diff --git a/searchlib/src/vespa/searchlib/attribute/primitivereader.h b/searchlib/src/vespa/searchlib/attribute/primitivereader.h index 97a29494623..cf8821526d0 100644 --- a/searchlib/src/vespa/searchlib/attribute/primitivereader.h +++ b/searchlib/src/vespa/searchlib/attribute/primitivereader.h @@ -19,6 +19,7 @@ namespace search { virtual ~PrimitiveReader() { } T getNextData() { return _datReader.readHostOrder(); } size_t getDataCount() const { return getDataCountHelper(sizeof(T)); } + FileReader<T> & getReader() { return _datReader; } private: FileReader<T> _datReader; }; diff --git a/searchlib/src/vespa/searchlib/attribute/singlesmallnumericattribute.cpp b/searchlib/src/vespa/searchlib/attribute/singlesmallnumericattribute.cpp index 5100e2e5546..2d6e1e57806 100644 --- a/searchlib/src/vespa/searchlib/attribute/singlesmallnumericattribute.cpp +++ b/searchlib/src/vespa/searchlib/attribute/singlesmallnumericattribute.cpp @@ -284,7 +284,7 @@ createConfig(BasicType bt, CollectionType ct, const GrowStrategy & grow) { SingleValueBitNumericAttribute:: SingleValueBitNumericAttribute(const vespalib::string &baseFileName, const GrowStrategy & grow) : SingleValueSmallNumericAttribute(baseFileName, - createConfig(BasicType::UINT1, CollectionType::SINGLE, grow), + createConfig(BasicType::BOOL, CollectionType::SINGLE, grow), 0x01u /* valueMask */, 0x00u /* valueShiftShift */, 8 * sizeof(Word) - 1 /* valueShiftMask */, @@ -308,7 +308,7 @@ SingleValueSemiNibbleNumericAttribute(const vespalib::string &baseFileName, cons SingleValueNibbleNumericAttribute:: SingleValueNibbleNumericAttribute(const vespalib::string &baseFileName, const search::GrowStrategy & grow) : SingleValueSmallNumericAttribute(baseFileName, - createConfig(BasicType::UINT1, CollectionType::SINGLE, grow), + createConfig(BasicType::BOOL, CollectionType::SINGLE, grow), 0x0fu /* valueMask */, 0x02u /* valueShiftShift */, 2 * sizeof(Word) - 1 /* valueShiftMask */, diff --git a/searchlib/src/vespa/searchlib/attribute/singlestringattribute.hpp b/searchlib/src/vespa/searchlib/attribute/singlestringattribute.hpp index 4f028e1a478..0842d91c174 100644 --- a/searchlib/src/vespa/searchlib/attribute/singlestringattribute.hpp +++ b/searchlib/src/vespa/searchlib/attribute/singlestringattribute.hpp @@ -25,7 +25,7 @@ SingleValueStringAttributeT(const vespalib::string &name, { } template <typename B> -SingleValueStringAttributeT<B>::~SingleValueStringAttributeT() { } +SingleValueStringAttributeT<B>::~SingleValueStringAttributeT() = default; template <typename B> void @@ -39,8 +39,7 @@ AttributeVector::SearchContext::UP SingleValueStringAttributeT<B>::getSearch(QueryTermSimpleUP qTerm, const attribute::SearchContextParams &) const { - return std::unique_ptr<AttributeVector::SearchContext> - (new StringTemplSearchContext(std::move(qTerm), *this)); + return std::make_unique<StringTemplSearchContext>(std::move(qTerm), *this); } template <typename B> diff --git a/searchlib/src/vespa/searchlib/common/growablebitvector.cpp b/searchlib/src/vespa/searchlib/common/growablebitvector.cpp index 41c99a41ce9..5062bb78e79 100644 --- a/searchlib/src/vespa/searchlib/common/growablebitvector.cpp +++ b/searchlib/src/vespa/searchlib/common/growablebitvector.cpp @@ -8,8 +8,7 @@ namespace search { using vespalib::GenerationHeldBase; using vespalib::GenerationHolder; -GrowableBitVector::GrowableBitVector(Index newSize, - Index newCapacity, +GrowableBitVector::GrowableBitVector(Index newSize, Index newCapacity, GenerationHolder &generationHolder) : AllocatedBitVector(newSize, newCapacity, nullptr, 0), _generationHolder(generationHolder) @@ -17,36 +16,39 @@ GrowableBitVector::GrowableBitVector(Index newSize, assert(newSize <= newCapacity); } -void +bool GrowableBitVector::reserve(Index newCapacity) { Index oldCapacity = capacity(); assert(newCapacity >= oldCapacity); if (newCapacity == oldCapacity) - return; - hold(grow(size(), newCapacity)); + return false; + return hold(grow(size(), newCapacity)); } -void GrowableBitVector::hold(GenerationHeldBase::UP v) +bool +GrowableBitVector::hold(GenerationHeldBase::UP v) { if (v) { _generationHolder.hold(std::move(v)); + return true; } + return false; } -void +bool GrowableBitVector::shrink(Index newCapacity) { Index oldCapacity = capacity(); assert(newCapacity <= oldCapacity); (void) oldCapacity; - hold(grow(newCapacity, std::max(capacity(), newCapacity))); + return hold(grow(newCapacity, std::max(capacity(), newCapacity))); } -void +bool GrowableBitVector::extend(Index newCapacity) { - hold(grow(newCapacity, std::max(capacity(), newCapacity))); + return hold(grow(newCapacity, std::max(capacity(), newCapacity))); } } // namespace search diff --git a/searchlib/src/vespa/searchlib/common/growablebitvector.h b/searchlib/src/vespa/searchlib/common/growablebitvector.h index 1c5cd31b235..ff5d878063d 100644 --- a/searchlib/src/vespa/searchlib/common/growablebitvector.h +++ b/searchlib/src/vespa/searchlib/common/growablebitvector.h @@ -2,22 +2,22 @@ #pragma once -#include <vespa/searchlib/common/allocatedbitvector.h> +#include "allocatedbitvector.h" namespace search { class GrowableBitVector : public AllocatedBitVector { public: - GrowableBitVector(Index newSize, - Index newCapacity, + GrowableBitVector(Index newSize, Index newCapacity, GenerationHolder &generationHolder); - void reserve(Index newCapacity); - void shrink(Index newCapacity); - void extend(Index newCapacity); + /** Will return true if a a buffer is held */ + bool reserve(Index newCapacity); + bool shrink(Index newCapacity); + bool extend(Index newCapacity); private: - VESPA_DLL_LOCAL void hold(GenerationHeldBase::UP v); + VESPA_DLL_LOCAL bool hold(GenerationHeldBase::UP v); GenerationHolder &_generationHolder; }; diff --git a/searchlib/src/vespa/searchlib/fef/parameterdescriptions.h b/searchlib/src/vespa/searchlib/fef/parameterdescriptions.h index 4c5d2c785cb..c91d85c1a83 100644 --- a/searchlib/src/vespa/searchlib/fef/parameterdescriptions.h +++ b/searchlib/src/vespa/searchlib/fef/parameterdescriptions.h @@ -53,7 +53,7 @@ private: return (1u << static_cast<unsigned int>(dataType)); } static uint32_t normalTypesMask() { - return (asMask(DataType::UINT1) | + return (asMask(DataType::BOOL) | asMask(DataType::UINT2) | asMask(DataType::UINT4) | asMask(DataType::INT8) | diff --git a/searchlib/src/vespa/searchlib/index/doctypebuilder.cpp b/searchlib/src/vespa/searchlib/index/doctypebuilder.cpp index 71b83cc005c..836d16825f5 100644 --- a/searchlib/src/vespa/searchlib/index/doctypebuilder.cpp +++ b/searchlib/src/vespa/searchlib/index/doctypebuilder.cpp @@ -5,15 +5,13 @@ #include <vespa/document/repo/configbuilder.h> using namespace document; -using namespace search::index; -namespace search { -namespace index { +namespace search::index { namespace { const DataType *convert(Schema::DataType type) { switch (type) { - case schema::DataType::UINT1: + case schema::DataType::BOOL: case schema::DataType::UINT2: case schema::DataType::UINT4: case schema::DataType::INT8: @@ -340,6 +338,4 @@ DocTypeBuilder::makeConfig(const DocumentType &docType) return cfg; } - -} // namespace search::index -} // namespace search +} diff --git a/searchsummary/src/vespa/searchsummary/docsummary/attributedfw.cpp b/searchsummary/src/vespa/searchsummary/docsummary/attributedfw.cpp index fccfe0e73c8..ee2e9d9fa92 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/attributedfw.cpp +++ b/searchsummary/src/vespa/searchsummary/docsummary/attributedfw.cpp @@ -181,7 +181,7 @@ MultiAttrDFW::insertField(uint32_t docid, } } return; } - case BasicType::UINT1: + case BasicType::BOOL: case BasicType::UINT2: case BasicType::UINT4: case BasicType::INT8: |