diff options
author | Lester Solbakken <lesters@yahoo-inc.com> | 2017-08-18 13:11:53 +0000 |
---|---|---|
committer | Lester Solbakken <lesters@yahoo-inc.com> | 2017-08-18 13:11:53 +0000 |
commit | 6ad61b77463f82c49e14653568498ba3b3d3c22b (patch) | |
tree | 081cea917a02b2081347debfe498179ac673e512 /searchlib | |
parent | 137199441aa224788995c7c5c2f273e9f5ee5b4d (diff) |
Make setup a bit more readable
Diffstat (limited to 'searchlib')
-rw-r--r-- | searchlib/src/vespa/searchlib/features/internal_max_reduce_prod_join_feature.cpp | 21 | ||||
-rw-r--r-- | searchlib/src/vespa/searchlib/fef/test/indexenvironmentbuilder.h | 8 |
2 files changed, 19 insertions, 10 deletions
diff --git a/searchlib/src/vespa/searchlib/features/internal_max_reduce_prod_join_feature.cpp b/searchlib/src/vespa/searchlib/features/internal_max_reduce_prod_join_feature.cpp index a5d72d399c8..d07654c0a21 100644 --- a/searchlib/src/vespa/searchlib/features/internal_max_reduce_prod_join_feature.cpp +++ b/searchlib/src/vespa/searchlib/features/internal_max_reduce_prod_join_feature.cpp @@ -133,20 +133,29 @@ InternalMaxReduceProdJoinBlueprint::getDescriptions() const return ParameterDescriptions().desc().attribute(ParameterCollection::ARRAY).string(); } -bool -InternalMaxReduceProdJoinBlueprint::setup(const IIndexEnvironment &env, const ParameterList ¶ms) -{ - const FieldInfo *attributeInfo = params[0].asField(); +bool supportedAttributeType(Parameter param) { + const FieldInfo *attributeInfo = param.asField(); if (attributeInfo == nullptr) { return false; } if (attributeInfo->collection() != FieldInfo::CollectionType::ARRAY) { return false; } - if (attributeInfo->get_data_type() != FieldInfo::DataType::INT32 && attributeInfo->get_data_type() != FieldInfo::DataType::INT64) { - return false; + if (attributeInfo->get_data_type() == FieldInfo::DataType::INT64) { + return true; + } + if (attributeInfo->get_data_type() == FieldInfo::DataType::INT32) { + return true; } + return false; +} +bool +InternalMaxReduceProdJoinBlueprint::setup(const IIndexEnvironment &env, const ParameterList ¶ms) +{ + if (!supportedAttributeType(params[0])) { + return false; + } _attribute = params[0].getValue(); _query = params[1].getValue(); describeOutput("scalar", "Internal executor for optimized execution of reduce(join(A,Q,f(x,y)(x*y)),max)"); diff --git a/searchlib/src/vespa/searchlib/fef/test/indexenvironmentbuilder.h b/searchlib/src/vespa/searchlib/fef/test/indexenvironmentbuilder.h index 5cc685af92b..e6a81a46008 100644 --- a/searchlib/src/vespa/searchlib/fef/test/indexenvironmentbuilder.h +++ b/searchlib/src/vespa/searchlib/fef/test/indexenvironmentbuilder.h @@ -33,10 +33,10 @@ public: /** * Add a field to the index environment with specified data type. * - * @param type The type of field to add. - * @param coll collection type - * @param coll collection base data type - * @param name The name of the field. + * @param type The type of field to add. + * @param coll Collection type + * @param dataType Collection base data type + * @param name The name of the field. */ IndexEnvironmentBuilder &addField(const FieldType &type, const FieldInfo::CollectionType &coll, |