summaryrefslogtreecommitdiffstats
path: root/searchcommon
diff options
context:
space:
mode:
authorGeir Storli <geirst@yahoo-inc.com>2017-03-14 15:17:14 +0000
committerGeir Storli <geirst@yahoo-inc.com>2017-03-14 15:17:14 +0000
commit8d30ab013d5786788b38cfd5992f45b765bf13d8 (patch)
treef8c4f9a0f64d88f50df1ada55d0a381730c43419 /searchcommon
parentbd5402c9d12eb2a78c7ab8539d32d31d64885f83 (diff)
Move AttributeVector::SearchContext::Params to separate class in searchcommon.
Diffstat (limited to 'searchcommon')
-rw-r--r--searchcommon/src/vespa/searchcommon/attribute/CMakeLists.txt1
-rw-r--r--searchcommon/src/vespa/searchcommon/attribute/search_context_params.cpp19
-rw-r--r--searchcommon/src/vespa/searchcommon/attribute/search_context_params.h46
3 files changed, 66 insertions, 0 deletions
diff --git a/searchcommon/src/vespa/searchcommon/attribute/CMakeLists.txt b/searchcommon/src/vespa/searchcommon/attribute/CMakeLists.txt
index 5343a9eac69..500ee87bf87 100644
--- a/searchcommon/src/vespa/searchcommon/attribute/CMakeLists.txt
+++ b/searchcommon/src/vespa/searchcommon/attribute/CMakeLists.txt
@@ -4,6 +4,7 @@ vespa_add_library(searchcommon_searchcommon_attribute OBJECT
basictype.cpp
collectiontype.cpp
config.cpp
+ search_context_params.cpp
status.cpp
DEPENDS
)
diff --git a/searchcommon/src/vespa/searchcommon/attribute/search_context_params.cpp b/searchcommon/src/vespa/searchcommon/attribute/search_context_params.cpp
new file mode 100644
index 00000000000..dccfb6c6b27
--- /dev/null
+++ b/searchcommon/src/vespa/searchcommon/attribute/search_context_params.cpp
@@ -0,0 +1,19 @@
+// 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 "search_context_params.h"
+#include <limits>
+
+namespace search {
+namespace attribute {
+
+SearchContextParams::SearchContextParams()
+ : _diversityAttribute(nullptr),
+ _diversityCutoffGroups(std::numeric_limits<uint32_t>::max()),
+ _useBitVector(false),
+ _diversityCutoffStrict(false)
+{
+}
+
+}
+}
diff --git a/searchcommon/src/vespa/searchcommon/attribute/search_context_params.h b/searchcommon/src/vespa/searchcommon/attribute/search_context_params.h
new file mode 100644
index 00000000000..d15a97629f0
--- /dev/null
+++ b/searchcommon/src/vespa/searchcommon/attribute/search_context_params.h
@@ -0,0 +1,46 @@
+// Copyright 2017 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+
+#pragma once
+
+namespace search {
+namespace attribute {
+
+class IAttributeVector;
+
+/**
+ * Params used to specify diversity and bitvector settings when creating a search context.
+ */
+class SearchContextParams {
+private:
+ const IAttributeVector * _diversityAttribute;
+ size_t _diversityCutoffGroups;
+ bool _useBitVector;
+ bool _diversityCutoffStrict;
+
+public:
+ SearchContextParams();
+ bool useBitVector() const { return _useBitVector; }
+ const IAttributeVector * diversityAttribute() const { return _diversityAttribute; }
+ size_t diversityCutoffGroups() const { return _diversityCutoffGroups; }
+ bool diversityCutoffStrict() const { return _diversityCutoffStrict; }
+
+ SearchContextParams &useBitVector(bool value) {
+ _useBitVector = value;
+ return *this;
+ }
+ SearchContextParams &diversityAttribute(const IAttributeVector *value) {
+ _diversityAttribute = value;
+ return *this;
+ }
+ SearchContextParams &diversityCutoffGroups(size_t groups) {
+ _diversityCutoffGroups = groups;
+ return *this;
+ }
+ SearchContextParams &diversityCutoffStrict(bool strict) {
+ _diversityCutoffStrict = strict;
+ return *this;
+ }
+};
+
+}
+}