summaryrefslogtreecommitdiffstats
path: root/streamingvisitors/src/vespa/searchvisitor/indexenvironment.cpp
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@yahoo-inc.com>2016-06-15 23:09:44 +0200
committerJon Bratseth <bratseth@yahoo-inc.com>2016-06-15 23:09:44 +0200
commit72231250ed81e10d66bfe70701e64fa5fe50f712 (patch)
tree2728bba1131a6f6e5bdf95afec7d7ff9358dac50 /streamingvisitors/src/vespa/searchvisitor/indexenvironment.cpp
Publish
Diffstat (limited to 'streamingvisitors/src/vespa/searchvisitor/indexenvironment.cpp')
-rw-r--r--streamingvisitors/src/vespa/searchvisitor/indexenvironment.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/streamingvisitors/src/vespa/searchvisitor/indexenvironment.cpp b/streamingvisitors/src/vespa/searchvisitor/indexenvironment.cpp
new file mode 100644
index 00000000000..1dc6a096f2e
--- /dev/null
+++ b/streamingvisitors/src/vespa/searchvisitor/indexenvironment.cpp
@@ -0,0 +1,37 @@
+// 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(".searchvisitor.indexenvironment");
+#include "indexenvironment.h"
+
+using namespace search::fef;
+
+namespace storage {
+
+IndexEnvironment::IndexEnvironment(const ITableManager & tableManager) :
+ _tableManager(&tableManager),
+ _properties(),
+ _fields(),
+ _fieldNames(),
+ _motivation(RANK),
+ _rankAttributes(),
+ _dumpAttributes()
+{
+}
+
+bool
+IndexEnvironment::addField(const vespalib::string & name, bool isAttribute)
+{
+ if (getFieldByName(name) != NULL) {
+ return false;
+ }
+ FieldInfo info(isAttribute ? FieldType::ATTRIBUTE : FieldType::INDEX, CollectionType::SINGLE, name, _fields.size());
+ info.addAttribute(); // we are able to produce needed attributes at query time
+ _fields.push_back(info);
+ _fieldNames[info.name()] = info.id();
+ return true;
+}
+
+} // namespace storage
+