summaryrefslogtreecommitdiffstats
path: root/searchcore
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@broadpark.no>2020-06-18 18:11:33 +0200
committerTor Egge <Tor.Egge@broadpark.no>2020-06-19 11:20:22 +0200
commit5c15bc48b16c9c86ffce7f73f3fcb5d3fba0fcd8 (patch)
tree308dcc4a8fd1c40df4c73526e934e6133df17896 /searchcore
parenta74a8703830bb4d8656ea626a085c6966de5c06d (diff)
Wire in nearest neighbor brute force limit.
Diffstat (limited to 'searchcore')
-rw-r--r--searchcore/src/tests/proton/matching/request_context/request_context_test.cpp4
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/match_tools.cpp10
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/requestcontext.cpp12
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/requestcontext.h6
4 files changed, 27 insertions, 5 deletions
diff --git a/searchcore/src/tests/proton/matching/request_context/request_context_test.cpp b/searchcore/src/tests/proton/matching/request_context/request_context_test.cpp
index c3338a973c4..3b54768f223 100644
--- a/searchcore/src/tests/proton/matching/request_context/request_context_test.cpp
+++ b/searchcore/src/tests/proton/matching/request_context/request_context_test.cpp
@@ -3,10 +3,12 @@
#include <vespa/eval/eval/tensor_spec.h>
#include <vespa/eval/tensor/default_tensor_engine.h>
#include <vespa/searchcore/proton/matching/requestcontext.h>
+#include <vespa/searchlib/attribute/attribute_blueprint_params.h>
#include <vespa/searchlib/fef/properties.h>
#include <vespa/vespalib/gtest/gtest.h>
#include <vespa/vespalib/objects/nbostream.h>
+using search::attribute::AttributeBlueprintParams;
using search::attribute::IAttributeContext;
using search::attribute::IAttributeFunctor;
using search::attribute::IAttributeVector;
@@ -45,7 +47,7 @@ public:
_doom(_clock, vespalib::steady_time(), vespalib::steady_time(), false),
_attr_ctx(),
_props(),
- _request_ctx(_doom, _attr_ctx, _props),
+ _request_ctx(_doom, _attr_ctx, _props, AttributeBlueprintParams()),
_query_tensor(DefaultTensorEngine::ref().from_spec(TensorSpec("tensor(x[2])")
.add({{"x", 0}}, 3).add({{"x", 1}}, 5)))
{
diff --git a/searchcore/src/vespa/searchcore/proton/matching/match_tools.cpp b/searchcore/src/vespa/searchcore/proton/matching/match_tools.cpp
index f19b416b92f..fadea4b7962 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/match_tools.cpp
+++ b/searchcore/src/vespa/searchcore/proton/matching/match_tools.cpp
@@ -9,6 +9,7 @@
#include <vespa/searchlib/parsequery/stackdumpiterator.h>
#include <vespa/searchlib/attribute/diversity.h>
#include <vespa/searchlib/attribute/attribute_operation.h>
+#include <vespa/searchlib/attribute/attribute_blueprint_params.h>
#include <vespa/searchlib/common/bitvector.h>
#include <vespa/log/log.h>
@@ -19,6 +20,7 @@ using search::queryeval::IRequestContext;
using search::queryeval::IDiversifier;
using search::attribute::diversity::DiversityFilter;
using search::attribute::BasicType;
+using search::attribute::AttributeBlueprintParams;
using namespace search::fef;
using namespace search::fef::indexproperties::matchphase;
@@ -64,6 +66,12 @@ extractDiversityParams(const RankSetup &rankSetup, const Properties &rankPropert
AttributeLimiter::toDiversityCutoffStrategy(DiversityCutoffStrategy::lookup(rankProperties, rankSetup.getDiversityCutoffStrategy())));
}
+AttributeBlueprintParams
+extractAttributeBlueprintParams(const RankSetup& rank_setup, const Properties &rankProperties)
+{
+ return AttributeBlueprintParams(NearestNeighborBruteForceLimit::lookup(rankProperties, rank_setup.get_nearest_neighbor_brute_force_limit()));
+}
+
} // namespace proton::matching::<unnamed>
void
@@ -161,7 +169,7 @@ MatchToolsFactory(QueryLimiter & queryLimiter,
const Properties & rankProperties,
const Properties & featureOverrides)
: _queryLimiter(queryLimiter),
- _requestContext(doom, attributeContext, rankProperties),
+ _requestContext(doom, attributeContext, rankProperties, extractAttributeBlueprintParams(rankSetup, rankProperties)),
_query(),
_match_limiter(),
_queryEnv(indexEnv, attributeContext, rankProperties, searchContext.getIndexes()),
diff --git a/searchcore/src/vespa/searchcore/proton/matching/requestcontext.cpp b/searchcore/src/vespa/searchcore/proton/matching/requestcontext.cpp
index c30854c051f..86afeb5de24 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/requestcontext.cpp
+++ b/searchcore/src/vespa/searchcore/proton/matching/requestcontext.cpp
@@ -15,10 +15,12 @@ namespace proton {
using search::attribute::IAttributeVector;
RequestContext::RequestContext(const Doom & doom, IAttributeContext & attributeContext,
- const search::fef::Properties& rank_properties)
+ const search::fef::Properties& rank_properties,
+ const search::attribute::AttributeBlueprintParams& attribute_blueprint_params)
: _doom(doom),
_attributeContext(attributeContext),
- _rank_properties(rank_properties)
+ _rank_properties(rank_properties),
+ _attribute_blueprint_params(attribute_blueprint_params)
{
}
@@ -57,4 +59,10 @@ RequestContext::get_query_tensor(const vespalib::string& tensor_name) const
return vespalib::eval::Value::UP();
}
+const search::attribute::AttributeBlueprintParams&
+RequestContext::get_attribute_blueprint_params() const
+{
+ return _attribute_blueprint_params;
+}
+
}
diff --git a/searchcore/src/vespa/searchcore/proton/matching/requestcontext.h b/searchcore/src/vespa/searchcore/proton/matching/requestcontext.h
index 31d3d573a20..ada11167983 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/requestcontext.h
+++ b/searchcore/src/vespa/searchcore/proton/matching/requestcontext.h
@@ -5,6 +5,7 @@
#include <vespa/eval/tensor/tensor.h>
#include <vespa/searchlib/queryeval/irequestcontext.h>
#include <vespa/searchcommon/attribute/iattributecontext.h>
+#include <vespa/searchlib/attribute/attribute_blueprint_params.h>
#include <vespa/vespalib/util/doom.h>
namespace search::fef { class Properties; }
@@ -19,7 +20,8 @@ public:
using IAttributeFunctor = search::attribute::IAttributeFunctor;
using Doom = vespalib::Doom;
RequestContext(const Doom & softDoom, IAttributeContext & attributeContext,
- const search::fef::Properties& rank_properties);
+ const search::fef::Properties& rank_properties,
+ const search::attribute::AttributeBlueprintParams& attribute_blueprint_params);
const Doom & getDoom() const override { return _doom; }
const search::attribute::IAttributeVector *getAttribute(const vespalib::string &name) const override;
@@ -30,11 +32,13 @@ public:
vespalib::eval::Value::UP get_query_tensor(const vespalib::string& tensor_name) const override;
+ const search::attribute::AttributeBlueprintParams& get_attribute_blueprint_params() const override;
private:
const Doom _doom;
IAttributeContext & _attributeContext;
const search::fef::Properties & _rank_properties;
+ search::attribute::AttributeBlueprintParams _attribute_blueprint_params;
};
}