diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2017-06-01 12:20:41 +0200 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2017-06-01 15:32:58 +0200 |
commit | f8ce3307a63b5c5d8ad8aaadfcce92e602b0cae7 (patch) | |
tree | 1fb8b8a5e10b55d97e23791d8e028a9e5cc19bdb | |
parent | 25829c28d04e811c46366eb57de584d042961619 (diff) |
Reduce fastos.h dependency.
169 files changed, 499 insertions, 958 deletions
diff --git a/searchlib/src/apps/expgolomb/expgolomb.cpp b/searchlib/src/apps/expgolomb/expgolomb.cpp index 2883a0ca392..81aa566305c 100644 --- a/searchlib/src/apps/expgolomb/expgolomb.cpp +++ b/searchlib/src/apps/expgolomb/expgolomb.cpp @@ -1,6 +1,6 @@ // 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/fastos/app.h> #include <vespa/searchlib/bitcompression/compression.h> #include <vector> diff --git a/searchlib/src/apps/uniform/uniform.cpp b/searchlib/src/apps/uniform/uniform.cpp index 782f072a7b0..8fb6b2af0ca 100644 --- a/searchlib/src/apps/uniform/uniform.cpp +++ b/searchlib/src/apps/uniform/uniform.cpp @@ -1,6 +1,6 @@ // 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/fastos/app.h> #include <vespa/searchlib/bitcompression/compression.h> diff --git a/searchlib/src/apps/vespa-index-inspect/vespa-index-inspect.cpp b/searchlib/src/apps/vespa-index-inspect/vespa-index-inspect.cpp index f5d2be65d6b..d0f7c8e1623 100644 --- a/searchlib/src/apps/vespa-index-inspect/vespa-index-inspect.cpp +++ b/searchlib/src/apps/vespa-index-inspect/vespa-index-inspect.cpp @@ -1,6 +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/searchlib/index/dictionaryfile.h> #include <vespa/searchlib/index/postinglistfile.h> #include <vespa/searchlib/bitcompression/compression.h> @@ -15,7 +14,9 @@ #include <vespa/searchlib/queryeval/searchiterator.h> #include <vespa/searchlib/fef/termfieldmatchdata.h> #include <vespa/searchlib/fef/termfieldmatchdataarray.h> +#include <vespa/fastos/app.h> #include <iostream> + #include <vespa/log/log.h> LOG_SETUP("vespa-index-inspect"); @@ -41,8 +42,7 @@ using search::index::schema::DataType; using search::queryeval::SearchIterator; using namespace search::index; -namespace -{ +namespace { /** * Fine granularity, for small scale inversion within a single document. diff --git a/searchlib/src/apps/vespa-ranking-expression-analyzer/vespa-ranking-expression-analyzer.cpp b/searchlib/src/apps/vespa-ranking-expression-analyzer/vespa-ranking-expression-analyzer.cpp index e97887c107e..ccfbf4c0e14 100644 --- a/searchlib/src/apps/vespa-ranking-expression-analyzer/vespa-ranking-expression-analyzer.cpp +++ b/searchlib/src/apps/vespa-ranking-expression-analyzer/vespa-ranking-expression-analyzer.cpp @@ -1,23 +1,17 @@ // 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 <map> #include <vespa/searchlib/features/rankingexpression/feature_name_extractor.h> -#include <vector> #include <vespa/eval/eval/llvm/compiled_function.h> -#include <vespa/eval/eval/function.h> #include <vespa/eval/eval/interpreted_function.h> -#include <vespa/eval/eval/basic_nodes.h> #include <vespa/eval/eval/call_nodes.h> #include <vespa/eval/eval/operator_nodes.h> #include <vespa/vespalib/util/benchmark_timer.h> -#include <vespa/eval/eval/gbdt.h> #include <vespa/eval/eval/vm_forest.h> #include <vespa/eval/eval/llvm/deinline_forest.h> #include <vespa/eval/tensor/default_tensor_engine.h> #include <vespa/vespalib/io/mapped_file_input.h> #include <vespa/eval/eval/param_usage.h> -#include <cmath> +#include <vespa/fastos/app.h> //----------------------------------------------------------------------------- diff --git a/searchlib/src/vespa/searchlib/features/constant_feature.cpp b/searchlib/src/vespa/searchlib/features/constant_feature.cpp index 54fc40b0019..fda0215dff0 100644 --- a/searchlib/src/vespa/searchlib/features/constant_feature.cpp +++ b/searchlib/src/vespa/searchlib/features/constant_feature.cpp @@ -1,14 +1,13 @@ // 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(".features.constant_feature"); #include "constant_feature.h" - -#include <vespa/searchlib/fef/featureexecutor.h> #include "valuefeature.h" +#include <vespa/searchlib/fef/featureexecutor.h> #include <vespa/eval/eval/value_cache/constant_value.h> +#include <vespa/log/log.h> +LOG_SETUP(".features.constant_feature"); + using namespace search::fef; namespace search { diff --git a/searchlib/src/vespa/searchlib/features/create-class-cpp.sh b/searchlib/src/vespa/searchlib/features/create-class-cpp.sh index 6ec335ffa3d..abc25ab99d4 100755 --- a/searchlib/src/vespa/searchlib/features/create-class-cpp.sh +++ b/searchlib/src/vespa/searchlib/features/create-class-cpp.sh @@ -6,15 +6,11 @@ guard=`echo $class | tr 'a-z' 'A-Z'` name=`echo $class | tr 'A-Z' 'a-z'` cat <<EOF -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright 2017 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/log/log.h> -LOG_SETUP(".$name"); -#include <vespa/fastos/fastos.h> #include "$name.h" -namespace search { -namespace features { +namespace search::features { $class::$class() { @@ -24,6 +20,5 @@ $class::~$class() { } -} // namespace features -} // namespace search +} EOF diff --git a/searchlib/src/vespa/searchlib/features/debug_attribute_wait.cpp b/searchlib/src/vespa/searchlib/features/debug_attribute_wait.cpp index 615fd06c987..19814760fc6 100644 --- a/searchlib/src/vespa/searchlib/features/debug_attribute_wait.cpp +++ b/searchlib/src/vespa/searchlib/features/debug_attribute_wait.cpp @@ -1,9 +1,7 @@ // 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(".features.debug_wait"); #include "debug_attribute_wait.h" +#include <thread> using search::attribute::IAttributeVector; @@ -58,7 +56,7 @@ DebugAttributeWaitExecutor::execute(uint32_t docId) ; } else { int rem = (int)(millis - time.MilliSecsToNow()); - FastOS_Thread::Sleep(rem); + std::this_thread::sleep_for(std::chrono::milliseconds(rem)); } } outputs().set_number(0, 1.0e-6 * time.MicroSecsToNow()); diff --git a/searchlib/src/vespa/searchlib/features/debug_wait.cpp b/searchlib/src/vespa/searchlib/features/debug_wait.cpp index 395a4c11d61..b9896b22946 100644 --- a/searchlib/src/vespa/searchlib/features/debug_wait.cpp +++ b/searchlib/src/vespa/searchlib/features/debug_wait.cpp @@ -1,9 +1,7 @@ // 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(".features.debug_wait"); #include "debug_wait.h" +#include <thread> namespace search { @@ -42,7 +40,7 @@ DebugWaitExecutor::execute(uint32_t) ; } else { int rem = (int)(millis - time.MilliSecsToNow()); - FastOS_Thread::Sleep(rem); + std::this_thread::sleep_for(std::chrono::milliseconds(rem)); } } outputs().set_number(0, 1.0e-6 * time.MicroSecsToNow()); diff --git a/searchlib/src/vespa/searchlib/features/dense_tensor_attribute_executor.cpp b/searchlib/src/vespa/searchlib/features/dense_tensor_attribute_executor.cpp index e7515727b23..30ca8af45bc 100644 --- a/searchlib/src/vespa/searchlib/features/dense_tensor_attribute_executor.cpp +++ b/searchlib/src/vespa/searchlib/features/dense_tensor_attribute_executor.cpp @@ -1,6 +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 "dense_tensor_attribute_executor.h" #include <vespa/searchlib/tensor/dense_tensor_attribute.h> diff --git a/searchlib/src/vespa/searchlib/features/distancefeature.cpp b/searchlib/src/vespa/searchlib/features/distancefeature.cpp index d38e19e93d2..50ad687adc1 100644 --- a/searchlib/src/vespa/searchlib/features/distancefeature.cpp +++ b/searchlib/src/vespa/searchlib/features/distancefeature.cpp @@ -1,15 +1,15 @@ // 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(".features.distancefeature"); -#include <cmath> -#include <limits> -#include <vespa/document/datatype/positiondatatype.h> +#include "distancefeature.h" #include <vespa/searchlib/fef/location.h> #include <vespa/searchlib/fef/matchdata.h> +#include <vespa/document/datatype/positiondatatype.h> #include <vespa/vespalib/geo/zcurve.h> -#include "distancefeature.h" +#include <cmath> +#include <limits> + +#include <vespa/log/log.h> +LOG_SETUP(".features.distancefeature"); using namespace search::fef; diff --git a/searchlib/src/vespa/searchlib/features/distancetopathfeature.cpp b/searchlib/src/vespa/searchlib/features/distancetopathfeature.cpp index da9db13f17c..91878fc948e 100644 --- a/searchlib/src/vespa/searchlib/features/distancetopathfeature.cpp +++ b/searchlib/src/vespa/searchlib/features/distancetopathfeature.cpp @@ -1,18 +1,18 @@ // 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(".features.distancetopathfeature"); +#include "distancetopathfeature.h" +#include "utils.h" +#include <vespa/searchlib/fef/matchdata.h> +#include <vespa/searchlib/fef/properties.h> +#include <vespa/document/datatype/positiondatatype.h> +#include <vespa/vespalib/geo/zcurve.h> #include <boost/algorithm/string/split.hpp> #include <boost/algorithm/string/classification.hpp> #include <cmath> -#include <vespa/document/datatype/positiondatatype.h> -#include <vespa/searchlib/fef/matchdata.h> -#include <vespa/searchlib/fef/properties.h> #include <sstream> -#include <vespa/vespalib/geo/zcurve.h> -#include "distancetopathfeature.h" -#include "utils.h" + +#include <vespa/log/log.h> +LOG_SETUP(".features.distancetopathfeature"); namespace search { namespace features { diff --git a/searchlib/src/vespa/searchlib/features/element_completeness_feature.cpp b/searchlib/src/vespa/searchlib/features/element_completeness_feature.cpp index 0874afcb080..71bb8731c7c 100644 --- a/searchlib/src/vespa/searchlib/features/element_completeness_feature.cpp +++ b/searchlib/src/vespa/searchlib/features/element_completeness_feature.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(".features.elementcompleteness"); #include "element_completeness_feature.h" namespace search { diff --git a/searchlib/src/vespa/searchlib/features/fieldinfofeature.cpp b/searchlib/src/vespa/searchlib/features/fieldinfofeature.cpp index 86bd40cb050..1f689ce8dd1 100644 --- a/searchlib/src/vespa/searchlib/features/fieldinfofeature.cpp +++ b/searchlib/src/vespa/searchlib/features/fieldinfofeature.cpp @@ -1,9 +1,8 @@ // 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(".features.fieldinfo"); - +#include "fieldinfofeature.h" +#include "valuefeature.h" +#include "utils.h" #include <vespa/searchlib/fef/properties.h> #include <vespa/searchlib/fef/fieldinfo.h> #include <vespa/searchlib/fef/fieldtype.h> @@ -11,9 +10,6 @@ LOG_SETUP(".features.fieldinfo"); #include <vespa/searchlib/fef/itermdata.h> #include <vespa/searchlib/fef/handle.h> #include <sstream> -#include "fieldinfofeature.h" -#include "valuefeature.h" -#include "utils.h" namespace search { namespace features { diff --git a/searchlib/src/vespa/searchlib/features/fieldlengthfeature.cpp b/searchlib/src/vespa/searchlib/features/fieldlengthfeature.cpp index 413c538ba85..26e11bbb5d3 100644 --- a/searchlib/src/vespa/searchlib/features/fieldlengthfeature.cpp +++ b/searchlib/src/vespa/searchlib/features/fieldlengthfeature.cpp @@ -1,16 +1,13 @@ // 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(".features.fieldlength"); +#include "fieldlengthfeature.h" +#include "valuefeature.h" +#include "utils.h" #include <vespa/searchlib/fef/itermdata.h> #include <vespa/searchlib/fef/featurenamebuilder.h> #include <vespa/searchlib/fef/fieldinfo.h> #include <vespa/searchlib/fef/fieldtype.h> #include <vespa/vespalib/util/stringfmt.h> -#include "fieldlengthfeature.h" -#include "valuefeature.h" -#include "utils.h" using namespace search::fef; diff --git a/searchlib/src/vespa/searchlib/features/fieldmatch/computer.cpp b/searchlib/src/vespa/searchlib/features/fieldmatch/computer.cpp index d613083233f..23847b11fd4 100644 --- a/searchlib/src/vespa/searchlib/features/fieldmatch/computer.cpp +++ b/searchlib/src/vespa/searchlib/features/fieldmatch/computer.cpp @@ -1,15 +1,15 @@ // 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(".features.fieldmatch.computer"); -#include <iostream> -#include <cstdlib> -#include <set> +#include "computer.h" #include <vespa/searchlib/features/utils.h> #include <vespa/searchlib/fef/properties.h> #include <vespa/vespalib/util/stringfmt.h> -#include "computer.h" +#include <iostream> +#include <cstdlib> +#include <set> + +#include <vespa/log/log.h> +LOG_SETUP(".features.fieldmatch.computer"); using namespace search::fef; diff --git a/searchlib/src/vespa/searchlib/features/fieldmatch/metrics.cpp b/searchlib/src/vespa/searchlib/features/fieldmatch/metrics.cpp index d89b447a794..1d7cfa59f17 100644 --- a/searchlib/src/vespa/searchlib/features/fieldmatch/metrics.cpp +++ b/searchlib/src/vespa/searchlib/features/fieldmatch/metrics.cpp @@ -1,15 +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(".features.fieldmatch.metrics"); +#include "metrics.h" +#include "computer.h" +#include <vespa/vespalib/util/stringfmt.h> #include <algorithm> #include <cstdlib> #include <cmath> #include <cstdlib> -#include <vespa/vespalib/util/stringfmt.h> -#include "computer.h" -#include "metrics.h" namespace search { namespace features { diff --git a/searchlib/src/vespa/searchlib/features/fieldmatch/metrics.h b/searchlib/src/vespa/searchlib/features/fieldmatch/metrics.h index 6b826f09e57..ed39fe39f95 100644 --- a/searchlib/src/vespa/searchlib/features/fieldmatch/metrics.h +++ b/searchlib/src/vespa/searchlib/features/fieldmatch/metrics.h @@ -1,8 +1,9 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include <vector> #include <vespa/searchlib/common/feature.h> +#include <vespa/vespalib/stllike/string.h> +#include <vector> namespace search { namespace features { diff --git a/searchlib/src/vespa/searchlib/features/fieldmatch/params.cpp b/searchlib/src/vespa/searchlib/features/fieldmatch/params.cpp index 34a23bb3642..9543cf8d174 100644 --- a/searchlib/src/vespa/searchlib/features/fieldmatch/params.cpp +++ b/searchlib/src/vespa/searchlib/features/fieldmatch/params.cpp @@ -1,10 +1,9 @@ // 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 "params.h" + #include <vespa/log/log.h> LOG_SETUP(".features.fieldmatch.params"); -#include "params.h" - namespace search { namespace features { namespace fieldmatch { diff --git a/searchlib/src/vespa/searchlib/features/fieldmatch/params.h b/searchlib/src/vespa/searchlib/features/fieldmatch/params.h index f3ff7558971..5496ce00ff7 100644 --- a/searchlib/src/vespa/searchlib/features/fieldmatch/params.h +++ b/searchlib/src/vespa/searchlib/features/fieldmatch/params.h @@ -1,8 +1,9 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include <vector> #include <vespa/searchlib/common/feature.h> +#include <vector> +#include <cstdint> namespace search { namespace features { diff --git a/searchlib/src/vespa/searchlib/features/fieldmatch/segmentstart.cpp b/searchlib/src/vespa/searchlib/features/fieldmatch/segmentstart.cpp index 93be549bc1f..ca6a92b9ed3 100644 --- a/searchlib/src/vespa/searchlib/features/fieldmatch/segmentstart.cpp +++ b/searchlib/src/vespa/searchlib/features/fieldmatch/segmentstart.cpp @@ -1,12 +1,9 @@ // 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(".features.fieldmatch.segmentstart"); -#include <vespa/vespalib/util/stringfmt.h> +#include "segmentstart.h" #include "computer.h" #include "metrics.h" -#include "segmentstart.h" +#include <vespa/vespalib/util/stringfmt.h> namespace search { namespace features { diff --git a/searchlib/src/vespa/searchlib/features/fieldmatch/simplemetrics.cpp b/searchlib/src/vespa/searchlib/features/fieldmatch/simplemetrics.cpp index 6a6e1935ad3..705fb3de45d 100644 --- a/searchlib/src/vespa/searchlib/features/fieldmatch/simplemetrics.cpp +++ b/searchlib/src/vespa/searchlib/features/fieldmatch/simplemetrics.cpp @@ -1,7 +1,4 @@ // 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(".features.fieldmatch.simplemetrics"); #include "simplemetrics.h" #include <vespa/vespalib/stllike/asciistream.h> diff --git a/searchlib/src/vespa/searchlib/features/fieldtermmatchfeature.cpp b/searchlib/src/vespa/searchlib/features/fieldtermmatchfeature.cpp index 6c0bf057c43..2342547c16b 100644 --- a/searchlib/src/vespa/searchlib/features/fieldtermmatchfeature.cpp +++ b/searchlib/src/vespa/searchlib/features/fieldtermmatchfeature.cpp @@ -1,16 +1,13 @@ // 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(".features.fieldtermmatchfeature"); +#include "fieldtermmatchfeature.h" +#include "utils.h" #include <vespa/searchlib/fef/featurenamebuilder.h> #include <vespa/searchlib/fef/fieldinfo.h> #include <vespa/searchlib/fef/fieldtype.h> #include <vespa/searchlib/fef/properties.h> #include <vespa/searchlib/fef/itermdata.h> #include <vespa/vespalib/util/stringfmt.h> -#include "fieldtermmatchfeature.h" -#include "utils.h" namespace search { namespace features { diff --git a/searchlib/src/vespa/searchlib/features/firstphasefeature.cpp b/searchlib/src/vespa/searchlib/features/firstphasefeature.cpp index daa20d06e5b..a56b0dd65bc 100644 --- a/searchlib/src/vespa/searchlib/features/firstphasefeature.cpp +++ b/searchlib/src/vespa/searchlib/features/firstphasefeature.cpp @@ -1,10 +1,6 @@ // 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(".features.firstphasefeature"); #include "firstphasefeature.h" - #include <vespa/searchlib/fef/featureexecutor.h> #include <vespa/searchlib/fef/indexproperties.h> #include <vespa/searchlib/fef/properties.h> diff --git a/searchlib/src/vespa/searchlib/features/freshnessfeature.cpp b/searchlib/src/vespa/searchlib/features/freshnessfeature.cpp index d6955118ccb..afacee26b26 100644 --- a/searchlib/src/vespa/searchlib/features/freshnessfeature.cpp +++ b/searchlib/src/vespa/searchlib/features/freshnessfeature.cpp @@ -1,11 +1,11 @@ // 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(".features.freshnessfeature"); -#include <vespa/searchlib/fef/properties.h> #include "freshnessfeature.h" #include "utils.h" +#include <vespa/searchlib/fef/properties.h> + +#include <vespa/log/log.h> +LOG_SETUP(".features.freshnessfeature"); using namespace search::fef; diff --git a/searchlib/src/vespa/searchlib/features/item_raw_score_feature.cpp b/searchlib/src/vespa/searchlib/features/item_raw_score_feature.cpp index 14b517a10ca..5088dfdffbd 100644 --- a/searchlib/src/vespa/searchlib/features/item_raw_score_feature.cpp +++ b/searchlib/src/vespa/searchlib/features/item_raw_score_feature.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(".features.item_raw_score_feature"); #include "item_raw_score_feature.h" #include "valuefeature.h" #include "utils.h" diff --git a/searchlib/src/vespa/searchlib/features/jarowinklerdistancefeature.cpp b/searchlib/src/vespa/searchlib/features/jarowinklerdistancefeature.cpp index 0c933261920..357a5e0b106 100644 --- a/searchlib/src/vespa/searchlib/features/jarowinklerdistancefeature.cpp +++ b/searchlib/src/vespa/searchlib/features/jarowinklerdistancefeature.cpp @@ -1,17 +1,14 @@ // 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(".features.jarowinklerdistance"); +#include "jarowinklerdistancefeature.h" +#include "utils.h" +#include <limits> #include <vespa/searchlib/fef/featurenamebuilder.h> #include <vespa/searchlib/fef/fieldinfo.h> #include <vespa/searchlib/fef/fieldtype.h> #include <vespa/searchlib/fef/properties.h> #include <vespa/searchlib/fef/itermdata.h> #include <vespa/vespalib/util/stringfmt.h> -#include "jarowinklerdistancefeature.h" -#include "utils.h" -#include <limits> namespace search { namespace features { @@ -131,12 +128,9 @@ feature_t JaroWinklerDistanceExecutor::jaroWinklerProximity(const std::vector<search::fef::FieldPositionsIterator> &termPos, uint32_t fieldLen) { feature_t ret = std::min(1.0, std::max(0.0, jaroMeasure(termPos, fieldLen))); - //LOG(debug, "Jaro measure is %f.", ret); if (ret > _config.boostThreshold) { ret += 0.1f * prefixMatch(termPos, fieldLen, _config.prefixSize) * (1 - ret); // less boost close to 1 - //LOG(debug, "Applying Winkler boost."); } - //LOG(debug, "JaroWinkler measure is %f.", ret); return ret; } diff --git a/searchlib/src/vespa/searchlib/features/matchesfeature.cpp b/searchlib/src/vespa/searchlib/features/matchesfeature.cpp index e62b1a91785..ee8ec3eeca9 100644 --- a/searchlib/src/vespa/searchlib/features/matchesfeature.cpp +++ b/searchlib/src/vespa/searchlib/features/matchesfeature.cpp @@ -1,12 +1,9 @@ // 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(".features.matchesfeature"); -#include <vespa/searchlib/fef/fieldinfo.h> #include "matchesfeature.h" #include "utils.h" #include "valuefeature.h" +#include <vespa/searchlib/fef/fieldinfo.h> using namespace search::fef; diff --git a/searchlib/src/vespa/searchlib/features/matchfeature.cpp b/searchlib/src/vespa/searchlib/features/matchfeature.cpp index 780c52e9508..5c8feedc9bb 100644 --- a/searchlib/src/vespa/searchlib/features/matchfeature.cpp +++ b/searchlib/src/vespa/searchlib/features/matchfeature.cpp @@ -1,16 +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(".features.matchfeature"); #include "matchfeature.h" - +#include "utils.h" #include <vespa/searchlib/fef/featurenamebuilder.h> #include <vespa/searchlib/fef/fieldinfo.h> #include <vespa/searchlib/fef/indexproperties.h> #include <vespa/searchlib/fef/properties.h> #include <vespa/vespalib/util/stringfmt.h> -#include "utils.h" using namespace search::fef; using CollectionType = FieldInfo::CollectionType; diff --git a/searchlib/src/vespa/searchlib/features/native_dot_product_feature.cpp b/searchlib/src/vespa/searchlib/features/native_dot_product_feature.cpp index 9e2384b08c8..3b717e43397 100644 --- a/searchlib/src/vespa/searchlib/features/native_dot_product_feature.cpp +++ b/searchlib/src/vespa/searchlib/features/native_dot_product_feature.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(".features.native_dot_product_feature"); #include "native_dot_product_feature.h" #include "utils.h" diff --git a/searchlib/src/vespa/searchlib/features/nativeattributematchfeature.cpp b/searchlib/src/vespa/searchlib/features/nativeattributematchfeature.cpp index 6d92e8694bf..b10e2e70ff0 100644 --- a/searchlib/src/vespa/searchlib/features/nativeattributematchfeature.cpp +++ b/searchlib/src/vespa/searchlib/features/nativeattributematchfeature.cpp @@ -1,15 +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> +#include "valuefeature.h" +#include "nativeattributematchfeature.h" +#include "utils.h" #include <vespa/searchlib/fef/fieldinfo.h> #include <vespa/searchlib/fef/indexproperties.h> #include <vespa/searchlib/fef/itablemanager.h> #include <vespa/searchlib/fef/properties.h> -#include "valuefeature.h" -#include "nativeattributematchfeature.h" -#include "utils.h" -LOG_SETUP(".features.nativeattributematchfeature"); using namespace search::fef; diff --git a/searchlib/src/vespa/searchlib/features/nativefieldmatchfeature.cpp b/searchlib/src/vespa/searchlib/features/nativefieldmatchfeature.cpp index 3a333211e1a..edfc5435fc2 100644 --- a/searchlib/src/vespa/searchlib/features/nativefieldmatchfeature.cpp +++ b/searchlib/src/vespa/searchlib/features/nativefieldmatchfeature.cpp @@ -1,15 +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(".features.nativefieldmatchfeature"); +#include "nativefieldmatchfeature.h" +#include "valuefeature.h" +#include "utils.h" #include <vespa/searchlib/fef/fieldinfo.h> #include <vespa/searchlib/fef/indexproperties.h> #include <vespa/searchlib/fef/itablemanager.h> #include <vespa/searchlib/fef/properties.h> -#include "nativefieldmatchfeature.h" -#include "valuefeature.h" -#include "utils.h" using namespace search::fef; diff --git a/searchlib/src/vespa/searchlib/features/nativeproximityfeature.cpp b/searchlib/src/vespa/searchlib/features/nativeproximityfeature.cpp index ddd4dcec47e..aeb9f0c8f01 100644 --- a/searchlib/src/vespa/searchlib/features/nativeproximityfeature.cpp +++ b/searchlib/src/vespa/searchlib/features/nativeproximityfeature.cpp @@ -1,15 +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(".features.nativeproximityfeature"); +#include "nativeproximityfeature.h" +#include "valuefeature.h" +#include "utils.h" #include <vespa/searchlib/fef/fieldinfo.h> #include <vespa/searchlib/fef/indexproperties.h> #include <vespa/searchlib/fef/itablemanager.h> #include <vespa/searchlib/fef/properties.h> -#include "nativeproximityfeature.h" -#include "valuefeature.h" -#include "utils.h" #include <map> using namespace search::fef; @@ -47,10 +44,6 @@ NativeProximityExecutor::calculateScoreForPair(const TermPair & pair, uint32_t f (a.significance() * a.termData()->getWeight().percent() + b.significance() * b.termData()->getWeight().percent()); feature_t score = (forwardScore + reverseScore) * termPairWeight / param.maxTableSum; - //LOG(debug, "calculateScoreForPair: pair(%u,%u), fieldId(%u), forwardScore(%f), reverseScore(%f), " - //"termPairWeight(%f), maxTableSum(%f), score(%f)", - //fieldId, a.termData()->getUniqueId(), b.termData()->getUniqueId(), forwardScore, reverseScore, - //termPairWeight, _params.maxTableSums[fieldId], score); return score; } diff --git a/searchlib/src/vespa/searchlib/features/nativerankfeature.cpp b/searchlib/src/vespa/searchlib/features/nativerankfeature.cpp index ee812f2173e..92d00e9f907 100644 --- a/searchlib/src/vespa/searchlib/features/nativerankfeature.cpp +++ b/searchlib/src/vespa/searchlib/features/nativerankfeature.cpp @@ -1,13 +1,13 @@ // 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(".features.nativerankfeature"); -#include <vespa/searchlib/fef/fieldinfo.h> -#include <vespa/searchlib/fef/properties.h> #include "nativerankfeature.h" #include "valuefeature.h" #include "utils.h" +#include <vespa/searchlib/fef/fieldinfo.h> +#include <vespa/searchlib/fef/properties.h> + +#include <vespa/log/log.h> +LOG_SETUP(".features.nativerankfeature"); using namespace search::fef; diff --git a/searchlib/src/vespa/searchlib/features/nowfeature.cpp b/searchlib/src/vespa/searchlib/features/nowfeature.cpp index cc6614d8c06..5fcddcebd1e 100644 --- a/searchlib/src/vespa/searchlib/features/nowfeature.cpp +++ b/searchlib/src/vespa/searchlib/features/nowfeature.cpp @@ -1,13 +1,10 @@ // 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(".features.nowfeature"); +#include "nowfeature.h" #include <vespa/searchlib/fef/featurenamebuilder.h> #include <vespa/searchlib/fef/queryproperties.h> #include <vespa/searchlib/fef/properties.h> -#include "nowfeature.h" -#include "valuefeature.h" +#include <vespa/fastos/time.h> namespace search { namespace features { @@ -16,7 +13,6 @@ NowExecutor::NowExecutor(int64_t timestamp) : search::fef::FeatureExecutor(), _timestamp(timestamp) { - // empty } void diff --git a/searchlib/src/vespa/searchlib/features/proximityfeature.cpp b/searchlib/src/vespa/searchlib/features/proximityfeature.cpp index b8a69c38b32..62f57efbc2d 100644 --- a/searchlib/src/vespa/searchlib/features/proximityfeature.cpp +++ b/searchlib/src/vespa/searchlib/features/proximityfeature.cpp @@ -1,14 +1,11 @@ // 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(".features.proximity"); +#include "proximityfeature.h" +#include "utils.h" #include <vespa/searchlib/fef/featurenamebuilder.h> #include <vespa/searchlib/fef/fieldinfo.h> #include <vespa/searchlib/fef/itermdata.h> #include <vespa/vespalib/util/stringfmt.h> -#include "proximityfeature.h" -#include "utils.h" namespace search { namespace features { diff --git a/searchlib/src/vespa/searchlib/features/querycompletenessfeature.cpp b/searchlib/src/vespa/searchlib/features/querycompletenessfeature.cpp index f6db8a34534..ab876509e0f 100644 --- a/searchlib/src/vespa/searchlib/features/querycompletenessfeature.cpp +++ b/searchlib/src/vespa/searchlib/features/querycompletenessfeature.cpp @@ -1,15 +1,15 @@ // 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(".features.querycompleteness"); +#include "querycompletenessfeature.h" +#include "utils.h" #include <vespa/searchlib/fef/featurenamebuilder.h> #include <vespa/searchlib/fef/fieldinfo.h> #include <vespa/searchlib/fef/itermdata.h> -#include "querycompletenessfeature.h" -#include "utils.h" #include <limits> +#include <vespa/log/log.h> +LOG_SETUP(".features.querycompleteness"); + namespace search { namespace features { diff --git a/searchlib/src/vespa/searchlib/features/queryfeature.cpp b/searchlib/src/vespa/searchlib/features/queryfeature.cpp index 4cb1af346cf..d61e2928165 100644 --- a/searchlib/src/vespa/searchlib/features/queryfeature.cpp +++ b/searchlib/src/vespa/searchlib/features/queryfeature.cpp @@ -1,23 +1,20 @@ // 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(".features.queryfeature"); #include "queryfeature.h" +#include "utils.h" +#include "valuefeature.h" #include <vespa/searchlib/features/constant_tensor_executor.h> #include <vespa/searchlib/fef/featureexecutor.h> #include <vespa/searchlib/fef/indexproperties.h> #include <vespa/searchlib/fef/properties.h> +#include <vespa/searchlib/fef/feature_type.h> #include <vespa/vespalib/objects/nbostream.h> #include <vespa/eval/tensor/default_tensor.h> #include <vespa/eval/tensor/tensor_mapper.h> #include <vespa/eval/tensor/serialization/typed_binary_format.h> -#include <memory> -#include "utils.h" -#include "valuefeature.h" #include <vespa/eval/eval/value_type.h> -#include <vespa/searchlib/fef/feature_type.h> +#include <memory> using namespace search::fef; using namespace search::fef::indexproperties; diff --git a/searchlib/src/vespa/searchlib/features/queryterm.cpp b/searchlib/src/vespa/searchlib/features/queryterm.cpp index f8c659be359..1ac25428a4c 100644 --- a/searchlib/src/vespa/searchlib/features/queryterm.cpp +++ b/searchlib/src/vespa/searchlib/features/queryterm.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(".features.queryterm"); #include "queryterm.h" #include "utils.h" diff --git a/searchlib/src/vespa/searchlib/features/querytermcountfeature.cpp b/searchlib/src/vespa/searchlib/features/querytermcountfeature.cpp index 50cd4881817..2c5fa6e3032 100644 --- a/searchlib/src/vespa/searchlib/features/querytermcountfeature.cpp +++ b/searchlib/src/vespa/searchlib/features/querytermcountfeature.cpp @@ -1,17 +1,13 @@ // 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(".features.querytermcountfeature"); - +#include "querytermcountfeature.h" +#include "valuefeature.h" #include <vespa/searchlib/fef/properties.h> #include <vespa/searchlib/fef/fieldinfo.h> #include <vespa/searchlib/fef/fieldtype.h> #include <vespa/searchlib/fef/featurenamebuilder.h> #include <vespa/searchlib/fef/itermdata.h> #include <vespa/searchlib/fef/handle.h> -#include "querytermcountfeature.h" -#include "valuefeature.h" using namespace search::fef; diff --git a/searchlib/src/vespa/searchlib/features/random_normal_feature.cpp b/searchlib/src/vespa/searchlib/features/random_normal_feature.cpp index b27bad7b98f..127dd0feecf 100644 --- a/searchlib/src/vespa/searchlib/features/random_normal_feature.cpp +++ b/searchlib/src/vespa/searchlib/features/random_normal_feature.cpp @@ -1,12 +1,13 @@ // Copyright 2017 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> -#include <cmath> -LOG_SETUP(".features.randomnormalfeature"); -#include <vespa/searchlib/fef/properties.h> #include "random_normal_feature.h" #include "utils.h" +#include <vespa/searchlib/fef/properties.h> +#include <vespa/fastos/time.h> +#include <cmath> + +#include <vespa/log/log.h> +LOG_SETUP(".features.randomnormalfeature"); namespace search { namespace features { @@ -20,8 +21,7 @@ RandomNormalExecutor::RandomNormalExecutor(uint64_t seed, double mean, double st _spare(0.0) { - LOG(debug, "RandomNormalExecutor: seed=%" PRIu64 ", mean=%f, stddev=%f", - seed, mean, stddev); + LOG(debug, "RandomNormalExecutor: seed=%" PRIu64 ", mean=%f, stddev=%f", seed, mean, stddev); _rnd.srand48(seed); } diff --git a/searchlib/src/vespa/searchlib/features/randomfeature.cpp b/searchlib/src/vespa/searchlib/features/randomfeature.cpp index 16fb4a99edb..19da7a19895 100644 --- a/searchlib/src/vespa/searchlib/features/randomfeature.cpp +++ b/searchlib/src/vespa/searchlib/features/randomfeature.cpp @@ -1,11 +1,13 @@ // 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(".features.randomfeature"); #include "randomfeature.h" #include "utils.h" #include <vespa/searchlib/fef/properties.h> +#include <vespa/vespalib/util/stringfmt.h> +#include <vespa/fastos/time.h> + +#include <vespa/log/log.h> +LOG_SETUP(".features.randomfeature"); namespace search { namespace features { @@ -16,8 +18,7 @@ RandomExecutor::RandomExecutor(uint64_t seed, uint64_t matchSeed) : _matchRnd(), _matchSeed(matchSeed) { - LOG(debug, "RandomExecutor: seed=%" PRIu64 ", matchSeed=%" PRIu64, - seed, matchSeed); + LOG(debug, "RandomExecutor: seed=%" PRIu64 ", matchSeed=%" PRIu64, seed, matchSeed); _rnd.srand48(seed); } @@ -27,7 +28,6 @@ RandomExecutor::execute(uint32_t docId) feature_t rndScore = _rnd.lrand48() / (feature_t)0x80000000u; // 2^31 _matchRnd.srand48(_matchSeed + docId); feature_t matchRndScore = _matchRnd.lrand48() / (feature_t)0x80000000u; // 2^31 - //LOG(debug, "execute: %f", rndScore); outputs().set_number(0, rndScore); outputs().set_number(1, matchRndScore); } @@ -37,14 +37,12 @@ RandomBlueprint::RandomBlueprint() : search::fef::Blueprint("random"), _seed(0) { - // empty } void RandomBlueprint::visitDumpFeatures(const search::fef::IIndexEnvironment &, search::fef::IDumpFeatureVisitor &) const { - // empty } search::fef::Blueprint::UP diff --git a/searchlib/src/vespa/searchlib/features/rankingexpression/feature_name_extractor.cpp b/searchlib/src/vespa/searchlib/features/rankingexpression/feature_name_extractor.cpp index 4dc5124df67..3c453ee221c 100644 --- a/searchlib/src/vespa/searchlib/features/rankingexpression/feature_name_extractor.cpp +++ b/searchlib/src/vespa/searchlib/features/rankingexpression/feature_name_extractor.cpp @@ -1,6 +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 "feature_name_extractor.h" namespace search { diff --git a/searchlib/src/vespa/searchlib/features/raw_score_feature.cpp b/searchlib/src/vespa/searchlib/features/raw_score_feature.cpp index efee81ffd6c..0bed17a52e5 100644 --- a/searchlib/src/vespa/searchlib/features/raw_score_feature.cpp +++ b/searchlib/src/vespa/searchlib/features/raw_score_feature.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(".features.raw_score_feature"); #include "raw_score_feature.h" #include "utils.h" diff --git a/searchlib/src/vespa/searchlib/features/reverseproximityfeature.cpp b/searchlib/src/vespa/searchlib/features/reverseproximityfeature.cpp index aba27c891ed..e185faff7ae 100644 --- a/searchlib/src/vespa/searchlib/features/reverseproximityfeature.cpp +++ b/searchlib/src/vespa/searchlib/features/reverseproximityfeature.cpp @@ -1,15 +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(".features.reverseproximity"); +#include "reverseproximityfeature.h" +#include "utils.h" #include <vespa/searchlib/fef/featurenamebuilder.h> #include <vespa/searchlib/fef/fieldinfo.h> #include <vespa/searchlib/fef/fieldtype.h> #include <vespa/searchlib/fef/itermdata.h> #include <vespa/vespalib/util/stringfmt.h> -#include "reverseproximityfeature.h" -#include "utils.h" namespace search { namespace features { @@ -59,11 +56,9 @@ ReverseProximityExecutor::execute(uint32_t docId) } } } - //LOG(debug, "Initial guess; posA is '%u' and posB is '%u'.", posA, posB); // _P_A_R_A_N_O_I_A_ if (!itA.valid() || !itB.valid()) { - //LOG(debug, "Initial guess is invalid."); outputs().set_number(0, util::FEATURE_MAX); // out outputs().set_number(1, util::FEATURE_MIN); // posA outputs().set_number(2, util::FEATURE_MAX); // posB diff --git a/searchlib/src/vespa/searchlib/features/setup.cpp b/searchlib/src/vespa/searchlib/features/setup.cpp index e3dbda6a941..7ddf712d6c7 100644 --- a/searchlib/src/vespa/searchlib/features/setup.cpp +++ b/searchlib/src/vespa/searchlib/features/setup.cpp @@ -1,5 +1,4 @@ // 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 "setup.h" #include "agefeature.h" diff --git a/searchlib/src/vespa/searchlib/features/subqueries_feature.cpp b/searchlib/src/vespa/searchlib/features/subqueries_feature.cpp index 3fddc81268b..8f88b6a03da 100644 --- a/searchlib/src/vespa/searchlib/features/subqueries_feature.cpp +++ b/searchlib/src/vespa/searchlib/features/subqueries_feature.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(".features.subqueries_feature"); #include "subqueries_feature.h" #include "utils.h" diff --git a/searchlib/src/vespa/searchlib/features/tensor_attribute_executor.cpp b/searchlib/src/vespa/searchlib/features/tensor_attribute_executor.cpp index b1eee1bc7ad..4eae5b8f950 100644 --- a/searchlib/src/vespa/searchlib/features/tensor_attribute_executor.cpp +++ b/searchlib/src/vespa/searchlib/features/tensor_attribute_executor.cpp @@ -1,6 +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 "tensor_attribute_executor.h" #include <vespa/searchlib/tensor/tensor_attribute.h> diff --git a/searchlib/src/vespa/searchlib/features/tensor_from_labels_feature.cpp b/searchlib/src/vespa/searchlib/features/tensor_from_labels_feature.cpp index bd8b4122df6..330275cb9cd 100644 --- a/searchlib/src/vespa/searchlib/features/tensor_from_labels_feature.cpp +++ b/searchlib/src/vespa/searchlib/features/tensor_from_labels_feature.cpp @@ -1,19 +1,18 @@ // 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(".features.tensor_from_labels_feature"); - #include "tensor_from_labels_feature.h" #include "array_parser.hpp" #include "constant_tensor_executor.h" #include "tensor_from_attribute_executor.h" +#include <vespa/searchlib/fef/properties.h> +#include <vespa/searchlib/fef/feature_type.h> #include <vespa/searchcommon/attribute/attributecontent.h> #include <vespa/searchcommon/attribute/iattributevector.h> -#include <vespa/searchlib/fef/properties.h> #include <vespa/eval/tensor/default_tensor.h> #include <vespa/eval/eval/value_type.h> -#include <vespa/searchlib/fef/feature_type.h> + +#include <vespa/log/log.h> +LOG_SETUP(".features.tensor_from_labels_feature"); using namespace search::fef; using search::attribute::IAttributeVector; diff --git a/searchlib/src/vespa/searchlib/features/tensor_from_weighted_set_feature.cpp b/searchlib/src/vespa/searchlib/features/tensor_from_weighted_set_feature.cpp index 7430fe69cab..5dfb8ce8cdc 100644 --- a/searchlib/src/vespa/searchlib/features/tensor_from_weighted_set_feature.cpp +++ b/searchlib/src/vespa/searchlib/features/tensor_from_weighted_set_feature.cpp @@ -1,9 +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(".features.tensor_from_weighted_set_feature"); - #include "tensor_from_weighted_set_feature.h" #include "constant_tensor_executor.h" @@ -11,15 +7,17 @@ LOG_SETUP(".features.tensor_from_weighted_set_feature"); #include "tensor_from_attribute_executor.h" #include "weighted_set_parser.hpp" +#include <vespa/searchlib/fef/properties.h> +#include <vespa/searchlib/fef/feature_type.h> #include <vespa/searchcommon/attribute/attributecontent.h> #include <vespa/searchcommon/attribute/iattributevector.h> -#include <vespa/searchlib/fef/properties.h> #include <vespa/eval/eval/function.h> #include <vespa/eval/tensor/tensor.h> #include <vespa/eval/tensor/default_tensor.h> -#include <memory> #include <vespa/eval/eval/value_type.h> -#include <vespa/searchlib/fef/feature_type.h> + +#include <vespa/log/log.h> +LOG_SETUP(".features.tensor_from_weighted_set_feature"); using namespace search::fef; using search::attribute::IAttributeVector; diff --git a/searchlib/src/vespa/searchlib/features/term_field_md_feature.cpp b/searchlib/src/vespa/searchlib/features/term_field_md_feature.cpp index a51c16ae797..70c1276abf0 100644 --- a/searchlib/src/vespa/searchlib/features/term_field_md_feature.cpp +++ b/searchlib/src/vespa/searchlib/features/term_field_md_feature.cpp @@ -1,14 +1,11 @@ // 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> +#include "term_field_md_feature.h" +#include "utils.h" #include <vespa/searchlib/fef/fieldinfo.h> #include <vespa/searchlib/fef/indexproperties.h> #include <vespa/searchlib/fef/itablemanager.h> #include <vespa/searchlib/fef/properties.h> -#include "term_field_md_feature.h" -#include "utils.h" -LOG_SETUP(".features.term_field_md_feature"); using namespace search::fef; @@ -23,10 +20,10 @@ TermFieldMdExecutor::TermFieldMdExecutor(const search::fef::IQueryEnvironment &e { for (uint32_t i = 0; i < env.getNumTerms(); ++i) { const search::fef::ITermData *td = env.getTerm(i); - LOG_ASSERT(td != 0); + assert(td != 0); const search::fef::ITermFieldData *tfd = td->lookupField(fieldId); if (tfd != 0) { - LOG_ASSERT(tfd->getHandle() != search::fef::IllegalHandle); + assert(tfd->getHandle() != search::fef::IllegalHandle); _terms.push_back(std::make_pair(tfd->getHandle(), td->getWeight())); } } @@ -96,7 +93,7 @@ TermFieldMdBlueprint::setup(const IIndexEnvironment & env, const ParameterList & params) { _field = params[0].asField(); - LOG_ASSERT(_field != 0); + assert(_field != 0); describeOutput("score", "The term field match score"); describeOutput("terms", "The number of ranked terms searching this field"); diff --git a/searchlib/src/vespa/searchlib/features/termdistancecalculator.cpp b/searchlib/src/vespa/searchlib/features/termdistancecalculator.cpp index ef8d1005a17..9689dd3efca 100644 --- a/searchlib/src/vespa/searchlib/features/termdistancecalculator.cpp +++ b/searchlib/src/vespa/searchlib/features/termdistancecalculator.cpp @@ -1,11 +1,8 @@ // 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(".features.termdistancecalculator"); +#include "termdistancecalculator.h" #include <vespa/searchlib/fef/matchdata.h> #include <vespa/searchlib/fef/itermdata.h> -#include "termdistancecalculator.h" using namespace search::fef; diff --git a/searchlib/src/vespa/searchlib/features/termdistancecalculator.h b/searchlib/src/vespa/searchlib/features/termdistancecalculator.h index ae22d6fe38d..94675d591dc 100644 --- a/searchlib/src/vespa/searchlib/features/termdistancecalculator.h +++ b/searchlib/src/vespa/searchlib/features/termdistancecalculator.h @@ -5,6 +5,12 @@ #include "queryterm.h" namespace search { + +namespace fef { + class TermFieldMatchData; + class MatchData; +} + namespace features { /** @@ -60,8 +66,8 @@ public: }; private: - static void findBest(const search::fef::TermFieldMatchData *tmdX, - const search::fef::TermFieldMatchData *tmdY, + static void findBest(const fef::TermFieldMatchData *tmdX, + const fef::TermFieldMatchData *tmdY, uint32_t numTermsX, uint32_t & bestDist, uint32_t & bestPos); @@ -73,9 +79,8 @@ public: * NB: Both query terms must have attached term fields with valid term field handles. **/ static void run(const QueryTerm &termX, const QueryTerm &termY, - const search::fef::MatchData & match, uint32_t docId, Result & r); + const fef::MatchData & match, uint32_t docId, Result & r); }; } // namespace features } // namespace search - diff --git a/searchlib/src/vespa/searchlib/features/termdistancefeature.cpp b/searchlib/src/vespa/searchlib/features/termdistancefeature.cpp index fd7bef0f201..8a512c48bd9 100644 --- a/searchlib/src/vespa/searchlib/features/termdistancefeature.cpp +++ b/searchlib/src/vespa/searchlib/features/termdistancefeature.cpp @@ -1,13 +1,10 @@ // 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(".features.nativeproximityfeature"); -#include <vespa/searchlib/fef/fieldinfo.h> -#include <vespa/searchlib/fef/properties.h> #include "termdistancefeature.h" #include "valuefeature.h" #include "utils.h" +#include <vespa/searchlib/fef/fieldinfo.h> +#include <vespa/searchlib/fef/properties.h> using namespace search::fef; diff --git a/searchlib/src/vespa/searchlib/features/termeditdistancefeature.cpp b/searchlib/src/vespa/searchlib/features/termeditdistancefeature.cpp index da730ccc996..a414c217d7b 100644 --- a/searchlib/src/vespa/searchlib/features/termeditdistancefeature.cpp +++ b/searchlib/src/vespa/searchlib/features/termeditdistancefeature.cpp @@ -1,16 +1,16 @@ // 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(".features.termeditdistance"); +#include "termeditdistancefeature.h" +#include "utils.h" #include <vespa/searchlib/fef/featurenamebuilder.h> #include <vespa/searchlib/fef/fieldinfo.h> #include <vespa/searchlib/fef/fieldtype.h> #include <vespa/searchlib/fef/properties.h> #include <vespa/searchlib/fef/itermdata.h> #include <vespa/vespalib/util/stringfmt.h> -#include "termeditdistancefeature.h" -#include "utils.h" + +#include <vespa/log/log.h> +LOG_SETUP(".features.termeditdistance"); namespace search { namespace features { diff --git a/searchlib/src/vespa/searchlib/features/termfeature.cpp b/searchlib/src/vespa/searchlib/features/termfeature.cpp index a7ffb9a7bee..a47f8e47553 100644 --- a/searchlib/src/vespa/searchlib/features/termfeature.cpp +++ b/searchlib/src/vespa/searchlib/features/termfeature.cpp @@ -1,16 +1,13 @@ // 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(".features.termfeature"); +#include "termfeature.h" +#include "utils.h" #include <vespa/searchlib/fef/featurenamebuilder.h> #include <vespa/searchlib/fef/fieldinfo.h> #include <vespa/searchlib/fef/fieldtype.h> #include <vespa/searchlib/fef/properties.h> #include <vespa/searchlib/fef/itermdata.h> #include <vespa/vespalib/util/stringfmt.h> -#include "termfeature.h" -#include "utils.h" using namespace search::fef; diff --git a/searchlib/src/vespa/searchlib/features/terminfofeature.cpp b/searchlib/src/vespa/searchlib/features/terminfofeature.cpp index 07b2904bf2a..91cdc888285 100644 --- a/searchlib/src/vespa/searchlib/features/terminfofeature.cpp +++ b/searchlib/src/vespa/searchlib/features/terminfofeature.cpp @@ -1,18 +1,13 @@ // 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(".features.terminfo"); - +#include "terminfofeature.h" +#include "valuefeature.h" #include <vespa/searchlib/fef/properties.h> #include <vespa/searchlib/fef/fieldinfo.h> #include <vespa/searchlib/fef/fieldtype.h> #include <vespa/searchlib/fef/featurenamebuilder.h> #include <vespa/searchlib/fef/itermdata.h> #include <vespa/searchlib/fef/handle.h> -#include <sstream> -#include "terminfofeature.h" -#include "valuefeature.h" namespace search { namespace features { diff --git a/searchlib/src/vespa/searchlib/features/text_similarity_feature.cpp b/searchlib/src/vespa/searchlib/features/text_similarity_feature.cpp index 8340019cb02..c722cf1e74b 100644 --- a/searchlib/src/vespa/searchlib/features/text_similarity_feature.cpp +++ b/searchlib/src/vespa/searchlib/features/text_similarity_feature.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(".features.textsimilarity"); #include "text_similarity_feature.h" namespace search { diff --git a/searchlib/src/vespa/searchlib/features/weighted_set_parser.cpp b/searchlib/src/vespa/searchlib/features/weighted_set_parser.cpp index 3d2f03d54eb..c426d2a85d5 100644 --- a/searchlib/src/vespa/searchlib/features/weighted_set_parser.cpp +++ b/searchlib/src/vespa/searchlib/features/weighted_set_parser.cpp @@ -1,11 +1,10 @@ // 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 "weighted_set_parser.h" + #include <vespa/log/log.h> LOG_SETUP(".features.weighted_set_parser"); -#include "weighted_set_parser.h" - namespace search { namespace features { diff --git a/searchlib/src/vespa/searchlib/fef/blueprint.cpp b/searchlib/src/vespa/searchlib/fef/blueprint.cpp index c9a9b94eb44..ccea604b9b2 100644 --- a/searchlib/src/vespa/searchlib/fef/blueprint.cpp +++ b/searchlib/src/vespa/searchlib/fef/blueprint.cpp @@ -1,11 +1,11 @@ // 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(".fef.blueprint"); #include "blueprint.h" #include "parametervalidator.h" +#include <vespa/log/log.h> +LOG_SETUP(".fef.blueprint"); + namespace search { namespace fef { diff --git a/searchlib/src/vespa/searchlib/fef/blueprintfactory.cpp b/searchlib/src/vespa/searchlib/fef/blueprintfactory.cpp index af03194abb7..1bda84c9d16 100644 --- a/searchlib/src/vespa/searchlib/fef/blueprintfactory.cpp +++ b/searchlib/src/vespa/searchlib/fef/blueprintfactory.cpp @@ -1,9 +1,9 @@ // 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 "blueprintfactory.h" + #include <vespa/log/log.h> LOG_SETUP(".fef.blueprintfactory"); -#include "blueprintfactory.h" namespace search { namespace fef { diff --git a/searchlib/src/vespa/searchlib/fef/create-class-cpp.sh b/searchlib/src/vespa/searchlib/fef/create-class-cpp.sh index e47cc402dca..d9df58ae2b7 100755 --- a/searchlib/src/vespa/searchlib/fef/create-class-cpp.sh +++ b/searchlib/src/vespa/searchlib/fef/create-class-cpp.sh @@ -8,13 +8,9 @@ name=`echo $class | tr 'A-Z' 'a-z'` cat <<EOF // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/log/log.h> -LOG_SETUP(".fef.$name"); -#include <vespa/fastos/fastos.h> #include "$name.h" -namespace search { -namespace fef { +namespace search::fef { $class::$class() { @@ -24,6 +20,5 @@ $class::~$class() { } -} // namespace fef -} // namespace search +} EOF diff --git a/searchlib/src/vespa/searchlib/fef/feature_type.cpp b/searchlib/src/vespa/searchlib/fef/feature_type.cpp index 63434ec6bb7..b4fdbb927a1 100644 --- a/searchlib/src/vespa/searchlib/fef/feature_type.cpp +++ b/searchlib/src/vespa/searchlib/fef/feature_type.cpp @@ -1,7 +1,7 @@ // 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 "feature_type.h" +#include <cassert> namespace search { namespace fef { @@ -22,5 +22,11 @@ FeatureType::object(const TYPE &type_in) return FeatureType(std::make_unique<TYPE>(type_in)); } +const FeatureType::TYPE & +FeatureType::type() const { + assert(_type); + return *_type; +} + } // namespace fef } // namespace search diff --git a/searchlib/src/vespa/searchlib/fef/feature_type.h b/searchlib/src/vespa/searchlib/fef/feature_type.h index 74bdc4149eb..775d89cc2e6 100644 --- a/searchlib/src/vespa/searchlib/fef/feature_type.h +++ b/searchlib/src/vespa/searchlib/fef/feature_type.h @@ -28,10 +28,7 @@ public: FeatureType(const FeatureType &rhs); bool is_object() const { return (_type.get() != nullptr); } operator bool() const { return is_object(); } - const TYPE &type() const { - assert(_type); - return *_type; - } + const TYPE &type() const; static const FeatureType &number() { return _number; } static FeatureType object(const TYPE &type_in); }; diff --git a/searchlib/src/vespa/searchlib/fef/featurenamebuilder.cpp b/searchlib/src/vespa/searchlib/fef/featurenamebuilder.cpp index 292f5ac5bcc..1416f8673c7 100644 --- a/searchlib/src/vespa/searchlib/fef/featurenamebuilder.cpp +++ b/searchlib/src/vespa/searchlib/fef/featurenamebuilder.cpp @@ -1,6 +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 "featurenamebuilder.h" #include "featurenameparser.h" diff --git a/searchlib/src/vespa/searchlib/fef/featurenameparser.cpp b/searchlib/src/vespa/searchlib/fef/featurenameparser.cpp index fca21041f87..698355b25a7 100644 --- a/searchlib/src/vespa/searchlib/fef/featurenameparser.cpp +++ b/searchlib/src/vespa/searchlib/fef/featurenameparser.cpp @@ -1,11 +1,11 @@ // 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(".fef.featurenameparser"); -#include <vespa/vespalib/util/stringfmt.h> #include "featurenameparser.h" #include "featurenamebuilder.h" +#include <vespa/vespalib/util/stringfmt.h> + +#include <vespa/log/log.h> +LOG_SETUP(".fef.featurenameparser"); namespace { diff --git a/searchlib/src/vespa/searchlib/fef/featureoverrider.cpp b/searchlib/src/vespa/searchlib/fef/featureoverrider.cpp index 364abea4942..f2a0c2b9501 100644 --- a/searchlib/src/vespa/searchlib/fef/featureoverrider.cpp +++ b/searchlib/src/vespa/searchlib/fef/featureoverrider.cpp @@ -1,6 +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 "featureoverrider.h" namespace search { diff --git a/searchlib/src/vespa/searchlib/fef/fef.cpp b/searchlib/src/vespa/searchlib/fef/fef.cpp index 6a29c098479..1a4446c2a82 100644 --- a/searchlib/src/vespa/searchlib/fef/fef.cpp +++ b/searchlib/src/vespa/searchlib/fef/fef.cpp @@ -1,6 +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 "fef.h" namespace search { diff --git a/searchlib/src/vespa/searchlib/fef/fieldinfo.cpp b/searchlib/src/vespa/searchlib/fef/fieldinfo.cpp index 234352ddb31..13d746ba5fa 100644 --- a/searchlib/src/vespa/searchlib/fef/fieldinfo.cpp +++ b/searchlib/src/vespa/searchlib/fef/fieldinfo.cpp @@ -1,6 +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 "fieldinfo.h" namespace search { diff --git a/searchlib/src/vespa/searchlib/fef/fieldpositionsiterator.cpp b/searchlib/src/vespa/searchlib/fef/fieldpositionsiterator.cpp index 8994c9492a7..c938a427006 100644 --- a/searchlib/src/vespa/searchlib/fef/fieldpositionsiterator.cpp +++ b/searchlib/src/vespa/searchlib/fef/fieldpositionsiterator.cpp @@ -1,14 +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 "fieldpositionsiterator.h" #include <vespa/searchlib/common/fslimits.h> namespace search { namespace fef { -const uint32_t FieldPositionsIterator::UNKNOWN_LENGTH = -SEARCHLIB_FEF_UNKNOWN_FIELD_LENGTH; +const uint32_t FieldPositionsIterator::UNKNOWN_LENGTH = SEARCHLIB_FEF_UNKNOWN_FIELD_LENGTH; } // namespace fef } // namespace search diff --git a/searchlib/src/vespa/searchlib/fef/filetablefactory.cpp b/searchlib/src/vespa/searchlib/fef/filetablefactory.cpp index c113efe33d9..6d61e1f21c6 100644 --- a/searchlib/src/vespa/searchlib/fef/filetablefactory.cpp +++ b/searchlib/src/vespa/searchlib/fef/filetablefactory.cpp @@ -1,11 +1,11 @@ // 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(".fef.filetablefactory"); #include "filetablefactory.h" #include <fstream> +#include <vespa/log/log.h> +LOG_SETUP(".fef.filetablefactory"); + namespace search { namespace fef { diff --git a/searchlib/src/vespa/searchlib/fef/functiontablefactory.cpp b/searchlib/src/vespa/searchlib/fef/functiontablefactory.cpp index 55467b81cb6..ab5f1dc6b74 100644 --- a/searchlib/src/vespa/searchlib/fef/functiontablefactory.cpp +++ b/searchlib/src/vespa/searchlib/fef/functiontablefactory.cpp @@ -1,12 +1,11 @@ // 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(".fef.functiontablefactory"); +#include "functiontablefactory.h" #include <boost/algorithm/string/split.hpp> #include <boost/algorithm/string/classification.hpp> #include <cmath> -#include "functiontablefactory.h" +#include <vespa/log/log.h> +LOG_SETUP(".fef.functiontablefactory"); namespace { diff --git a/searchlib/src/vespa/searchlib/fef/itermdata.h b/searchlib/src/vespa/searchlib/fef/itermdata.h index dbcb3867923..efdf394ea6e 100644 --- a/searchlib/src/vespa/searchlib/fef/itermdata.h +++ b/searchlib/src/vespa/searchlib/fef/itermdata.h @@ -2,9 +2,9 @@ #pragma once -#include "handle.h" #include "itermfielddata.h" #include <vespa/searchlib/query/weight.h> +#include <cstddef> namespace search { namespace fef { diff --git a/searchlib/src/vespa/searchlib/fef/location.cpp b/searchlib/src/vespa/searchlib/fef/location.cpp index 9bed7305a1e..34f77f02b82 100644 --- a/searchlib/src/vespa/searchlib/fef/location.cpp +++ b/searchlib/src/vespa/searchlib/fef/location.cpp @@ -1,6 +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 "location.h" namespace search { diff --git a/searchlib/src/vespa/searchlib/fef/parameter.cpp b/searchlib/src/vespa/searchlib/fef/parameter.cpp index 583061ad383..1952967c439 100644 --- a/searchlib/src/vespa/searchlib/fef/parameter.cpp +++ b/searchlib/src/vespa/searchlib/fef/parameter.cpp @@ -1,6 +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 "parameter.h" namespace search { @@ -11,7 +10,7 @@ Parameter::Parameter(ParameterType::Enum type, const vespalib::string & value) : _stringVal(value), _doubleVal(0), _intVal(0), - _fieldVal(NULL) + _fieldVal(nullptr) { } diff --git a/searchlib/src/vespa/searchlib/fef/parameterdescriptions.cpp b/searchlib/src/vespa/searchlib/fef/parameterdescriptions.cpp index 5262a41f734..3a6e4147e81 100644 --- a/searchlib/src/vespa/searchlib/fef/parameterdescriptions.cpp +++ b/searchlib/src/vespa/searchlib/fef/parameterdescriptions.cpp @@ -1,7 +1,7 @@ // 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 "parameterdescriptions.h" +#include <cassert> namespace search { namespace fef { @@ -51,5 +51,20 @@ ParameterDescriptions::desc(size_t tag) { return *this; } +void +ParameterDescriptions::addParameter(const ParamDescItem ¶m) { + assert(!_descriptions.empty()); + assert(!getCurrent().hasRepeat()); + getCurrent().addParameter(param); +} + +ParameterDescriptions & +ParameterDescriptions::repeat(size_t n) { + assert(!_descriptions.empty()); + assert(getCurrent().getParams().size() >= n); + getCurrent().setRepeat(n); + return *this; +} + } // namespace fef } // namespace search diff --git a/searchlib/src/vespa/searchlib/fef/parameterdescriptions.h b/searchlib/src/vespa/searchlib/fef/parameterdescriptions.h index d91e96b0e59..dcd2a44d75f 100644 --- a/searchlib/src/vespa/searchlib/fef/parameterdescriptions.h +++ b/searchlib/src/vespa/searchlib/fef/parameterdescriptions.h @@ -3,6 +3,7 @@ #pragma once #include <vector> +#include <cstddef> namespace search { namespace fef { @@ -99,11 +100,7 @@ private: size_t _nextTag; Description & getCurrent() { return _descriptions.back(); } - void addParameter(const ParamDescItem ¶m) { - assert(!_descriptions.empty()); - assert(!getCurrent().hasRepeat()); - getCurrent().addParameter(param); - } + void addParameter(const ParamDescItem ¶m); void addParameter(ParameterType::Enum type, ParameterCollection::Enum collection) { addParameter(ParamDescItem(type, collection)); } @@ -175,16 +172,8 @@ public: /** * Sets the repeat number on the current description. */ - ParameterDescriptions & repeat(size_t n = 1) { - assert(!_descriptions.empty()); - assert(getCurrent().getParams().size() >= n); - getCurrent().setRepeat(n); - return *this; - } + ParameterDescriptions & repeat(size_t n = 1); }; - - } // namespace fef } // namespace search - diff --git a/searchlib/src/vespa/searchlib/fef/parametervalidator.cpp b/searchlib/src/vespa/searchlib/fef/parametervalidator.cpp index 696e8a18dfc..3fb8305fcea 100644 --- a/searchlib/src/vespa/searchlib/fef/parametervalidator.cpp +++ b/searchlib/src/vespa/searchlib/fef/parametervalidator.cpp @@ -1,11 +1,10 @@ // 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 <boost/lexical_cast.hpp> -#include <vespa/vespalib/util/vstringfmt.h> -#include "fieldinfo.h" -#include "fieldtype.h" #include "parametervalidator.h" +#include "fieldtype.h" +#include "fieldinfo.h" +#include <vespa/vespalib/util/vstringfmt.h> +#include <boost/lexical_cast.hpp> using vespalib::make_vespa_string; diff --git a/searchlib/src/vespa/searchlib/fef/phrasesplitter.cpp b/searchlib/src/vespa/searchlib/fef/phrasesplitter.cpp index 23f79080cd3..1a8201c2bc6 100644 --- a/searchlib/src/vespa/searchlib/fef/phrasesplitter.cpp +++ b/searchlib/src/vespa/searchlib/fef/phrasesplitter.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(".fef.phrasesplitter"); #include "phrasesplitter.h" namespace search { @@ -51,7 +48,7 @@ PhraseSplitter::PhraseSplitter(const IQueryEnvironment & queryEnv, for (uint32_t i = 0; i < queryEnv.getNumTerms(); ++i) { const ITermData *td = queryEnv.getTerm(i); - LOG_ASSERT(td != NULL); + assert(td != NULL); considerTerm(i, *td, phraseTerms, fieldId); numHandles += td->numFields(); } @@ -100,7 +97,7 @@ PhraseSplitter::update() for (uint32_t i = 0; i < _copyInfo.size(); ++i) { const TermFieldMatchData *src = _matchData->resolveTermField(_copyInfo[i].orig_handle); TermFieldMatchData *dst = resolveSplittedTermField(_copyInfo[i].split_handle); - LOG_ASSERT(src != NULL && dst != NULL); + assert(src != NULL && dst != NULL); copyTermFieldMatchData(*dst, *src, _copyInfo[i].offsetInPhrase); } diff --git a/searchlib/src/vespa/searchlib/fef/queryproperties.cpp b/searchlib/src/vespa/searchlib/fef/queryproperties.cpp index a5dd5dc9229..41e8fc7053d 100644 --- a/searchlib/src/vespa/searchlib/fef/queryproperties.cpp +++ b/searchlib/src/vespa/searchlib/fef/queryproperties.cpp @@ -1,6 +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 "queryproperties.h" namespace search { diff --git a/searchlib/src/vespa/searchlib/fef/simpletermdata.cpp b/searchlib/src/vespa/searchlib/fef/simpletermdata.cpp index 97ec1f8cca3..34a9bd63780 100644 --- a/searchlib/src/vespa/searchlib/fef/simpletermdata.cpp +++ b/searchlib/src/vespa/searchlib/fef/simpletermdata.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(".fef.simpletermdata"); #include "simpletermdata.h" namespace search { diff --git a/searchlib/src/vespa/searchlib/fef/simpletermfielddata.cpp b/searchlib/src/vespa/searchlib/fef/simpletermfielddata.cpp index 582e5e330d6..6318fd547eb 100644 --- a/searchlib/src/vespa/searchlib/fef/simpletermfielddata.cpp +++ b/searchlib/src/vespa/searchlib/fef/simpletermfielddata.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(".fef.simpletermfielddata"); #include "simpletermfielddata.h" namespace search { diff --git a/searchlib/src/vespa/searchlib/fef/symmetrictable.cpp b/searchlib/src/vespa/searchlib/fef/symmetrictable.cpp index 29818a9f416..5f5bcf71263 100644 --- a/searchlib/src/vespa/searchlib/fef/symmetrictable.cpp +++ b/searchlib/src/vespa/searchlib/fef/symmetrictable.cpp @@ -1,6 +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 "symmetrictable.h" namespace search { diff --git a/searchlib/src/vespa/searchlib/fef/table.cpp b/searchlib/src/vespa/searchlib/fef/table.cpp index c32cd233937..f1eb23ccb7a 100644 --- a/searchlib/src/vespa/searchlib/fef/table.cpp +++ b/searchlib/src/vespa/searchlib/fef/table.cpp @@ -1,6 +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 "table.h" #include <limits> diff --git a/searchlib/src/vespa/searchlib/fef/table.h b/searchlib/src/vespa/searchlib/fef/table.h index a2203b83041..11671607991 100644 --- a/searchlib/src/vespa/searchlib/fef/table.h +++ b/searchlib/src/vespa/searchlib/fef/table.h @@ -3,9 +3,9 @@ #pragma once #include <vector> +#include <memory> -namespace search { -namespace fef { +namespace search::fef { /** * This class represents a rank table with double values. @@ -60,6 +60,4 @@ public: } }; -} // namespace fef -} // namespace search - +}
\ No newline at end of file diff --git a/searchlib/src/vespa/searchlib/fef/termfieldmatchdata.cpp b/searchlib/src/vespa/searchlib/fef/termfieldmatchdata.cpp index e4c7d92dce4..b6bec259450 100644 --- a/searchlib/src/vespa/searchlib/fef/termfieldmatchdata.cpp +++ b/searchlib/src/vespa/searchlib/fef/termfieldmatchdata.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(".fef.termfieldmatchdata"); #include "termfieldmatchdata.h" #include "fieldinfo.h" #include <algorithm> diff --git a/searchlib/src/vespa/searchlib/fef/termfieldmatchdataposition.cpp b/searchlib/src/vespa/searchlib/fef/termfieldmatchdataposition.cpp index f76c785b616..fcfa73d9456 100644 --- a/searchlib/src/vespa/searchlib/fef/termfieldmatchdataposition.cpp +++ b/searchlib/src/vespa/searchlib/fef/termfieldmatchdataposition.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(".fef.termfieldmatchdataposition"); #include "termfieldmatchdataposition.h" namespace search { diff --git a/searchlib/src/vespa/searchlib/fef/test/dummy_dependency_handler.cpp b/searchlib/src/vespa/searchlib/fef/test/dummy_dependency_handler.cpp index 7515a6338e0..f8155495e2a 100644 --- a/searchlib/src/vespa/searchlib/fef/test/dummy_dependency_handler.cpp +++ b/searchlib/src/vespa/searchlib/fef/test/dummy_dependency_handler.cpp @@ -1,7 +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 "dummy_dependency_handler.h" namespace search { diff --git a/searchlib/src/vespa/searchlib/fef/test/indexenvironmentbuilder.cpp b/searchlib/src/vespa/searchlib/fef/test/indexenvironmentbuilder.cpp index dbe3ea52078..c173cb474e7 100644 --- a/searchlib/src/vespa/searchlib/fef/test/indexenvironmentbuilder.cpp +++ b/searchlib/src/vespa/searchlib/fef/test/indexenvironmentbuilder.cpp @@ -1,5 +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 "indexenvironmentbuilder.h" namespace search { diff --git a/searchlib/src/vespa/searchlib/fef/test/plugin/cfgvalue.cpp b/searchlib/src/vespa/searchlib/fef/test/plugin/cfgvalue.cpp index ce0878c7306..96075188fc6 100644 --- a/searchlib/src/vespa/searchlib/fef/test/plugin/cfgvalue.cpp +++ b/searchlib/src/vespa/searchlib/fef/test/plugin/cfgvalue.cpp @@ -1,12 +1,8 @@ // 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(".fef.cfgvalue"); - +#include "cfgvalue.h" #include <vespa/searchlib/fef/properties.h> #include <sstream> -#include "cfgvalue.h" namespace search { namespace fef { diff --git a/searchlib/src/vespa/searchlib/fef/test/plugin/chain.cpp b/searchlib/src/vespa/searchlib/fef/test/plugin/chain.cpp index f79209270b8..7e6aabeebf1 100644 --- a/searchlib/src/vespa/searchlib/fef/test/plugin/chain.cpp +++ b/searchlib/src/vespa/searchlib/fef/test/plugin/chain.cpp @@ -1,10 +1,6 @@ // 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(".fef.chain"); #include "chain.h" - #include <sstream> namespace search { diff --git a/searchlib/src/vespa/searchlib/fef/test/plugin/double.cpp b/searchlib/src/vespa/searchlib/fef/test/plugin/double.cpp index 5fe7539b834..82d4e4e8865 100644 --- a/searchlib/src/vespa/searchlib/fef/test/plugin/double.cpp +++ b/searchlib/src/vespa/searchlib/fef/test/plugin/double.cpp @@ -1,12 +1,8 @@ // 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(".fef.double"); #include "double.h" - -#include <vespa/vespalib/stllike/asciistream.h> #include <vespa/searchlib/fef/featurenamebuilder.h> +#include <vespa/vespalib/stllike/asciistream.h> namespace search { namespace fef { diff --git a/searchlib/src/vespa/searchlib/fef/test/plugin/query.cpp b/searchlib/src/vespa/searchlib/fef/test/plugin/query.cpp index 60fafd8ae90..6a2fc8c64ac 100644 --- a/searchlib/src/vespa/searchlib/fef/test/plugin/query.cpp +++ b/searchlib/src/vespa/searchlib/fef/test/plugin/query.cpp @@ -1,13 +1,9 @@ // 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(".fef.query"); - +#include "query.h" #include <vespa/searchlib/features/valuefeature.h> #include <vespa/searchlib/fef/properties.h> #include <sstream> -#include "query.h" namespace search { namespace fef { diff --git a/searchlib/src/vespa/searchlib/fef/test/plugin/setup.cpp b/searchlib/src/vespa/searchlib/fef/test/plugin/setup.cpp index 94a74947cea..8ca6692360d 100644 --- a/searchlib/src/vespa/searchlib/fef/test/plugin/setup.cpp +++ b/searchlib/src/vespa/searchlib/fef/test/plugin/setup.cpp @@ -1,12 +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(".fef.setup"); - -#include <vespa/searchlib/fef/blueprint.h> -#include <string> - #include "cfgvalue.h" #include "chain.h" #include "double.h" @@ -14,6 +7,7 @@ LOG_SETUP(".fef.setup"); #include "setup.h" #include "staticrank.h" #include "sum.h" +#include <vespa/searchlib/fef/blueprint.h> namespace search { namespace fef { diff --git a/searchlib/src/vespa/searchlib/fef/test/plugin/staticrank.cpp b/searchlib/src/vespa/searchlib/fef/test/plugin/staticrank.cpp index 238f0ca0dd4..003fc3c0a5a 100644 --- a/searchlib/src/vespa/searchlib/fef/test/plugin/staticrank.cpp +++ b/searchlib/src/vespa/searchlib/fef/test/plugin/staticrank.cpp @@ -1,10 +1,7 @@ // 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(".fef.staticrank"); -#include <vespa/searchcommon/attribute/attributecontent.h> #include "staticrank.h" +#include <vespa/searchcommon/attribute/attributecontent.h> namespace search { namespace fef { diff --git a/searchlib/src/vespa/searchlib/fef/test/plugin/sum.cpp b/searchlib/src/vespa/searchlib/fef/test/plugin/sum.cpp index 2e20ea12efe..775d2203915 100644 --- a/searchlib/src/vespa/searchlib/fef/test/plugin/sum.cpp +++ b/searchlib/src/vespa/searchlib/fef/test/plugin/sum.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(".fef.sum"); #include "sum.h" #include <vespa/searchlib/fef/featurenamebuilder.h> diff --git a/searchlib/src/vespa/searchlib/fef/test/queryenvironmentbuilder.cpp b/searchlib/src/vespa/searchlib/fef/test/queryenvironmentbuilder.cpp index 7db5110e627..107ad9914b2 100644 --- a/searchlib/src/vespa/searchlib/fef/test/queryenvironmentbuilder.cpp +++ b/searchlib/src/vespa/searchlib/fef/test/queryenvironmentbuilder.cpp @@ -1,5 +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 "queryenvironmentbuilder.h" namespace search { diff --git a/searchlib/src/vespa/searchlib/fef/test/rankresult.cpp b/searchlib/src/vespa/searchlib/fef/test/rankresult.cpp index 218153db489..167f569995f 100644 --- a/searchlib/src/vespa/searchlib/fef/test/rankresult.cpp +++ b/searchlib/src/vespa/searchlib/fef/test/rankresult.cpp @@ -1,10 +1,10 @@ // 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(".fef.rankresult"); #include "rankresult.h" #include <cmath> -#include <iostream> +#include <ostream> + +#include <vespa/log/log.h> +LOG_SETUP(".fef.rankresult"); namespace search { namespace fef { diff --git a/searchlib/src/vespa/searchlib/fef/utils.cpp b/searchlib/src/vespa/searchlib/fef/utils.cpp index 70396857759..06eed77a3a9 100644 --- a/searchlib/src/vespa/searchlib/fef/utils.cpp +++ b/searchlib/src/vespa/searchlib/fef/utils.cpp @@ -1,6 +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 "utils.h" #include <vector> diff --git a/searchlib/src/vespa/searchlib/fef/verify_feature.cpp b/searchlib/src/vespa/searchlib/fef/verify_feature.cpp index ebfdf1622ba..e2fa8faa5b8 100644 --- a/searchlib/src/vespa/searchlib/fef/verify_feature.cpp +++ b/searchlib/src/vespa/searchlib/fef/verify_feature.cpp @@ -1,11 +1,11 @@ // 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(".fef.verify_feature"); #include "verify_feature.h" #include "blueprintresolver.h" +#include <vespa/log/log.h> +LOG_SETUP(".fef.verify_feature"); + namespace search { namespace fef { diff --git a/searchlib/src/vespa/searchlib/parsequery/parse.cpp b/searchlib/src/vespa/searchlib/parsequery/parse.cpp index b4f72c61f0d..591adf9188a 100644 --- a/searchlib/src/vespa/searchlib/parsequery/parse.cpp +++ b/searchlib/src/vespa/searchlib/parsequery/parse.cpp @@ -1,7 +1,8 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/searchlib/parsequery/parse.h> +#include "parse.h" #include <vespa/vespalib/objects/nbo.h> +#include <cassert> namespace search { diff --git a/searchlib/src/vespa/searchlib/parsequery/stackdumpiterator.cpp b/searchlib/src/vespa/searchlib/parsequery/stackdumpiterator.cpp index 9da5a71b4d0..f406f8a70c9 100644 --- a/searchlib/src/vespa/searchlib/parsequery/stackdumpiterator.cpp +++ b/searchlib/src/vespa/searchlib/parsequery/stackdumpiterator.cpp @@ -7,9 +7,9 @@ * ALL RIGHTS RESERVED */ #include "stackdumpiterator.h" -#include <vespa/searchlib/util/rawbuf.h> #include <vespa/vespalib/util/compress.h> #include <vespa/vespalib/objects/nbo.h> +#include <cassert> using search::query::PredicateQueryTerm; diff --git a/searchlib/src/vespa/searchlib/queryeval/booleanmatchiteratorwrapper.cpp b/searchlib/src/vespa/searchlib/queryeval/booleanmatchiteratorwrapper.cpp index 9c3dec5c1b2..c029dcdc13a 100644 --- a/searchlib/src/vespa/searchlib/queryeval/booleanmatchiteratorwrapper.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/booleanmatchiteratorwrapper.cpp @@ -1,6 +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 "booleanmatchiteratorwrapper.h" #include <vespa/searchlib/fef/termfieldmatchdata.h> #include <vespa/searchlib/fef/termfieldmatchdataarray.h> diff --git a/searchlib/src/vespa/searchlib/queryeval/create-class-cpp.sh b/searchlib/src/vespa/searchlib/queryeval/create-class-cpp.sh index 728ab7a11ce..d25e2a84754 100755 --- a/searchlib/src/vespa/searchlib/queryeval/create-class-cpp.sh +++ b/searchlib/src/vespa/searchlib/queryeval/create-class-cpp.sh @@ -8,13 +8,9 @@ name=`echo $class | tr 'A-Z' 'a-z'` cat <<EOF // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/log/log.h> -LOG_SETUP(".$name"); -#include <vespa/fastos/fastos.h> #include "$name.h" -namespace search { -namespace queryeval { +namespace search::queryeval { $class::$class() { @@ -24,6 +20,5 @@ $class::~$class() { } -} // namespace queryeval -} // namespace search +} EOF diff --git a/searchlib/src/vespa/searchlib/queryeval/document_weight_search_iterator.cpp b/searchlib/src/vespa/searchlib/queryeval/document_weight_search_iterator.cpp index 9f876e788bf..947ae6720f5 100644 --- a/searchlib/src/vespa/searchlib/queryeval/document_weight_search_iterator.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/document_weight_search_iterator.cpp @@ -1,4 +1,3 @@ // 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 "document_weight_search_iterator.h" diff --git a/searchlib/src/vespa/searchlib/queryeval/dot_product_blueprint.cpp b/searchlib/src/vespa/searchlib/queryeval/dot_product_blueprint.cpp index 015b3f25499..7554883cce8 100644 --- a/searchlib/src/vespa/searchlib/queryeval/dot_product_blueprint.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/dot_product_blueprint.cpp @@ -1,6 +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 "dot_product_blueprint.h" #include "dot_product_search.h" #include <vespa/searchlib/fef/termfieldmatchdata.h> diff --git a/searchlib/src/vespa/searchlib/queryeval/emptysearch.cpp b/searchlib/src/vespa/searchlib/queryeval/emptysearch.cpp index b500e977848..475686d550e 100644 --- a/searchlib/src/vespa/searchlib/queryeval/emptysearch.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/emptysearch.cpp @@ -1,6 +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 "emptysearch.h" namespace search { diff --git a/searchlib/src/vespa/searchlib/queryeval/equiv_blueprint.cpp b/searchlib/src/vespa/searchlib/queryeval/equiv_blueprint.cpp index 30ae5e023ef..070d4b80f0b 100644 --- a/searchlib/src/vespa/searchlib/queryeval/equiv_blueprint.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/equiv_blueprint.cpp @@ -1,6 +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 "equiv_blueprint.h" #include "equivsearch.h" #include <vespa/vespalib/objects/visit.hpp> diff --git a/searchlib/src/vespa/searchlib/queryeval/fake_search.cpp b/searchlib/src/vespa/searchlib/queryeval/fake_search.cpp index 85946e1a758..cf8d81747e8 100644 --- a/searchlib/src/vespa/searchlib/queryeval/fake_search.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/fake_search.cpp @@ -1,12 +1,9 @@ // 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(".fakesearch"); -#include <vespa/vespalib/objects/visit.h> #include "fake_search.h" #include <vespa/searchlib/fef/termfieldmatchdataposition.h> #include <vespa/searchlib/fef/termfieldmatchdata.h> +#include <vespa/vespalib/objects/visit.h> namespace search { namespace queryeval { diff --git a/searchlib/src/vespa/searchlib/queryeval/field_spec.cpp b/searchlib/src/vespa/searchlib/queryeval/field_spec.cpp index 60cdefab2c1..caa7c364b06 100644 --- a/searchlib/src/vespa/searchlib/queryeval/field_spec.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/field_spec.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(".fieldspec"); #include "field_spec.h" namespace search { diff --git a/searchlib/src/vespa/searchlib/queryeval/leaf_blueprints.cpp b/searchlib/src/vespa/searchlib/queryeval/leaf_blueprints.cpp index b7e9cb8efc3..e39e27c0bf9 100644 --- a/searchlib/src/vespa/searchlib/queryeval/leaf_blueprints.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/leaf_blueprints.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(".queryeval.leaf_blueprints"); #include "leaf_blueprints.h" #include "emptysearch.h" #include "simplesearch.h" diff --git a/searchlib/src/vespa/searchlib/queryeval/monitoring_dump_iterator.cpp b/searchlib/src/vespa/searchlib/queryeval/monitoring_dump_iterator.cpp index 198634c56a9..d78e5ae2eb7 100644 --- a/searchlib/src/vespa/searchlib/queryeval/monitoring_dump_iterator.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/monitoring_dump_iterator.cpp @@ -1,8 +1,7 @@ // 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 "monitoring_dump_iterator.h" #include <vespa/log/log.h> LOG_SETUP(".queryeval.monitoring_dump_iterator"); -#include "monitoring_dump_iterator.h" namespace search { namespace queryeval { diff --git a/searchlib/src/vespa/searchlib/queryeval/multisearch.cpp b/searchlib/src/vespa/searchlib/queryeval/multisearch.cpp index 3ba06875441..41ebca00b09 100644 --- a/searchlib/src/vespa/searchlib/queryeval/multisearch.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/multisearch.cpp @@ -1,6 +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 "multisearch.h" #include <vespa/vespalib/objects/visit.hpp> diff --git a/searchlib/src/vespa/searchlib/queryeval/nearsearch.cpp b/searchlib/src/vespa/searchlib/queryeval/nearsearch.cpp index b33ab946acc..c39ed08982e 100644 --- a/searchlib/src/vespa/searchlib/queryeval/nearsearch.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/nearsearch.cpp @@ -1,14 +1,13 @@ // 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(".nearsearch"); - #include "nearsearch.h" #include <vespa/vespalib/objects/visit.h> #include <vespa/vespalib/util/priority_queue.h> #include <limits> #include <set> +#include <vespa/log/log.h> +LOG_SETUP(".nearsearch"); + namespace search { namespace queryeval { diff --git a/searchlib/src/vespa/searchlib/queryeval/simple_phrase_blueprint.cpp b/searchlib/src/vespa/searchlib/queryeval/simple_phrase_blueprint.cpp index cce2f22797b..449523b0da5 100644 --- a/searchlib/src/vespa/searchlib/queryeval/simple_phrase_blueprint.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/simple_phrase_blueprint.cpp @@ -1,10 +1,8 @@ // 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 "simple_phrase_blueprint.h" #include "simple_phrase_search.h" #include <vespa/searchlib/fef/termfieldmatchdata.h> -#include <vespa/searchlib/queryeval/searchiterator.h> #include <vespa/vespalib/objects/visit.hpp> #include <algorithm> #include <map> diff --git a/searchlib/src/vespa/searchlib/queryeval/simple_phrase_search.cpp b/searchlib/src/vespa/searchlib/queryeval/simple_phrase_search.cpp index 9a624724933..686bf3608e7 100644 --- a/searchlib/src/vespa/searchlib/queryeval/simple_phrase_search.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/simple_phrase_search.cpp @@ -1,9 +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(".simple_phrase_search"); - #include "simple_phrase_search.h" #include <vespa/searchlib/fef/termfieldmatchdata.h> #include <vespa/vespalib/objects/visit.h> diff --git a/searchlib/src/vespa/searchlib/queryeval/simpleresult.cpp b/searchlib/src/vespa/searchlib/queryeval/simpleresult.cpp index f114eef8b39..20e3f482b62 100644 --- a/searchlib/src/vespa/searchlib/queryeval/simpleresult.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/simpleresult.cpp @@ -1,9 +1,8 @@ // 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(".simpleresult"); #include "simpleresult.h" +#include <cassert> +#include <ostream> namespace search { namespace queryeval { diff --git a/searchlib/src/vespa/searchlib/queryeval/simplesearch.cpp b/searchlib/src/vespa/searchlib/queryeval/simplesearch.cpp index 2d5b6b3e8b8..17641b38634 100644 --- a/searchlib/src/vespa/searchlib/queryeval/simplesearch.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/simplesearch.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(".simplesearch"); #include "simplesearch.h" #include <vespa/vespalib/objects/visit.h> diff --git a/searchlib/src/vespa/searchlib/queryeval/split_float.cpp b/searchlib/src/vespa/searchlib/queryeval/split_float.cpp index dd6a370ceda..f4a4c231871 100644 --- a/searchlib/src/vespa/searchlib/queryeval/split_float.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/split_float.cpp @@ -1,9 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -// $Id$ -#include <vespa/fastos/fastos.h> #include "split_float.h" -#include <ctype.h> +#include <cctype> namespace search { namespace queryeval { diff --git a/searchlib/src/vespa/searchlib/queryeval/truesearch.cpp b/searchlib/src/vespa/searchlib/queryeval/truesearch.cpp index 0c808ce06f2..bbc604db772 100644 --- a/searchlib/src/vespa/searchlib/queryeval/truesearch.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/truesearch.cpp @@ -1,6 +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 "truesearch.h" namespace search { diff --git a/searchlib/src/vespa/searchlib/queryeval/wand/parallel_weak_and_blueprint.cpp b/searchlib/src/vespa/searchlib/queryeval/wand/parallel_weak_and_blueprint.cpp index d92ed9007bd..96ddaae1b03 100644 --- a/searchlib/src/vespa/searchlib/queryeval/wand/parallel_weak_and_blueprint.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/wand/parallel_weak_and_blueprint.cpp @@ -1,5 +1,4 @@ // 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 "wand_parts.h" #include "parallel_weak_and_blueprint.h" #include "parallel_weak_and_search.h" diff --git a/searchlib/src/vespa/searchlib/queryeval/wand/parallel_weak_and_search.cpp b/searchlib/src/vespa/searchlib/queryeval/wand/parallel_weak_and_search.cpp index 05a2d7d6822..4250f424d32 100644 --- a/searchlib/src/vespa/searchlib/queryeval/wand/parallel_weak_and_search.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/wand/parallel_weak_and_search.cpp @@ -1,16 +1,13 @@ // 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(".queryeval.parallel_weak_and_search"); + #include "parallel_weak_and_search.h" +#include <vespa/searchlib/queryeval/document_weight_search_iterator.h> #include <vespa/searchlib/queryeval/monitoring_dump_iterator.h> -#include <vespa/searchlib/queryeval/monitoring_search_iterator.h> -#include "wand_parts.h" -#include <vespa/vespalib/objects/visit.h> -#include <vespa/vespalib/util/stringfmt.h> -#include <vespa/searchlib/queryeval/emptysearch.h> #include <vespa/searchlib/fef/matchdatalayout.h> -#include <vespa/searchlib/queryeval/document_weight_search_iterator.h> +#include <vespa/vespalib/objects/visit.h> + +#include <vespa/log/log.h> +LOG_SETUP(".queryeval.parallel_weak_and_search"); using vespalib::make_string; diff --git a/searchlib/src/vespa/searchlib/queryeval/wand/weak_and_search.cpp b/searchlib/src/vespa/searchlib/queryeval/wand/weak_and_search.cpp index 2fe27f8504b..af3e0b866f1 100644 --- a/searchlib/src/vespa/searchlib/queryeval/wand/weak_and_search.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/wand/weak_and_search.cpp @@ -1,6 +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 "wand_parts.h" #include "weak_and_search.h" #include <vespa/searchlib/queryeval/orsearch.h> diff --git a/searchlib/src/vespa/searchlib/test/diskindex/testdiskindex.cpp b/searchlib/src/vespa/searchlib/test/diskindex/testdiskindex.cpp index ad1ff63c133..e8e41f61ae9 100644 --- a/searchlib/src/vespa/searchlib/test/diskindex/testdiskindex.cpp +++ b/searchlib/src/vespa/searchlib/test/diskindex/testdiskindex.cpp @@ -1,6 +1,6 @@ // 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/searchlib/test/diskindex/testdiskindex.h> + +#include "testdiskindex.h" #include <vespa/searchlib/diskindex/indexbuilder.h> #include <vespa/searchlib/index/dummyfileheadercontext.h> #include <vespa/vespalib/io/fileutil.h> diff --git a/searchlib/src/vespa/searchlib/test/document_weight_attribute_helper.cpp b/searchlib/src/vespa/searchlib/test/document_weight_attribute_helper.cpp index cfd06a86d0e..6efea89cd7f 100644 --- a/searchlib/src/vespa/searchlib/test/document_weight_attribute_helper.cpp +++ b/searchlib/src/vespa/searchlib/test/document_weight_attribute_helper.cpp @@ -1,5 +1,4 @@ // 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 "document_weight_attribute_helper.h" namespace search { diff --git a/searchlib/src/vespa/searchlib/test/fakedata/bitdecode64.cpp b/searchlib/src/vespa/searchlib/test/fakedata/bitdecode64.cpp index cda9314366c..57e61270913 100644 --- a/searchlib/src/vespa/searchlib/test/fakedata/bitdecode64.cpp +++ b/searchlib/src/vespa/searchlib/test/fakedata/bitdecode64.cpp @@ -1,22 +1,11 @@ // 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(".bitdecode64"); #include "bitencode64.h" #include "bitdecode64.h" - -namespace search -{ - -namespace fakedata -{ +namespace search::fakedata { template class BitDecode64<true>; - template class BitDecode64<false>; -} // namespace fakedata - -} // namespace search +} diff --git a/searchlib/src/vespa/searchlib/test/fakedata/bitencode64.cpp b/searchlib/src/vespa/searchlib/test/fakedata/bitencode64.cpp index 27b330e5896..98cdb50c3fc 100644 --- a/searchlib/src/vespa/searchlib/test/fakedata/bitencode64.cpp +++ b/searchlib/src/vespa/searchlib/test/fakedata/bitencode64.cpp @@ -1,16 +1,8 @@ // 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(".bitencode64"); #include "bitencode64.h" - -namespace search -{ - -namespace fakedata -{ +namespace search::fakedata { template <bool bigEndian> BitEncode64<bigEndian>::BitEncode64() @@ -21,17 +13,12 @@ BitEncode64<bigEndian>::BitEncode64() this->afterWrite(_cbuf, 0, 0); } - template <bool bigEndian> BitEncode64<bigEndian>::~BitEncode64() { } template class BitEncode64<true>; - template class BitEncode64<false>; - -} // namespace fakedata - -} // namespace search +} diff --git a/searchlib/src/vespa/searchlib/test/fakedata/fakeegcompr64filterocc.cpp b/searchlib/src/vespa/searchlib/test/fakedata/fakeegcompr64filterocc.cpp index a56ec56c5da..fcc83b39138 100644 --- a/searchlib/src/vespa/searchlib/test/fakedata/fakeegcompr64filterocc.cpp +++ b/searchlib/src/vespa/searchlib/test/fakedata/fakeegcompr64filterocc.cpp @@ -1,14 +1,11 @@ // 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(".fakeegcompr64filterocc"); #include "fakeegcompr64filterocc.h" +#include "fpfactory.h" #include <vespa/searchlib/bitcompression/compression.h> #include <vespa/searchlib/bitcompression/posocccompression.h> #include <vespa/searchlib/queryeval/iterators.h> #include <vespa/searchlib/fef/termfieldmatchdataarray.h> -#include "fpfactory.h" using search::fef::TermFieldMatchData; using search::fef::TermFieldMatchDataPosition; @@ -16,11 +13,7 @@ using search::fef::TermFieldMatchDataPosition; #include "bitencode64.h" #include "bitdecode64.h" -namespace search -{ - -namespace fakedata -{ +namespace search::fakedata { #define DEBUG_EGCOMPR64FILTEROCC_PRINTF 0 #define DEBUG_EGCOMPR64FILTEROCC_ASSERT 1 @@ -1512,7 +1505,4 @@ createIterator(const fef::TermFieldMatchDataArray &matchData) const matchData); } - -} // namespace fakedata - -} // namespace search +} diff --git a/searchlib/src/vespa/searchlib/test/fakedata/fakefilterocc.cpp b/searchlib/src/vespa/searchlib/test/fakedata/fakefilterocc.cpp index 8cbf2ede7d3..1c4b318ed71 100644 --- a/searchlib/src/vespa/searchlib/test/fakedata/fakefilterocc.cpp +++ b/searchlib/src/vespa/searchlib/test/fakedata/fakefilterocc.cpp @@ -1,20 +1,13 @@ // 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(".fakefilterocc"); -#include <vespa/searchlib/queryeval/iterators.h> #include "fakefilterocc.h" #include "fpfactory.h" +#include <vespa/searchlib/queryeval/iterators.h> using search::fef::TermFieldMatchData; using search::fef::TermFieldMatchDataPosition; -namespace search -{ - -namespace fakedata -{ +namespace search::fakedata { static FPFactoryInit init(std::make_pair("FilterOcc", @@ -201,6 +194,4 @@ createIterator(const fef::TermFieldMatchDataArray &matchData) const matchData); } -} // namespace fakedata - -} // namespace search +} diff --git a/searchlib/src/vespa/searchlib/test/fakedata/fakememtreeocc.cpp b/searchlib/src/vespa/searchlib/test/fakedata/fakememtreeocc.cpp index 632d85ffcd1..750be8b84dc 100644 --- a/searchlib/src/vespa/searchlib/test/fakedata/fakememtreeocc.cpp +++ b/searchlib/src/vespa/searchlib/test/fakedata/fakememtreeocc.cpp @@ -1,27 +1,22 @@ // 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(".fakememtreeocc"); -#include <vespa/searchlib/queryeval/iterators.h> #include "fakememtreeocc.h" +#include "fpfactory.h" +#include <vespa/searchlib/queryeval/iterators.h> #include <vespa/searchlib/btree/btreeroot.hpp> #include <vespa/searchlib/btree/btreeiterator.hpp> #include <vespa/searchlib/btree/btreenodeallocator.hpp> #include <vespa/searchlib/btree/btreenode.hpp> #include <vespa/searchlib/btree/btreenodestore.hpp> #include <vespa/searchlib/memoryindex/postingiterator.h> -#include "fpfactory.h" #include <vespa/searchlib/util/postingpriorityqueue.h> +#include <vespa/log/log.h> +LOG_SETUP(".fakememtreeocc"); using search::fef::TermFieldMatchData; using search::fef::TermFieldMatchDataPosition; -namespace search -{ - -namespace fakedata -{ +namespace search::fakedata { static FPFactoryInit init(std::make_pair("MemTreeOcc", @@ -298,7 +293,6 @@ FakeMemTreeOccMgr::compactTrees() itr.begin(); tree.setRoot(itr.moveFirstLeafNode(tree.getRoot()), _allocator); while (itr.valid()) { - // LOG(info, "Leaf moved to %d", UNWRAP(itr.getKey())); itr.moveNextLeafNode(); } } @@ -424,7 +418,4 @@ FakeMemTreeOcc2Factory::setup(const std::vector<const FakeWord *> &fws) LOG(info, "done compacting trees"); } - -} // namespace fakedata - -} // namespace search +} diff --git a/searchlib/src/vespa/searchlib/test/fakedata/fakeposting.cpp b/searchlib/src/vespa/searchlib/test/fakedata/fakeposting.cpp index 3fb5a0991f2..b68fac37fcd 100644 --- a/searchlib/src/vespa/searchlib/test/fakedata/fakeposting.cpp +++ b/searchlib/src/vespa/searchlib/test/fakedata/fakeposting.cpp @@ -1,15 +1,8 @@ // 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(".fakeposting"); #include "fakeposting.h" -namespace search -{ - -namespace fakedata -{ +namespace search::fakedata { FakePosting::FakePosting(const std::string &name) : _name(name) @@ -56,6 +49,4 @@ FakePosting::l4SkipBitSize() const return 0; } -} // namespace fakedata - -} // namespace search +} diff --git a/searchlib/src/vespa/searchlib/test/fakedata/fakeword.cpp b/searchlib/src/vespa/searchlib/test/fakedata/fakeword.cpp index c30d5f2b61f..d28d4e80fd8 100644 --- a/searchlib/src/vespa/searchlib/test/fakedata/fakeword.cpp +++ b/searchlib/src/vespa/searchlib/test/fakedata/fakeword.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(".fakeword"); #include "fakeword.h" #include <vespa/searchlib/index/postinglistfile.h> @@ -609,7 +606,7 @@ FakeWord::validate(std::shared_ptr<FieldReader> &fieldReader, features._wordPositions.begin(); TermFieldMatchData *tfmd = matchData[0]; - LOG_ASSERT(tfmd != 0); + assert(tfmd != 0); tfmd->reset(features._docId); uint32_t elementResidue = features._elements.size(); diff --git a/searchlib/src/vespa/searchlib/test/fakedata/fakewordset.cpp b/searchlib/src/vespa/searchlib/test/fakedata/fakewordset.cpp index 46313066116..9bf87ecac1a 100644 --- a/searchlib/src/vespa/searchlib/test/fakedata/fakewordset.cpp +++ b/searchlib/src/vespa/searchlib/test/fakedata/fakewordset.cpp @@ -1,9 +1,9 @@ // 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 "fakewordset.h" #include "fakeword.h" #include <vespa/searchlib/index/schemautil.h> + #include <vespa/log/log.h> LOG_SETUP(".fakewordset"); diff --git a/searchlib/src/vespa/searchlib/test/fakedata/fakezcbfilterocc.cpp b/searchlib/src/vespa/searchlib/test/fakedata/fakezcbfilterocc.cpp index 20ee2394156..6b1cee01cad 100644 --- a/searchlib/src/vespa/searchlib/test/fakedata/fakezcbfilterocc.cpp +++ b/searchlib/src/vespa/searchlib/test/fakedata/fakezcbfilterocc.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(".fakezcbfilterocc"); #include "fakezcbfilterocc.h" #include <vespa/searchlib/bitcompression/compression.h> #include <vespa/searchlib/bitcompression/posocccompression.h> @@ -12,11 +9,7 @@ LOG_SETUP(".fakezcbfilterocc"); using search::fef::TermFieldMatchData; using search::fef::TermFieldMatchDataPosition; -namespace search -{ - -namespace fakedata -{ +namespace search::fakedata { static FPFactoryInit init(std::make_pair("ZcbFilterOcc", @@ -262,6 +255,4 @@ createIterator(const fef::TermFieldMatchDataArray &matchData) const matchData); } -} // namespace fakedata - -} // namespace search +} diff --git a/searchlib/src/vespa/searchlib/test/fakedata/fpfactory.cpp b/searchlib/src/vespa/searchlib/test/fakedata/fpfactory.cpp index 37820a88a8e..6af2d61f110 100644 --- a/searchlib/src/vespa/searchlib/test/fakedata/fpfactory.cpp +++ b/searchlib/src/vespa/searchlib/test/fakedata/fpfactory.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(".fpfactory"); #include "fakeegcompr64filterocc.h" #include "fakefilterocc.h" #include "fakezcbfilterocc.h" @@ -11,11 +8,7 @@ LOG_SETUP(".fpfactory"); #include "fpfactory.h" #include "fakewordset.h" -namespace search -{ - -namespace fakedata -{ +namespace search::fakedata { using index::Schema; @@ -113,8 +106,6 @@ FPFactoryInit::forceLink() FakeZcbFilterOcc::forceLink(); FakeZcFilterOcc::forceLink(); FakeMemTreeOcc::forceLink(); -}; - -} // namespace fakedata +} -} // namespace search +} diff --git a/searchlib/src/vespa/searchlib/test/statefile.cpp b/searchlib/src/vespa/searchlib/test/statefile.cpp index 005145c5cb3..9779cfa28a4 100644 --- a/searchlib/src/vespa/searchlib/test/statefile.cpp +++ b/searchlib/src/vespa/searchlib/test/statefile.cpp @@ -1,19 +1,11 @@ // 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 "statefile.h" #include <vespa/searchlib/util/statefile.h> #include <iostream> #include <fstream> #include <string> -#include "statefile.h" - -namespace search -{ -namespace test -{ - -namespace statefile -{ +namespace search::test::statefile { vespalib::string readState(StateFile &sf) @@ -23,7 +15,6 @@ readState(StateFile &sf) return vespalib::string(buf.begin(), buf.end()); } - std::vector<vespalib::string> readHistory(const char *name) { @@ -40,9 +31,4 @@ readHistory(const char *name) return res; } - -} - -} - } diff --git a/searchlib/src/vespa/searchlib/test/statefile.h b/searchlib/src/vespa/searchlib/test/statefile.h index a5aee2ff2a3..bc7114c8cf3 100644 --- a/searchlib/src/vespa/searchlib/test/statefile.h +++ b/searchlib/src/vespa/searchlib/test/statefile.h @@ -1,22 +1,18 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. + #include <vespa/vespalib/stllike/string.h> +#include <vector> -namespace search -{ +namespace search { class StateFile; -namespace test -{ - -namespace statefile -{ +namespace test { +namespace statefile { vespalib::string readState(StateFile &sf); std::vector<vespalib::string> readHistory(const char *name); } - -} - } +}
\ No newline at end of file diff --git a/searchlib/src/vespa/searchlib/test/statestring.cpp b/searchlib/src/vespa/searchlib/test/statestring.cpp index e1c8df43c4b..0fb08415434 100644 --- a/searchlib/src/vespa/searchlib/test/statestring.cpp +++ b/searchlib/src/vespa/searchlib/test/statestring.cpp @@ -1,16 +1,8 @@ // 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 <sstream> #include "statestring.h" +#include <sstream> -namespace search -{ - -namespace test -{ - -namespace statestring -{ +namespace search::test::statestring { bool testStartPos(vespalib::string &s, size_t pos) @@ -18,7 +10,6 @@ testStartPos(vespalib::string &s, size_t pos) return (pos < s.size() && (pos == 0 || s[pos - 1] == ' ')); } - size_t findStartPos(vespalib::string &s, const vespalib::string &key) { @@ -33,7 +24,6 @@ findStartPos(vespalib::string &s, const vespalib::string &key) return pos; } - size_t scanBreakPos(vespalib::string &s, size_t pos) { @@ -43,7 +33,6 @@ scanBreakPos(vespalib::string &s, size_t pos) return pos; } - void normalizeTimestamp(vespalib::string &s) { @@ -55,7 +44,6 @@ normalizeTimestamp(vespalib::string &s) } } - void normalizeAddr(vespalib::string &s, void *addr) { @@ -72,7 +60,6 @@ normalizeAddr(vespalib::string &s, void *addr) } } - void normalizeTimestamps(std::vector<vespalib::string> &sv) { @@ -81,7 +68,6 @@ normalizeTimestamps(std::vector<vespalib::string> &sv) } } - void normalizeAddrs(std::vector<vespalib::string> &sv, void *addr) { @@ -90,9 +76,4 @@ normalizeAddrs(std::vector<vespalib::string> &sv, void *addr) } } - -} - -} - } diff --git a/searchlib/src/vespa/searchlib/test/statestring.h b/searchlib/src/vespa/searchlib/test/statestring.h index ad5d70186dc..7fb6f1fce85 100644 --- a/searchlib/src/vespa/searchlib/test/statestring.h +++ b/searchlib/src/vespa/searchlib/test/statestring.h @@ -1,24 +1,13 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/vespalib/stllike/string.h> - -namespace search -{ -namespace test -{ +#include <vespa/vespalib/stllike/string.h> +#include <vector> -namespace statestring -{ +namespace search::test::statestring { void normalizeTimestamp(vespalib::string &s); void normalizeAddr(vespalib::string &s, void *addr); void normalizeTimestamps(std::vector<vespalib::string> &sv); void normalizeAddrs(std::vector<vespalib::string> &sv, void *addr); -} - -} - -} - - +}
\ No newline at end of file diff --git a/searchlib/src/vespa/searchlib/util/bufferwriter.cpp b/searchlib/src/vespa/searchlib/util/bufferwriter.cpp index 21e1d16a079..af27001aba3 100644 --- a/searchlib/src/vespa/searchlib/util/bufferwriter.cpp +++ b/searchlib/src/vespa/searchlib/util/bufferwriter.cpp @@ -1,10 +1,8 @@ // 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 "bufferwriter.h" -namespace search -{ +namespace search { BufferWriter::BufferWriter() : _cur(nullptr), diff --git a/searchlib/src/vespa/searchlib/util/bufferwriter.h b/searchlib/src/vespa/searchlib/util/bufferwriter.h index b4183f779ed..f0a0557da67 100644 --- a/searchlib/src/vespa/searchlib/util/bufferwriter.h +++ b/searchlib/src/vespa/searchlib/util/bufferwriter.h @@ -2,8 +2,9 @@ #pragma once -namespace search -{ +#include <cstddef> + +namespace search { /** * Abstract class to write to a buffer with an abstract backing store diff --git a/searchlib/src/vespa/searchlib/util/comprfile.cpp b/searchlib/src/vespa/searchlib/util/comprfile.cpp index 7078ac3764b..d0b78e6bdd0 100644 --- a/searchlib/src/vespa/searchlib/util/comprfile.cpp +++ b/searchlib/src/vespa/searchlib/util/comprfile.cpp @@ -2,16 +2,12 @@ // Copyright (C) 2002-2003 Fast Search & Transfer ASA // Copyright (C) 2003 Overture Services Norway AS -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -#include <vespa/searchlib/util/comprbuffer.h> -#include <vespa/searchlib/util/comprfile.h> +#include "comprfile.h" #include <vespa/vespalib/objects/nbostream.h> +#include <vespa/fastos/file.h> +#include <cassert> -LOG_SETUP(".comprbuffer"); - -namespace search -{ +namespace search { using vespalib::nbostream; diff --git a/searchlib/src/vespa/searchlib/util/dirtraverse.cpp b/searchlib/src/vespa/searchlib/util/dirtraverse.cpp index 3c021174979..c5260c7f454 100644 --- a/searchlib/src/vespa/searchlib/util/dirtraverse.cpp +++ b/searchlib/src/vespa/searchlib/util/dirtraverse.cpp @@ -2,11 +2,11 @@ // Copyright (C) 2002-2003 Fast Search & Transfer ASA // Copyright (C) 2003 Overture Services Norway AS -#include <vespa/fastos/fastos.h> #include "dirtraverse.h" +#include <vespa/fastos/file.h> +#include <cassert> -namespace search -{ +namespace search { extern "C" { static int cmpname(const void *av, const void *bv) @@ -19,10 +19,16 @@ static int cmpname(const void *av, const void *bv) } } +DirectoryTraverse::Name::Name(const char *name) + : _name(nullptr), + _next(nullptr) +{ + _name = strdup(name); +} +DirectoryTraverse::Name::~Name() { free(_name); } DirectoryTraverse::Name * -DirectoryTraverse::Name::sort(Name *head, - int count) +DirectoryTraverse::Name::sort(Name *head, int count) { Name *nl; Name **names; @@ -30,7 +36,7 @@ DirectoryTraverse::Name::sort(Name *head, names = new Name *[count]; i = 0; - for(nl = head; nl != NULL; nl = nl->_next) + for(nl = head; nl != nullptr; nl = nl->_next) names[i++] = nl; assert(i == count); qsort(names, count, sizeof(Name *), cmpname); @@ -38,7 +44,7 @@ DirectoryTraverse::Name::sort(Name *head, if (i + 1 < count) names[i]->_next = names[i + 1]; else - names[i]->_next = NULL; + names[i]->_next = nullptr; } head = names[0]; delete [] names; @@ -50,7 +56,7 @@ void DirectoryTraverse::QueueDir(const char *name) { Name *n = new Name(name); - if (_dirTail == NULL) + if (_dirTail == nullptr) _dirHead = n; else _dirTail->_next = n; @@ -80,12 +86,12 @@ void DirectoryTraverse::PushPushedDirs() { Name *n; - while (_pdirHead != NULL) { + while (_pdirHead != nullptr) { n = _pdirHead; _pdirHead = n->_next; n->_next = _dirHead; _dirHead = n; - if (_dirTail == NULL) + if (_dirTail == nullptr) _dirTail = n; } } @@ -96,13 +102,13 @@ DirectoryTraverse::UnQueueDir() { Name *n; PushPushedDirs(); - if (_dirHead == NULL) - return NULL; + if (_dirHead == nullptr) + return nullptr; n = _dirHead; _dirHead = n->_next; - n->_next = NULL; - if (_dirHead == NULL) - _dirTail = NULL; + n->_next = nullptr; + if (_dirHead == nullptr) + _dirTail = nullptr; return n; } @@ -110,11 +116,11 @@ DirectoryTraverse::Name * DirectoryTraverse::UnQueueName() { Name *n; - if (_nameHead == NULL) - return NULL; + if (_nameHead == nullptr) + return nullptr; n = _nameHead; _nameHead = n->_next; - n->_next = NULL; + n->_next = nullptr; _nameCount--; return n; } @@ -123,13 +129,13 @@ DirectoryTraverse::UnQueueName() void DirectoryTraverse::ScanSingleDir() { - assert(_nameHead == NULL); + assert(_nameHead == nullptr); assert(_nameCount == 0); delete _curDir; free(_fullDirName); - _fullDirName = NULL; + _fullDirName = nullptr; _curDir = UnQueueDir(); - if (_curDir == NULL) + if (_curDir == nullptr) return; _fullDirName = (char *) malloc(strlen(_baseDir) + 1 + strlen(_curDir->_name) + 1); @@ -159,10 +165,10 @@ bool DirectoryTraverse::NextName() { delete _curName; - _curName = NULL; - while (_nameHead == NULL && (_dirHead != NULL || _pdirHead != NULL)) + _curName = nullptr; + while (_nameHead == nullptr && (_dirHead != nullptr || _pdirHead != nullptr)) ScanSingleDir(); - if (_nameHead == NULL) + if (_nameHead == nullptr) return false; _curName = UnQueueName(); free(_fullName); @@ -182,8 +188,8 @@ DirectoryTraverse::NextRemoveDir() Name *curName; delete _curName; - _curName = NULL; - if (_rdirHead == NULL) + _curName = nullptr; + if (_rdirHead == nullptr) return false; curName = _rdirHead; _rdirHead = curName->_next; @@ -246,18 +252,18 @@ DirectoryTraverse::GetTreeSize() } DirectoryTraverse::DirectoryTraverse(const char *baseDir) - : _baseDir(NULL), - _nameHead(NULL), + : _baseDir(nullptr), + _nameHead(nullptr), _nameCount(0), - _dirHead(NULL), - _dirTail(NULL), - _pdirHead(NULL), - _rdirHead(NULL), - _curDir(NULL), - _curName(NULL), - _fullDirName(NULL), - _fullName(NULL), - _relName(NULL) + _dirHead(nullptr), + _dirTail(nullptr), + _pdirHead(nullptr), + _rdirHead(nullptr), + _curDir(nullptr), + _curName(nullptr), + _fullDirName(nullptr), + _fullName(nullptr), + _relName(nullptr) { _baseDir = strdup(baseDir); QueueDir(""); @@ -273,15 +279,15 @@ DirectoryTraverse::~DirectoryTraverse() delete _curDir; delete _curName; PushPushedDirs(); - while (_dirHead != NULL) + while (_dirHead != nullptr) delete UnQueueDir(); - while (_nameHead != NULL) + while (_nameHead != nullptr) delete UnQueueName(); - while (_rdirHead != NULL) { + while (_rdirHead != nullptr) { Name *n; n = _rdirHead; _rdirHead = n->_next; - n->_next = NULL; + n->_next = nullptr; delete n; } } diff --git a/searchlib/src/vespa/searchlib/util/dirtraverse.h b/searchlib/src/vespa/searchlib/util/dirtraverse.h index a9ce8c5f635..127e1202762 100644 --- a/searchlib/src/vespa/searchlib/util/dirtraverse.h +++ b/searchlib/src/vespa/searchlib/util/dirtraverse.h @@ -4,8 +4,9 @@ #pragma once -namespace search -{ +#include <cstdint> + +namespace search { class DirectoryTraverse { @@ -23,13 +24,8 @@ public: public: char *_name; Name *_next; - explicit Name(const char *name) - : _name(NULL), - _next(NULL) - { - _name = strdup(name); - } - ~Name() { free(_name); } + explicit Name(const char *name); + ~Name(); static Name *sort(Name *head, int count); }; private: @@ -63,5 +59,4 @@ public: ~DirectoryTraverse(); }; -} // namespace search - +} // namespace search
\ No newline at end of file diff --git a/searchlib/src/vespa/searchlib/util/drainingbufferwriter.cpp b/searchlib/src/vespa/searchlib/util/drainingbufferwriter.cpp index 9c1150917a7..db721f5e9b6 100644 --- a/searchlib/src/vespa/searchlib/util/drainingbufferwriter.cpp +++ b/searchlib/src/vespa/searchlib/util/drainingbufferwriter.cpp @@ -1,10 +1,9 @@ // 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 "drainingbufferwriter.h" +#include <cassert> -namespace search -{ +namespace search { DrainingBufferWriter::DrainingBufferWriter() : BufferWriter(), diff --git a/searchlib/src/vespa/searchlib/util/drainingbufferwriter.h b/searchlib/src/vespa/searchlib/util/drainingbufferwriter.h index 2c471ce2148..e02c30c7ca8 100644 --- a/searchlib/src/vespa/searchlib/util/drainingbufferwriter.h +++ b/searchlib/src/vespa/searchlib/util/drainingbufferwriter.h @@ -4,9 +4,9 @@ #include "bufferwriter.h" #include <vector> +#include <cstdint> -namespace search -{ +namespace search { /** * Class to write to a "drain" buffer, used to measure performance of @@ -21,11 +21,8 @@ public: static constexpr size_t BUFFER_SIZE = 262144; DrainingBufferWriter(); - - virtual ~DrainingBufferWriter(); - - virtual void flush() override; - + ~DrainingBufferWriter() override; + void flush() override; size_t getBytesWritten() const { return _bytesWritten; } }; diff --git a/searchlib/src/vespa/searchlib/util/fileheadertk.cpp b/searchlib/src/vespa/searchlib/util/fileheadertk.cpp index 6451df32b69..fbaf5712a29 100644 --- a/searchlib/src/vespa/searchlib/util/fileheadertk.cpp +++ b/searchlib/src/vespa/searchlib/util/fileheadertk.cpp @@ -1,7 +1,7 @@ // 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/vespalib/component/vtag.h> + #include "fileheadertk.h" +#include <vespa/vespalib/component/vtag.h> using namespace search; using vespalib::GenericHeader; diff --git a/searchlib/src/vespa/searchlib/util/filekit.cpp b/searchlib/src/vespa/searchlib/util/filekit.cpp index df509f2ea96..c5b35f92f0c 100644 --- a/searchlib/src/vespa/searchlib/util/filekit.cpp +++ b/searchlib/src/vespa/searchlib/util/filekit.cpp @@ -2,16 +2,14 @@ // Copyright (C) 1998-2003 Fast Search & Transfer ASA // Copyright (C) 2003 Overture Services Norway AS -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> #include <vespa/searchlib/util/filekit.h> #include <vespa/vespalib/util/error.h> -#include <memory> -#include <string> +#include <vespa/fastos/file.h> + +#include <vespa/log/log.h> LOG_SETUP(".filekit"); -namespace search -{ +namespace search { using vespalib::getLastErrorString; diff --git a/searchlib/src/vespa/searchlib/util/filekit.h b/searchlib/src/vespa/searchlib/util/filekit.h index fb2332529d4..cda6356939c 100644 --- a/searchlib/src/vespa/searchlib/util/filekit.h +++ b/searchlib/src/vespa/searchlib/util/filekit.h @@ -5,6 +5,7 @@ #pragma once #include <vespa/vespalib/stllike/string.h> +#include <vespa/fastos/timestamp.h> namespace search { @@ -13,23 +14,15 @@ class FileKit private: static bool _syncFiles; public: - static bool - createStamp(const vespalib::stringref &name); - - static bool - hasStamp(const vespalib::stringref &name); - - static bool - removeStamp(const vespalib::stringref &name); + static bool createStamp(const vespalib::stringref &name); + static bool hasStamp(const vespalib::stringref &name); + static bool removeStamp(const vespalib::stringref &name); /** * Returns the modification time of the given file/directory, * or time stamp 0 if stating of file/directory fails. **/ - static fastos::TimeStamp - getModificationTime(const vespalib::stringref &name); - + static fastos::TimeStamp getModificationTime(const vespalib::stringref &name); }; -} - +}
\ No newline at end of file diff --git a/searchlib/src/vespa/searchlib/util/filesizecalculator.cpp b/searchlib/src/vespa/searchlib/util/filesizecalculator.cpp index 4ae53c03430..342ccb0104e 100644 --- a/searchlib/src/vespa/searchlib/util/filesizecalculator.cpp +++ b/searchlib/src/vespa/searchlib/util/filesizecalculator.cpp @@ -1,14 +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 "filesizecalculator.h" +#include <vespa/vespalib/data/fileheader.h> #include <vespa/log/log.h> LOG_SETUP(".searchlib.util.filesizecalculator"); -#include "filesizecalculator.h" -#include <vespa/vespalib/data/fileheader.h> -namespace search -{ +namespace search { namespace { diff --git a/searchlib/src/vespa/searchlib/util/foldedstringcompare.cpp b/searchlib/src/vespa/searchlib/util/foldedstringcompare.cpp index ac63d1a7a64..068e58e0591 100644 --- a/searchlib/src/vespa/searchlib/util/foldedstringcompare.cpp +++ b/searchlib/src/vespa/searchlib/util/foldedstringcompare.cpp @@ -1,6 +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 "foldedstringcompare.h" #include <vespa/vespalib/text/utf8.h> #include <vespa/vespalib/text/lowercase.h> diff --git a/searchlib/src/vespa/searchlib/util/foldedstringcompare.h b/searchlib/src/vespa/searchlib/util/foldedstringcompare.h index 7b05ce9bcd8..4e1449ca4eb 100644 --- a/searchlib/src/vespa/searchlib/util/foldedstringcompare.h +++ b/searchlib/src/vespa/searchlib/util/foldedstringcompare.h @@ -2,7 +2,7 @@ #pragma once - +#include <cstddef> namespace search { @@ -53,5 +53,4 @@ public: int compare(const char *key, const char *okey) const; }; -} // namespace search - +} // namespace search
\ No newline at end of file diff --git a/searchlib/src/vespa/searchlib/util/ioerrorhandler.cpp b/searchlib/src/vespa/searchlib/util/ioerrorhandler.cpp index 394ee2403ec..23fa3529599 100644 --- a/searchlib/src/vespa/searchlib/util/ioerrorhandler.cpp +++ b/searchlib/src/vespa/searchlib/util/ioerrorhandler.cpp @@ -1,19 +1,15 @@ // 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 "ioerrorhandler.h" #include "statebuf.h" #include "statefile.h" -#include <atomic> - -namespace search -{ +#include <vespa/fastos/file.h> +namespace search { IOErrorHandler *IOErrorHandler::_instance = nullptr; -namespace -{ +namespace { std::atomic<int> nesting; diff --git a/searchlib/src/vespa/searchlib/util/ioerrorhandler.h b/searchlib/src/vespa/searchlib/util/ioerrorhandler.h index acdc0d12282..1feb0045c4f 100644 --- a/searchlib/src/vespa/searchlib/util/ioerrorhandler.h +++ b/searchlib/src/vespa/searchlib/util/ioerrorhandler.h @@ -2,8 +2,11 @@ #pragma once -namespace search -{ +#include <cstdint> +#include <cstddef> +#include <sys/types.h> + +namespace search { class StateFile; @@ -17,44 +20,22 @@ class IOErrorHandler bool _trapped; bool _fired; - using FailedHandler = void (*)(const char *op, - const char *file, - int error, - int64_t offset, - size_t len, - ssize_t rlen); - void - trap(); - - void - untrap(); - - static void - forward(const char *op, - const char *file, - int error, - int64_t offset, - size_t len, - ssize_t rlen); - - void - handle(const char *op, - const char *file, - int error, - int64_t offset, - size_t len, - ssize_t rlen); + using FailedHandler = void (*)(const char *op, const char *file, int error, + int64_t offset, size_t len, ssize_t rlen); + void trap(); + void untrap(); + + static void forward(const char *op, const char *file, int error, + int64_t offset, size_t len, ssize_t rlen); + + void handle(const char *op, const char *file, int error, + int64_t offset, size_t len, ssize_t rlen); public: IOErrorHandler(StateFile *stateFile); - ~IOErrorHandler(); - bool - fired() const - { - return _fired; - } + bool fired() const { return _fired; } }; diff --git a/searchlib/src/vespa/searchlib/util/logutil.cpp b/searchlib/src/vespa/searchlib/util/logutil.cpp index f8dd7120aac..db51fe8a155 100644 --- a/searchlib/src/vespa/searchlib/util/logutil.cpp +++ b/searchlib/src/vespa/searchlib/util/logutil.cpp @@ -1,7 +1,4 @@ // 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(".searchlib.util.logutil"); #include "logutil.h" #include <vespa/searchlib/util/dirtraverse.h> diff --git a/searchlib/src/vespa/searchlib/util/rawbuf.cpp b/searchlib/src/vespa/searchlib/util/rawbuf.cpp index 2f8b279aac1..4954c9b3955 100644 --- a/searchlib/src/vespa/searchlib/util/rawbuf.cpp +++ b/searchlib/src/vespa/searchlib/util/rawbuf.cpp @@ -2,21 +2,21 @@ // Copyright (C) 1998-2003 Fast Search & Transfer ASA // Copyright (C) 2003 Overture Services Norway AS - -#include <vespa/fastos/fastos.h> -#include <vespa/searchlib/util/rawbuf.h> +#include "rawbuf.h" #include <vespa/vespalib/util/compress.h> +#include <vespa/fastos/file.h> +#include <cassert> namespace search { static inline size_t smin(size_t a, size_t b) { return (a < b) ? a : b; } RawBuf::RawBuf(size_t size) - : _bufStart(NULL), - _bufEnd(NULL), - _bufFillPos(NULL), - _bufDrainPos(NULL), - _initialBufStart(NULL), + : _bufStart(nullptr), + _bufEnd(nullptr), + _bufFillPos(nullptr), + _bufDrainPos(nullptr), + _initialBufStart(nullptr), _initialSize(size) { if (size > 0) { @@ -28,10 +28,10 @@ RawBuf::RawBuf(size_t size) RawBuf::RawBuf(char *start, size_t size) - : _bufStart(NULL), - _bufEnd(NULL), - _bufFillPos(NULL), - _bufDrainPos(NULL), + : _bufStart(nullptr), + _bufEnd(nullptr), + _bufFillPos(nullptr), + _bufDrainPos(nullptr), _initialBufStart(start), _initialSize(size) { @@ -176,13 +176,13 @@ RawBuf::Reuse() if (static_cast<size_t>(_bufEnd - _bufStart) > _initialSize * 4) { free(_bufStart); if (_initialSize > 0) { - if (_initialBufStart != NULL) + if (_initialBufStart != nullptr) _bufStart = _initialBufStart; else _bufStart = static_cast<char *>(malloc(_initialSize)); - assert(_bufStart != NULL); + assert(_bufStart != nullptr); } else - _bufStart = NULL; + _bufStart = nullptr; _bufEnd = _bufStart + _initialSize; } _bufDrainPos = _bufFillPos = _bufStart; @@ -357,4 +357,10 @@ RawBuf::readFile(FastOS_FileInterface &file, size_t maxlen) return got; } +void +RawBuf::ensureSizeInternal(size_t size) { + expandBuf(size); + assert(static_cast<size_t>(_bufEnd - _bufFillPos) >= size); +} + } diff --git a/searchlib/src/vespa/searchlib/util/rawbuf.h b/searchlib/src/vespa/searchlib/util/rawbuf.h index cffb5909075..03378665189 100644 --- a/searchlib/src/vespa/searchlib/util/rawbuf.h +++ b/searchlib/src/vespa/searchlib/util/rawbuf.h @@ -5,8 +5,7 @@ #pragma once #include <vespa/searchlib/common/hitrank.h> -#include <stdint.h> -#include <assert.h> +#include <cstdint> #include <sys/types.h> class FastOS_FileInterface; @@ -31,6 +30,8 @@ private: char* _bufDrainPos; // ref. to next byte to take out of buffer char* _initialBufStart; size_t _initialSize; + + void ensureSizeInternal(size_t size); public: RawBuf(char *start, size_t size);// Initially use provided buffer @@ -74,8 +75,7 @@ public: void ensureSize(size_t size) { if (static_cast<size_t>(_bufEnd - _bufFillPos) < size) { - expandBuf(size); - assert(static_cast<size_t>(_bufEnd - _bufFillPos) >= size); + ensureSizeInternal(size); } } @@ -144,4 +144,3 @@ public: }; } - diff --git a/searchlib/src/vespa/searchlib/util/sigbushandler.cpp b/searchlib/src/vespa/searchlib/util/sigbushandler.cpp index 3acbafb7ba8..ed3a114a426 100644 --- a/searchlib/src/vespa/searchlib/util/sigbushandler.cpp +++ b/searchlib/src/vespa/searchlib/util/sigbushandler.cpp @@ -1,23 +1,16 @@ // 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 "sigbushandler.h" #include "statefile.h" #include "statebuf.h" -#include "sigbushandler.h" -#include <setjmp.h> -#include <system_error> -#include <mutex> -#include <atomic> - -namespace search -{ +#include <unistd.h> +#include <cstring> +namespace search { SigBusHandler *SigBusHandler::_instance = nullptr; - -namespace -{ +namespace { std::atomic<int> sigBusNesting; @@ -32,18 +25,13 @@ public: _gotLock = sigBusNesting.compare_exchange_strong(expzero, 1); } - ~TryLockGuard() noexcept - { + ~TryLockGuard() noexcept { if (_gotLock) { sigBusNesting = 0; } } - bool - gotLock() const noexcept - { - return _gotLock; - } + bool gotLock() const noexcept { return _gotLock; } }; @@ -158,11 +146,9 @@ SigBusHandler::SigBusHandler(StateFile *stateFile) trap(); } - SigBusHandler::~SigBusHandler() { untrap(); } - -} +}
\ No newline at end of file diff --git a/searchlib/src/vespa/searchlib/util/sigbushandler.h b/searchlib/src/vespa/searchlib/util/sigbushandler.h index 49c7879b10a..b41cc0d606b 100644 --- a/searchlib/src/vespa/searchlib/util/sigbushandler.h +++ b/searchlib/src/vespa/searchlib/util/sigbushandler.h @@ -2,10 +2,10 @@ #pragma once -#include <setjmp.h> +#include <csetjmp> +#include <csignal> -namespace search -{ +namespace search { class StateFile; @@ -22,39 +22,20 @@ class SigBusHandler bool _fired; char _buf[2048]; - void - trap(); - - void - untrap(); - - static void - forward(int sig, siginfo_t *si, void *ucv); - - void - handle(int sig, siginfo_t *si, void *ucv); - + void trap(); + void untrap(); + static void forward(int sig, siginfo_t *si, void *ucv); + void handle(int sig, siginfo_t *si, void *ucv); public: SigBusHandler(StateFile *stateFile); - ~SigBusHandler(); - bool - fired() const - { - return _fired; - } + bool fired() const { return _fired; } /* * Setup siglongjmp based unwinding, used by unit tests. */ - void - setUnwind(sigjmp_buf *unwind) - { - _unwind = unwind; - } + void setUnwind(sigjmp_buf *unwind) { _unwind = unwind; } }; - } - diff --git a/searchlib/src/vespa/searchlib/util/slime_output_raw_buf_adapter.cpp b/searchlib/src/vespa/searchlib/util/slime_output_raw_buf_adapter.cpp index c86303e5a97..0f1648d7f67 100644 --- a/searchlib/src/vespa/searchlib/util/slime_output_raw_buf_adapter.cpp +++ b/searchlib/src/vespa/searchlib/util/slime_output_raw_buf_adapter.cpp @@ -1,6 +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 "slime_output_raw_buf_adapter.h" namespace search { diff --git a/searchlib/src/vespa/searchlib/util/statebuf.cpp b/searchlib/src/vespa/searchlib/util/statebuf.cpp index 69021f3b5f5..2a0f6e1db4a 100644 --- a/searchlib/src/vespa/searchlib/util/statebuf.cpp +++ b/searchlib/src/vespa/searchlib/util/statebuf.cpp @@ -1,12 +1,10 @@ // 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 "statebuf.h" static const char *hexx = "0123456789abcdef"; -namespace search -{ +namespace search { void StateBuf::overflow() noexcept diff --git a/searchlib/src/vespa/searchlib/util/statefile.cpp b/searchlib/src/vespa/searchlib/util/statefile.cpp index d093a036f19..a01004ef914 100644 --- a/searchlib/src/vespa/searchlib/util/statefile.cpp +++ b/searchlib/src/vespa/searchlib/util/statefile.cpp @@ -1,18 +1,19 @@ // 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 "statefile.h" +#include <vespa/vespalib/util/stringfmt.h> #include <system_error> #include <mutex> +#include <unistd.h> +#include <fcntl.h> +#include <sys/stat.h> using Mutex = std::mutex; using Guard = std::lock_guard<Mutex>; -namespace search -{ +namespace search { -namespace -{ +namespace { Mutex stateMutex; @@ -456,5 +457,4 @@ StateFile::getGen() const return _gen; } - -} +}
\ No newline at end of file diff --git a/searchlib/src/vespa/searchlib/util/statefile.h b/searchlib/src/vespa/searchlib/util/statefile.h index f05e4363656..95789c0b1bc 100644 --- a/searchlib/src/vespa/searchlib/util/statefile.h +++ b/searchlib/src/vespa/searchlib/util/statefile.h @@ -4,9 +4,9 @@ #include <string> #include <atomic> +#include <vector> -namespace search -{ +namespace search { /* * Class used to store application state in a mostly safe manner. @@ -30,27 +30,23 @@ class StateFile /* * Zero pad file, to ensure that a later write won't run out of space. */ - void - zeroPad(); + void zeroPad(); /* * Read state file to buffer in raw form, including padding. */ - void - readRawState(std::vector<char> &buf); + void readRawState(std::vector<char> &buf); /* * Trim padding and everything after state (i.e. stop at first newline). */ - static void - trimState(std::vector<char> &buf); + static void trimState(std::vector<char> &buf); /* * Trim partial state from end of history. */ - static void - trimHistory(std::vector<char> &history, const char *historyName, int hfd, - std::vector<char> &lastHistoryState); + static void trimHistory(std::vector<char> &history, const char *historyName, int hfd, + std::vector<char> &lastHistoryState); /* * Fixup history: trim partial state from end and append current state @@ -58,49 +54,36 @@ class StateFile * If main state file doesn't have a state but history has a state then * restore main state from history. */ - void - fixupHistory(); + void fixupHistory(); /* * Check that state doesn't contain nul bytes or early newline and * that it is terminated by a newline at end. */ - void - checkState(const char *buf, size_t bufLen) noexcept; - - void - internalAddSignalState(const char *buf, size_t bufLen, - const char *name, - int appendFlag, - const char *openerr, - const char *writeerr, - const char *fsyncerr, - const char *closeerr) noexcept; - - void - addSignalState(const char *buf, size_t bufLen) noexcept; + void checkState(const char *buf, size_t bufLen) noexcept; + + void internalAddSignalState(const char *buf, size_t bufLen, const char *name, int appendFlag, + const char *openerr, const char *writeerr, const char *fsyncerr, + const char *closeerr) noexcept; + + void addSignalState(const char *buf, size_t bufLen) noexcept; public: StateFile(const std::string &name); - ~StateFile(); - void - addState(const char *buf, size_t bufLen, bool signal); + void addState(const char *buf, size_t bufLen, bool signal); - static void - erase(const std::string &name); + static void erase(const std::string &name); /* * Read state file to buffer and trim it down to a state. */ - void - readState(std::vector<char> &buf); + void readState(std::vector<char> &buf); /* * Get current state generation (bumped whenever new state is written). */ - int - getGen() const; + int getGen() const; }; } diff --git a/searchlib/src/vespa/searchlib/util/url.cpp b/searchlib/src/vespa/searchlib/util/url.cpp index d3e1d99bc1c..fe000ac2d1f 100644 --- a/searchlib/src/vespa/searchlib/util/url.cpp +++ b/searchlib/src/vespa/searchlib/util/url.cpp @@ -2,20 +2,13 @@ // Copyright (C) 2000-2003 Fast Search & Transfer ASA // Copyright (C) 2003 Overture Services Norway AS -/* - * Note for bugs / fixes: - * Please update fastserver4/test/regress/url/testurl.cpp - * with test for new url's when bugs are discovered/fixed. - */ +#include "url.h" -#include <vespa/fastos/fastos.h> #include <vespa/log/log.h> -#include <vespa/searchlib/util/url.h> - LOG_SETUP(".searchlib.util.url"); -namespace search { -namespace util { +namespace search::util { + bool URL::IsAlphaChar(unsigned char c) // According to RFC2396 { @@ -189,7 +182,7 @@ URL::URL(const unsigned char *url, size_t len) : _gotCompleteURL(false) { Reset(); - if (url != NULL) + if (url != nullptr) SetURL(url, len); } @@ -303,7 +296,7 @@ URL::SetURL(const unsigned char *url, size_t length) // Locate main-tld info. ptmp = reinterpret_cast<unsigned char *> (strrchr(reinterpret_cast<char *>(_host), '.')); - if (ptmp != NULL) { + if (ptmp != nullptr) { _maintld = &ptmp[1]; _startMainTld = _startHost + (_maintld - _host); if (*_tld == '\0') { @@ -315,7 +308,7 @@ URL::SetURL(const unsigned char *url, size_t length) if (_siteowner[0] == '\0') { pso = reinterpret_cast<unsigned char *> (strrchr(reinterpret_cast<char *>(_host), '.')); - if (pso != NULL && pso > _host) { + if (pso != nullptr && pso > _host) { pso--; solen = 0; while (pso > _host && *pso != '.') { @@ -367,7 +360,7 @@ URL::SetURL(const unsigned char *url, size_t length) extension = reinterpret_cast<unsigned char *> (strrchr(reinterpret_cast<char *>(_filename), '.')); - if (extension != NULL) { + if (extension != nullptr) { extension++; strcpy(reinterpret_cast<char *>(_extension), reinterpret_cast<char *>(extension)); @@ -376,7 +369,7 @@ URL::SetURL(const unsigned char *url, size_t length) // Parse params part. if ((ptmp = reinterpret_cast<unsigned char *> - (strchr(reinterpret_cast<char *>(_path), ';'))) != NULL) { + (strchr(reinterpret_cast<char *>(_path), ';'))) != nullptr) { ptmp++; _startParams = _startPath + (ptmp - _path); ParseURLPart<IsParamsChar>(ptmp, _params, sizeof(_params)); @@ -457,7 +450,7 @@ URL::GetToken(URL_CONTEXT &ctx) if (_token[0] != '\0') return _token; else - return NULL; + return nullptr; } const char * @@ -546,10 +539,9 @@ URL::Dump() const unsigned char *token; URL_CONTEXT ctx; - while ((token = GetToken(ctx)) != NULL) { + while ((token = GetToken(ctx)) != nullptr) { printf("TOKEN: %s '%s'\n", ContextName(ctx), token); } } -} -} +}
\ No newline at end of file diff --git a/searchlib/src/vespa/searchlib/util/url.h b/searchlib/src/vespa/searchlib/util/url.h index 71c8e16ef52..88a4ef6d9f7 100644 --- a/searchlib/src/vespa/searchlib/util/url.h +++ b/searchlib/src/vespa/searchlib/util/url.h @@ -24,8 +24,9 @@ * roughly 40kB / instance. */ -namespace search { -namespace util { +#include <cstddef> + +namespace search::util { class URL { @@ -252,8 +253,8 @@ public: /** * Get tokens with corresponding context information from the current url. * The first call to this function will return the first token in the url. - * This function may be called repetedly untill the value NULL is returned. - * @return Pointer to string containing the token, NULL when all tokens have + * This function may be called repetedly untill the value nullptr is returned. + * @return Pointer to string containing the token, nullptr when all tokens have * been returned. */ const unsigned char *GetToken(URL_CONTEXT &ctx); @@ -271,7 +272,4 @@ public: void Dump(); }; -} -} - - +}
\ No newline at end of file diff --git a/searchsummary/src/vespa/searchsummary/docsummary/docsumformat.cpp b/searchsummary/src/vespa/searchsummary/docsummary/docsumformat.cpp index f964eafb2c9..5e6f2ffb3d9 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/docsumformat.cpp +++ b/searchsummary/src/vespa/searchsummary/docsummary/docsumformat.cpp @@ -1,9 +1,9 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "docsumformat.h" +#include <cassert> -namespace search { -namespace docsummary { +namespace search::docsummary { size_t DocsumFormat::addByte(search::RawBuf &target, uint8_t value) @@ -98,5 +98,4 @@ DocsumFormat::addEmpty(ResType type, search::RawBuf &target) return 0; } -} // namespace docsummary -} // namespace search +}
\ No newline at end of file diff --git a/searchsummary/src/vespa/searchsummary/docsummary/keywordextractor.cpp b/searchsummary/src/vespa/searchsummary/docsummary/keywordextractor.cpp index 5b38a00fa3b..4b7e3c49cf5 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/keywordextractor.cpp +++ b/searchsummary/src/vespa/searchsummary/docsummary/keywordextractor.cpp @@ -41,6 +41,28 @@ KeywordExtractor::~KeywordExtractor() } } +KeywordExtractor::IndexPrefix::IndexPrefix(const char *prefix, IndexPrefix **list) + : _prefix(NULL), + _prefixLen(0), + _next(NULL) +{ + _prefix = strdup(prefix); + assert(_prefix != NULL); + _prefixLen = strlen(prefix); + _next = *list; + *list = this; +} + +KeywordExtractor::IndexPrefix::~IndexPrefix() +{ + free(_prefix); +} + +bool +KeywordExtractor::IndexPrefix::Match(const char *idxName) const +{ + return (strncmp(idxName, _prefix, _prefixLen) == 0); +} void KeywordExtractor::AddLegalIndexSpec(const char *spec) diff --git a/searchsummary/src/vespa/searchsummary/docsummary/keywordextractor.h b/searchsummary/src/vespa/searchsummary/docsummary/keywordextractor.h index a276b5bf38a..5ee598d98d9 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/keywordextractor.h +++ b/searchsummary/src/vespa/searchsummary/docsummary/keywordextractor.h @@ -31,29 +31,9 @@ public: int _prefixLen; IndexPrefix *_next; - - IndexPrefix(const char *prefix, - IndexPrefix **list) - : _prefix(NULL), - _prefixLen(0), - _next(NULL) - { - _prefix = strdup(prefix); - assert(_prefix != NULL); - _prefixLen = strlen(prefix); - _next = *list; - *list = this; - } - - ~IndexPrefix() - { - free(_prefix); - } - - bool Match(const char *idxName) const - { - return (strncmp(idxName, _prefix, _prefixLen) == 0); - } + IndexPrefix(const char *prefix, IndexPrefix **list); + ~IndexPrefix(); + bool Match(const char *idxName) const; }; private: diff --git a/searchsummary/src/vespa/searchsummary/docsummary/resultclass.cpp b/searchsummary/src/vespa/searchsummary/docsummary/resultclass.cpp index 9c28861eee6..ba63d2cd6a1 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/resultclass.cpp +++ b/searchsummary/src/vespa/searchsummary/docsummary/resultclass.cpp @@ -1,8 +1,8 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. - #include "resultclass.h" #include "resultconfig.h" +#include <cassert> #include <zlib.h> namespace search { diff --git a/vespalog/src/vespa/log/log.h b/vespalog/src/vespa/log/log.h index a14ff87e1be..6ecd69de792 100644 --- a/vespalog/src/vespa/log/log.h +++ b/vespalog/src/vespa/log/log.h @@ -2,7 +2,7 @@ #pragma once #include <memory> -#include <inttypes.h> +#include <cstdint> #include <sys/types.h> // for pid_t #include <new> // for placement new #include <cstdlib> // for malloc |