summaryrefslogtreecommitdiffstats
path: root/searchlib/src
diff options
context:
space:
mode:
Diffstat (limited to 'searchlib/src')
-rw-r--r--searchlib/src/apps/tests/memoryindexstress_test.cpp2
-rw-r--r--searchlib/src/apps/vespa-ranking-expression-analyzer/vespa-ranking-expression-analyzer.cpp1
-rw-r--r--searchlib/src/main/java/com/yahoo/searchlib/rankingexpression/evaluation/BooleanValue.java2
-rwxr-xr-xsearchlib/src/main/java/com/yahoo/searchlib/rankingexpression/rule/ConstantNode.java1
-rwxr-xr-xsearchlib/src/main/javacc/RankingExpressionParser.jj21
-rw-r--r--searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/evaluation/EvaluationTestCase.java4
-rw-r--r--searchlib/src/tests/docstore/document_store_visitor/document_store_visitor_test.cpp8
-rw-r--r--searchlib/src/tests/docstore/logdatastore/logdatastore_test.cpp6
-rw-r--r--searchlib/src/tests/grouping/grouping_serialization_test.cpp1
-rw-r--r--searchlib/src/vespa/searchlib/attribute/atomic_utils.h34
-rw-r--r--searchlib/src/vespa/searchlib/attribute/load_utils.cpp9
-rw-r--r--searchlib/src/vespa/searchlib/attribute/load_utils.h10
-rw-r--r--searchlib/src/vespa/searchlib/attribute/load_utils.hpp10
-rw-r--r--searchlib/src/vespa/searchlib/attribute/singleenumattribute.cpp13
-rw-r--r--searchlib/src/vespa/searchlib/attribute/singleenumattribute.h9
-rw-r--r--searchlib/src/vespa/searchlib/attribute/singleenumattribute.hpp12
-rw-r--r--searchlib/src/vespa/searchlib/attribute/singlenumericenumattribute.h2
-rw-r--r--searchlib/src/vespa/searchlib/attribute/singlenumericenumattribute.hpp2
-rw-r--r--searchlib/src/vespa/searchlib/attribute/singlenumericpostattribute.hpp4
-rw-r--r--searchlib/src/vespa/searchlib/attribute/singlestringattribute.h4
-rw-r--r--searchlib/src/vespa/searchlib/attribute/singlestringpostattribute.hpp4
-rw-r--r--searchlib/src/vespa/searchlib/expression/documentaccessornode.h10
-rw-r--r--searchlib/src/vespa/searchlib/expression/documentfieldnode.h1
-rw-r--r--searchlib/src/vespa/searchlib/memoryindex/field_inverter.h9
-rw-r--r--searchlib/src/vespa/searchlib/memoryindex/invert_task.cpp1
25 files changed, 122 insertions, 58 deletions
diff --git a/searchlib/src/apps/tests/memoryindexstress_test.cpp b/searchlib/src/apps/tests/memoryindexstress_test.cpp
index fcac0be8f85..07747a66892 100644
--- a/searchlib/src/apps/tests/memoryindexstress_test.cpp
+++ b/searchlib/src/apps/tests/memoryindexstress_test.cpp
@@ -137,7 +137,7 @@ setFieldValue(Document &doc, const vespalib::string &fieldName,
const vespalib::string &fieldString)
{
std::unique_ptr<StringFieldValue> fieldValue =
- std::make_unique<StringFieldValue>(fieldString);
+ StringFieldValue::make(fieldString);
document::FixedTypeRepo repo(*doc.getRepo(), doc.getType());
tokenizeStringFieldValue(repo, *fieldValue);
doc.setFieldValue(doc.getField(fieldName), std::move(fieldValue));
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 8db85559f49..d4c11d5ac2f 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
@@ -331,7 +331,6 @@ State::~State() {}
struct MyApp : public FastOS_Application {
int Main() override;
int usage();
- virtual bool useProcessStarter() const override { return false; }
};
int
diff --git a/searchlib/src/main/java/com/yahoo/searchlib/rankingexpression/evaluation/BooleanValue.java b/searchlib/src/main/java/com/yahoo/searchlib/rankingexpression/evaluation/BooleanValue.java
index 770be98c739..49f267ca522 100644
--- a/searchlib/src/main/java/com/yahoo/searchlib/rankingexpression/evaluation/BooleanValue.java
+++ b/searchlib/src/main/java/com/yahoo/searchlib/rankingexpression/evaluation/BooleanValue.java
@@ -15,7 +15,7 @@ public class BooleanValue extends DoubleCompatibleValue {
* Create a boolean value which is frozen at the outset.
*/
public static BooleanValue frozen(boolean value) {
- BooleanValue booleanValue=new BooleanValue(value);
+ BooleanValue booleanValue = new BooleanValue(value);
booleanValue.freeze();
return booleanValue;
}
diff --git a/searchlib/src/main/java/com/yahoo/searchlib/rankingexpression/rule/ConstantNode.java b/searchlib/src/main/java/com/yahoo/searchlib/rankingexpression/rule/ConstantNode.java
index 46e833197f9..a305c9c76af 100755
--- a/searchlib/src/main/java/com/yahoo/searchlib/rankingexpression/rule/ConstantNode.java
+++ b/searchlib/src/main/java/com/yahoo/searchlib/rankingexpression/rule/ConstantNode.java
@@ -2,6 +2,7 @@
package com.yahoo.searchlib.rankingexpression.rule;
import com.yahoo.searchlib.rankingexpression.Reference;
+import com.yahoo.searchlib.rankingexpression.evaluation.BooleanValue;
import com.yahoo.searchlib.rankingexpression.evaluation.Context;
import com.yahoo.searchlib.rankingexpression.evaluation.Value;
import com.yahoo.tensor.TensorType;
diff --git a/searchlib/src/main/javacc/RankingExpressionParser.jj b/searchlib/src/main/javacc/RankingExpressionParser.jj
index 865820320d8..ebe1e048247 100755
--- a/searchlib/src/main/javacc/RankingExpressionParser.jj
+++ b/searchlib/src/main/javacc/RankingExpressionParser.jj
@@ -153,6 +153,8 @@ TOKEN :
<MIN: "min"> |
<PROD: "prod"> |
<SUM: "sum"> |
+ <TRUE: "true"> |
+ <FALSE: "false"> |
<IDENTIFIER: (["A"-"Z","a"-"z","0"-"9","_","@"](["A"-"Z","a"-"z","0"-"9","_","@","$"])*)>
}
@@ -797,7 +799,9 @@ String identifier() :
func = binaryFunctionName() { return func.toString(); } |
<IF> { return token.image; } |
<IN> { return token.image; } |
- <IDENTIFIER> { return token.image; }
+ <IDENTIFIER> { return token.image; } |
+ <TRUE> { return token.image; } |
+ <FALSE> { return token.image; }
}
List<String> identifierList() :
@@ -854,25 +858,14 @@ ExpressionNode constantPrimitive(boolean negate) :
( <INTEGER> { value = token.image; } |
<FLOAT> { value = token.image; }
) { node = new ConstantNode(Value.parse(negate ? ("-" + value) : value)); } |
- <STRING> {
- value = token.image;
- node = new ConstantNode(Value.parse(value));
+ ( <STRING> | <TRUE> | <FALSE> ) {
+ node = new ConstantNode(Value.parse(token.image));
if (negate) node = new NegativeNode(node);
}
)
{ return node; }
}
-Value primitiveValue() :
-{
- String sign = "";
-}
-{
- ( <SUB> { sign = "-";} ) ?
- ( <INTEGER> | <FLOAT> | <STRING> )
- { return Value.parse(sign + token.image); }
-}
-
TensorFunctionNode tensorValueBody(TensorType type, List dimensionOrder) :
{
DynamicTensor dynamicTensor;
diff --git a/searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/evaluation/EvaluationTestCase.java b/searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/evaluation/EvaluationTestCase.java
index efa98fba2eb..19e32c23234 100644
--- a/searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/evaluation/EvaluationTestCase.java
+++ b/searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/evaluation/EvaluationTestCase.java
@@ -133,6 +133,10 @@ public class EvaluationTestCase {
public void testBooleanEvaluation() {
EvaluationTester tester = new EvaluationTester();
+ // literals
+ tester.assertEvaluates(false, "false");
+ tester.assertEvaluates(true, "true");
+
// and
tester.assertEvaluates(false, "0 && 0");
tester.assertEvaluates(false, "0 && 1");
diff --git a/searchlib/src/tests/docstore/document_store_visitor/document_store_visitor_test.cpp b/searchlib/src/tests/docstore/document_store_visitor/document_store_visitor_test.cpp
index 072efb06a07..c08aa7ce9fc 100644
--- a/searchlib/src/tests/docstore/document_store_visitor/document_store_visitor_test.cpp
+++ b/searchlib/src/tests/docstore/document_store_visitor/document_store_visitor_test.cpp
@@ -8,6 +8,7 @@
#include <vespa/searchlib/common/bitvector.h>
#include <vespa/document/repo/documenttyperepo.h>
#include <vespa/document/datatype/documenttype.h>
+#include <vespa/document/fieldvalue/stringfieldvalue.h>
#include <vespa/document/repo/configbuilder.h>
#include <vespa/document/fieldvalue/document.h>
#include <vespa/vespalib/io/fileutil.h>
@@ -26,6 +27,7 @@ using document::Document;
using document::DocumentId;
using document::DocumentType;
using document::DocumentTypeRepo;
+using document::StringFieldValue;
using vespalib::compression::CompressionConfig;
using vespalib::asciistream;
using index::DummyFileHeaderContext;
@@ -66,9 +68,9 @@ makeDoc(const DocumentTypeRepo &repo, uint32_t i, bool before)
mainstr << (j + i * 1000) << " ";
}
mainstr << " and end field";
- doc->set("main", mainstr.c_str());
+ doc->setValue("main", StringFieldValue::make(mainstr.str()));
if (!before) {
- doc->set("extra", "foo");
+ doc->setValue("extra", StringFieldValue::make("foo"));
}
return doc;
@@ -160,7 +162,7 @@ MyRewriteVisitor::visit(uint32_t lid, const std::shared_ptr<Document> &doc)
Document::UP expDoc(makeDoc(_repo, lid, _before));
EXPECT_TRUE(*expDoc == *doc);
_valid->setBitAndMaintainCount(lid);
- doc->set("extra", "foo");
+ doc->setValue("extra", StringFieldValue::make("foo"));
}
diff --git a/searchlib/src/tests/docstore/logdatastore/logdatastore_test.cpp b/searchlib/src/tests/docstore/logdatastore/logdatastore_test.cpp
index 378babb6ee1..bb2d0177dd9 100644
--- a/searchlib/src/tests/docstore/logdatastore/logdatastore_test.cpp
+++ b/searchlib/src/tests/docstore/logdatastore/logdatastore_test.cpp
@@ -4,6 +4,7 @@
#include <vespa/document/repo/configbuilder.h>
#include <vespa/document/repo/documenttyperepo.h>
#include <vespa/document/datatype/documenttype.h>
+#include <vespa/document/fieldvalue/stringfieldvalue.h>
#include <vespa/document/fieldvalue/document.h>
#include <vespa/searchlib/docstore/chunkformats.h>
#include <vespa/searchlib/docstore/logdocumentstore.h>
@@ -19,6 +20,7 @@
#include <iomanip>
using document::BucketId;
+using document::StringFieldValue;
using namespace search::docstore;
using namespace search;
using namespace vespalib::alloc;
@@ -429,9 +431,9 @@ makeDoc(const DocumentTypeRepo &repo, uint32_t i, bool extra_field, size_t numRe
mainstr << (j + i * 1000) << " ";
}
mainstr << " and end field";
- doc->set("main", mainstr.c_str());
+ doc->setValue("main", StringFieldValue::make(mainstr.str()));
if (extra_field) {
- doc->set("extra", "foo");
+ doc->setValue("extra", StringFieldValue::make("foo"));
}
return doc;
}
diff --git a/searchlib/src/tests/grouping/grouping_serialization_test.cpp b/searchlib/src/tests/grouping/grouping_serialization_test.cpp
index ea96c698a02..39a5feab111 100644
--- a/searchlib/src/tests/grouping/grouping_serialization_test.cpp
+++ b/searchlib/src/tests/grouping/grouping_serialization_test.cpp
@@ -7,6 +7,7 @@
#include <vespa/searchlib/expression/getdocidnamespacespecificfunctionnode.h>
#include <vespa/searchlib/expression/getymumchecksumfunctionnode.h>
#include <vespa/searchlib/expression/documentfieldnode.h>
+#include <vespa/document/base/documentid.h>
#include <vespa/vespalib/testkit/test_kit.h>
#include <fstream>
#include <vespa/log/log.h>
diff --git a/searchlib/src/vespa/searchlib/attribute/atomic_utils.h b/searchlib/src/vespa/searchlib/attribute/atomic_utils.h
new file mode 100644
index 00000000000..48914de8942
--- /dev/null
+++ b/searchlib/src/vespa/searchlib/attribute/atomic_utils.h
@@ -0,0 +1,34 @@
+// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+
+#pragma once
+
+namespace vespalib::datastore {
+
+class AtomicEntryRef;
+class EntryRef;
+
+}
+
+namespace search::attribute::atomic_utils {
+
+/*
+ * Helper class to map from atomic value to non-atomic value, e.g.
+ * from AtomicEntryRef to EntryRef.
+ */
+template <typename MaybeAtomicValue>
+class NonAtomicValue {
+public:
+ using type = MaybeAtomicValue;
+};
+
+template <>
+class NonAtomicValue<vespalib::datastore::AtomicEntryRef>
+{
+public:
+ using type = vespalib::datastore::EntryRef;
+};
+
+template <class MaybeAtomicValue>
+using NonAtomicValue_t = typename NonAtomicValue<MaybeAtomicValue>::type;
+
+}
diff --git a/searchlib/src/vespa/searchlib/attribute/load_utils.cpp b/searchlib/src/vespa/searchlib/attribute/load_utils.cpp
index f71222e6faa..707cdc6af76 100644
--- a/searchlib/src/vespa/searchlib/attribute/load_utils.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/load_utils.cpp
@@ -12,6 +12,7 @@
using search::multivalue::Value;
using search::multivalue::WeightedValue;
+using vespalib::datastore::AtomicEntryRef;
namespace search::attribute {
@@ -84,15 +85,15 @@ template uint32_t loadFromEnumeratedMultiValue(MultiValueMapping<Value<ValueType
#define INSTANTIATE_WSET(ValueType, Saver) \
template uint32_t loadFromEnumeratedMultiValue(MultiValueMapping<WeightedValue<ValueType>> &, ReaderBase &, vespalib::ConstArrayRef<ValueType>, vespalib::ConstArrayRef<uint32_t>, Saver)
#define INSTANTIATE_SINGLE(ValueType, Saver) \
-template void loadFromEnumeratedSingleValue(vespalib::RcuVectorBase<ValueType> &, vespalib::GenerationHolder &, ReaderBase &, vespalib::ConstArrayRef<ValueType>, vespalib::ConstArrayRef<uint32_t>, Saver)
+template void loadFromEnumeratedSingleValue(vespalib::RcuVectorBase<ValueType> &, vespalib::GenerationHolder &, ReaderBase &, vespalib::ConstArrayRef<atomic_utils::NonAtomicValue_t<ValueType>>, vespalib::ConstArrayRef<uint32_t>, Saver)
#define INSTANTIATE_SINGLE_ARRAY_WSET(ValueType, Saver) \
INSTANTIATE_SINGLE(ValueType, Saver); \
-INSTANTIATE_ARRAY(ValueType, Saver); \
-INSTANTIATE_WSET(ValueType, Saver)
+INSTANTIATE_ARRAY(atomic_utils::NonAtomicValue_t<ValueType>, Saver); \
+INSTANTIATE_WSET(atomic_utils::NonAtomicValue_t<ValueType>, Saver)
#define INSTANTIATE_ENUM(Saver) \
-INSTANTIATE_SINGLE_ARRAY_WSET(IEnumStore::Index, Saver)
+INSTANTIATE_SINGLE_ARRAY_WSET(AtomicEntryRef, Saver)
#define INSTANTIATE_VALUE(ValueType) \
INSTANTIATE_SINGLE_ARRAY_WSET(ValueType, NoSaveLoadedEnum)
diff --git a/searchlib/src/vespa/searchlib/attribute/load_utils.h b/searchlib/src/vespa/searchlib/attribute/load_utils.h
index a9a41b8eaeb..f9f933f3726 100644
--- a/searchlib/src/vespa/searchlib/attribute/load_utils.h
+++ b/searchlib/src/vespa/searchlib/attribute/load_utils.h
@@ -2,10 +2,18 @@
#pragma once
+#include "atomic_utils.h"
#include "attributevector.h"
#include "readerbase.h"
#include <vespa/vespalib/util/arrayref.h>
+namespace vespalib::datastore {
+
+class AtomicEntryRef;
+class EntryRef;
+
+}
+
namespace search::attribute {
/**
@@ -51,7 +59,7 @@ void
loadFromEnumeratedSingleValue(Vector &vector,
vespalib::GenerationHolder &genHolder,
ReaderBase &attrReader,
- vespalib::ConstArrayRef<typename Vector::ValueType> enumValueToValueMap,
+ vespalib::ConstArrayRef<atomic_utils::NonAtomicValue_t<typename Vector::ValueType>> enumValueToValueMap,
vespalib::ConstArrayRef<uint32_t> enum_value_remapping,
Saver saver) __attribute((noinline));
diff --git a/searchlib/src/vespa/searchlib/attribute/load_utils.hpp b/searchlib/src/vespa/searchlib/attribute/load_utils.hpp
index 50566b36e75..74126299919 100644
--- a/searchlib/src/vespa/searchlib/attribute/load_utils.hpp
+++ b/searchlib/src/vespa/searchlib/attribute/load_utils.hpp
@@ -54,10 +54,12 @@ void
loadFromEnumeratedSingleValue(Vector &vector,
vespalib::GenerationHolder &genHolder,
ReaderBase &attrReader,
- vespalib::ConstArrayRef<typename Vector::ValueType> enumValueToValueMap,
+ vespalib::ConstArrayRef<atomic_utils::NonAtomicValue_t<typename Vector::ValueType>> enumValueToValueMap,
vespalib::ConstArrayRef<uint32_t> enum_value_remapping,
Saver saver)
{
+ using ValueType = typename Vector::ValueType;
+ using NonAtomicValueType = atomic_utils::NonAtomicValue_t<ValueType>;
uint32_t numDocs = attrReader.getEnumCount();
genHolder.clearHoldLists();
vector.reset();
@@ -68,7 +70,11 @@ loadFromEnumeratedSingleValue(Vector &vector,
if (!enum_value_remapping.empty()) {
enumValue = enum_value_remapping[enumValue];
}
- vector.push_back(enumValueToValueMap[enumValue]);
+ if constexpr (std::is_same_v<ValueType, NonAtomicValueType>) {
+ vector.push_back(enumValueToValueMap[enumValue]);
+ } else {
+ vector.push_back(ValueType(enumValueToValueMap[enumValue]));
+ }
saver.save(enumValue, doc, 1);
}
}
diff --git a/searchlib/src/vespa/searchlib/attribute/singleenumattribute.cpp b/searchlib/src/vespa/searchlib/attribute/singleenumattribute.cpp
index cffd52f3dc4..b5de652fbe2 100644
--- a/searchlib/src/vespa/searchlib/attribute/singleenumattribute.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/singleenumattribute.cpp
@@ -32,7 +32,7 @@ AttributeVector::DocId
SingleValueEnumAttributeBase::addDoc(bool &incGeneration)
{
incGeneration = _enumIndices.isFull();
- _enumIndices.push_back(IEnumStore::Index());
+ _enumIndices.push_back(AtomicEntryRef());
return _enumIndices.size() - 1;
}
@@ -41,7 +41,12 @@ SingleValueEnumAttributeBase::EnumIndexCopyVector
SingleValueEnumAttributeBase::getIndicesCopy(uint32_t size) const
{
assert(size <= _enumIndices.size());
- return EnumIndexCopyVector(&_enumIndices[0], &_enumIndices[0] + size);
+ EnumIndexCopyVector result;
+ result.reserve(size);
+ for (uint32_t lid = 0; lid < size; ++lid) {
+ result.push_back(_enumIndices[lid].load_relaxed());
+ }
+ return result;
}
void
@@ -54,11 +59,11 @@ SingleValueEnumAttributeBase::remap_enum_store_refs(const EnumIndexRemapper& rem
v.logEnumStoreEvent("reenumerate", "start");
auto& filter = remapper.get_entry_ref_filter();
for (uint32_t i = 0; i < _enumIndices.size(); ++i) {
- EnumIndex ref = _enumIndices[i];
+ EnumIndex ref = _enumIndices[i].load_relaxed();
if (ref.valid() && filter.has(ref)) {
ref = remapper.remap(ref);
}
- new_indexes.push_back_fast(ref);
+ new_indexes.push_back_fast(AtomicEntryRef(ref));
}
v.logEnumStoreEvent("compactfixup", "drain");
{
diff --git a/searchlib/src/vespa/searchlib/attribute/singleenumattribute.h b/searchlib/src/vespa/searchlib/attribute/singleenumattribute.h
index 8fcef670fb0..4ce55902d7f 100644
--- a/searchlib/src/vespa/searchlib/attribute/singleenumattribute.h
+++ b/searchlib/src/vespa/searchlib/attribute/singleenumattribute.h
@@ -17,24 +17,25 @@ class ReaderBase;
*/
class SingleValueEnumAttributeBase {
protected:
+ using AtomicEntryRef = vespalib::datastore::AtomicEntryRef;
+ using AtomicEntryRefVector = vespalib::RcuVectorBase<AtomicEntryRef>;
using DocId = AttributeVector::DocId;
using EnumHandle = AttributeVector::EnumHandle;
using EnumIndex = IEnumStore::Index;
- using EnumIndexVector = vespalib::RcuVectorBase<EnumIndex>;
using EnumIndexRemapper = IEnumStore::EnumIndexRemapper;
using GenerationHolder = vespalib::GenerationHolder;
public:
using EnumIndexCopyVector = vespalib::Array<EnumIndex>;
- IEnumStore::Index getEnumIndex(DocId docId) const { return _enumIndices[docId]; }
- EnumHandle getE(DocId doc) const { return _enumIndices[doc].ref(); }
+ IEnumStore::Index getEnumIndex(DocId docId) const { return _enumIndices[docId].load_acquire(); }
+ EnumHandle getE(DocId doc) const { return _enumIndices[doc].load_acquire().ref(); }
protected:
SingleValueEnumAttributeBase(const attribute::Config & c, GenerationHolder &genHolder, const vespalib::alloc::Alloc& initial_alloc);
~SingleValueEnumAttributeBase();
AttributeVector::DocId addDoc(bool & incGeneration);
- EnumIndexVector _enumIndices;
+ AtomicEntryRefVector _enumIndices;
EnumIndexCopyVector getIndicesCopy(uint32_t size) const;
void remap_enum_store_refs(const EnumIndexRemapper& remapper, AttributeVector& v);
diff --git a/searchlib/src/vespa/searchlib/attribute/singleenumattribute.hpp b/searchlib/src/vespa/searchlib/attribute/singleenumattribute.hpp
index 56aa6672696..bb454a8b0d4 100644
--- a/searchlib/src/vespa/searchlib/attribute/singleenumattribute.hpp
+++ b/searchlib/src/vespa/searchlib/attribute/singleenumattribute.hpp
@@ -53,9 +53,9 @@ SingleValueEnumAttribute<B>::addDoc(DocId & doc)
if (doc > 0u) {
// Make sure that a valid value(magic default) is referenced,
// even between addDoc and commit().
- if (_enumIndices[0].valid()) {
+ if (_enumIndices[0].load_relaxed().valid()) {
_enumIndices[doc] = _enumIndices[0];
- this->_enumStore.inc_ref_count(_enumIndices[0]);
+ this->_enumStore.inc_ref_count(_enumIndices[0].load_relaxed());
}
}
this->incNumDocs();
@@ -166,7 +166,7 @@ template <typename B>
void
SingleValueEnumAttribute<B>::applyUpdateValueChange(const Change& c, EnumStoreBatchUpdater& updater)
{
- EnumIndex oldIdx = _enumIndices[c._doc];
+ EnumIndex oldIdx = _enumIndices[c._doc].load_relaxed();
EnumIndex newIdx;
if (c.has_entry_ref()) {
newIdx = EnumIndex(vespalib::datastore::EntryRef(c.get_entry_ref()));
@@ -204,7 +204,7 @@ SingleValueEnumAttribute<B>::updateEnumRefCounts(const Change& c, EnumIndex newI
EnumStoreBatchUpdater& updater)
{
updater.inc_ref_count(newIdx);
- _enumIndices[c._doc] = newIdx;
+ _enumIndices[c._doc].store_release(newIdx);
if (oldIdx.valid()) {
updater.dec_ref_count(oldIdx);
}
@@ -220,7 +220,7 @@ SingleValueEnumAttribute<B>::fillValues(LoadedVector & loaded)
_enumIndices.reset();
_enumIndices.unsafe_reserve(numDocs);
for (DocId doc = 0; doc < numDocs; ++doc, loaded.next()) {
- _enumIndices.push_back(loaded.read().getEidx());
+ _enumIndices.push_back(AtomicEntryRef(loaded.read().getEidx()));
}
}
}
@@ -296,7 +296,7 @@ SingleValueEnumAttribute<B>::clearDocs(DocId lidLow, DocId lidLimit)
assert(lidLow <= lidLimit);
assert(lidLimit <= this->getNumDocs());
for (DocId lid = lidLow; lid < lidLimit; ++lid) {
- if (_enumIndices[lid] != vespalib::datastore::EntryRef(e)) {
+ if (_enumIndices[lid].load_relaxed() != vespalib::datastore::EntryRef(e)) {
this->clearDoc(lid);
}
}
diff --git a/searchlib/src/vespa/searchlib/attribute/singlenumericenumattribute.h b/searchlib/src/vespa/searchlib/attribute/singlenumericenumattribute.h
index 4383527a4a4..9ef2d680f05 100644
--- a/searchlib/src/vespa/searchlib/attribute/singlenumericenumattribute.h
+++ b/searchlib/src/vespa/searchlib/attribute/singlenumericenumattribute.h
@@ -103,7 +103,7 @@ public:
// Attribute read API
//-------------------------------------------------------------------------
T get(DocId doc) const override {
- return this->_enumStore.get_value(this->_enumIndices[doc]);
+ return this->_enumStore.get_value(this->_enumIndices[doc].load_acquire());
}
largeint_t getInt(DocId doc) const override {
return static_cast<largeint_t>(get(doc));
diff --git a/searchlib/src/vespa/searchlib/attribute/singlenumericenumattribute.hpp b/searchlib/src/vespa/searchlib/attribute/singlenumericenumattribute.hpp
index c6b720ba14e..215123e9b5b 100644
--- a/searchlib/src/vespa/searchlib/attribute/singlenumericenumattribute.hpp
+++ b/searchlib/src/vespa/searchlib/attribute/singlenumericenumattribute.hpp
@@ -50,7 +50,7 @@ template <typename B>
void
SingleValueNumericEnumAttribute<B>::applyArithmeticValueChange(const Change& c, EnumStoreBatchUpdater& updater)
{
- EnumIndex oldIdx = this->_enumIndices[c._doc];
+ EnumIndex oldIdx = this->_enumIndices[c._doc].load_relaxed();
EnumIndex newIdx;
T newValue = this->template applyArithmetic<T, typename Change::DataType>(get(c._doc), c._data.getArithOperand(), c._type);
this->_enumStore.find_index(newValue, newIdx);
diff --git a/searchlib/src/vespa/searchlib/attribute/singlenumericpostattribute.hpp b/searchlib/src/vespa/searchlib/attribute/singlenumericpostattribute.hpp
index 4d37171e151..b87dadb5429 100644
--- a/searchlib/src/vespa/searchlib/attribute/singlenumericpostattribute.hpp
+++ b/searchlib/src/vespa/searchlib/attribute/singlenumericpostattribute.hpp
@@ -64,7 +64,7 @@ makePostingChange(const vespalib::datastore::EntryComparator &cmpa,
{
for (const auto& elem : currEnumIndices) {
uint32_t docId = elem.first;
- EnumIndex oldIdx = this->_enumIndices[docId];
+ EnumIndex oldIdx = this->_enumIndices[docId].load_relaxed();
EnumIndex newIdx = elem.second;
// add new posting
@@ -97,7 +97,7 @@ SingleValueNumericPostingAttribute<B>::applyValueChanges(EnumStoreBatchUpdater&
if (enumIter != currEnumIndices.end()) {
oldIdx = enumIter->second;
} else {
- oldIdx = this->_enumIndices[change._doc];
+ oldIdx = this->_enumIndices[change._doc].load_relaxed();
}
if (change._type == ChangeBase::UPDATE) {
diff --git a/searchlib/src/vespa/searchlib/attribute/singlestringattribute.h b/searchlib/src/vespa/searchlib/attribute/singlestringattribute.h
index cd0fe5cfb9a..45bb007e737 100644
--- a/searchlib/src/vespa/searchlib/attribute/singlestringattribute.h
+++ b/searchlib/src/vespa/searchlib/attribute/singlestringattribute.h
@@ -45,7 +45,7 @@ public:
//-------------------------------------------------------------------------
bool isUndefined(DocId doc) const override { return get(doc)[0] == '\0'; }
const char * get(DocId doc) const override {
- return this->_enumStore.get_value(this->_enumIndices[doc]);
+ return this->_enumStore.get_value(this->_enumIndices[doc].load_acquire());
}
std::vector<EnumHandle> findFoldedEnums(const char *value) const override {
return this->_enumStore.find_folded_enums(value);
@@ -95,7 +95,7 @@ public:
int32_t onFind(DocId doc, int32_t elemId) const override {
if ( elemId != 0) return -1;
const SingleValueStringAttributeT<B> & attr(static_cast<const SingleValueStringAttributeT<B> &>(attribute()));
- return isMatch(attr._enumStore.get_value(attr._enumIndices[doc])) ? 0 : -1;
+ return isMatch(attr._enumStore.get_value(attr._enumIndices[doc].load_acquire())) ? 0 : -1;
}
};
diff --git a/searchlib/src/vespa/searchlib/attribute/singlestringpostattribute.hpp b/searchlib/src/vespa/searchlib/attribute/singlestringpostattribute.hpp
index 4670ee075fe..58c62e60efe 100644
--- a/searchlib/src/vespa/searchlib/attribute/singlestringpostattribute.hpp
+++ b/searchlib/src/vespa/searchlib/attribute/singlestringpostattribute.hpp
@@ -64,7 +64,7 @@ makePostingChange(const vespalib::datastore::EntryComparator &cmpa,
{
for (const auto& elem : currEnumIndices) {
uint32_t docId = elem.first;
- EnumIndex oldIdx = this->_enumIndices[docId];
+ EnumIndex oldIdx = this->_enumIndices[docId].load_relaxed();
EnumIndex newIdx = elem.second;
// add new posting
@@ -98,7 +98,7 @@ SingleValueStringPostingAttributeT<B>::applyValueChanges(EnumStoreBatchUpdater&
if (enumIter != currEnumIndices.end()) {
oldIdx = enumIter->second;
} else {
- oldIdx = this->_enumIndices[change._doc];
+ oldIdx = this->_enumIndices[change._doc].load_relaxed();
}
if (change._type == ChangeBase::UPDATE) {
applyUpdateValueChange(change, enumStore, currEnumIndices);
diff --git a/searchlib/src/vespa/searchlib/expression/documentaccessornode.h b/searchlib/src/vespa/searchlib/expression/documentaccessornode.h
index 0efe7d023f6..453b8f82bf0 100644
--- a/searchlib/src/vespa/searchlib/expression/documentaccessornode.h
+++ b/searchlib/src/vespa/searchlib/expression/documentaccessornode.h
@@ -2,12 +2,14 @@
#pragma once
#include "expressionnode.h"
-#include <vespa/document/fieldvalue/document.h>
#include <vespa/vespalib/objects/objectoperation.h>
#include <vespa/vespalib/objects/objectpredicate.h>
-namespace search {
-namespace expression {
+namespace document {
+ class DocumentType;
+ class Document;
+}
+namespace search::expression {
class DocumentAccessorNode : public ExpressionNode
{
@@ -33,5 +35,3 @@ private:
};
}
-}
-
diff --git a/searchlib/src/vespa/searchlib/expression/documentfieldnode.h b/searchlib/src/vespa/searchlib/expression/documentfieldnode.h
index b85ba0f4e9b..fd3923bd4a0 100644
--- a/searchlib/src/vespa/searchlib/expression/documentfieldnode.h
+++ b/searchlib/src/vespa/searchlib/expression/documentfieldnode.h
@@ -5,6 +5,7 @@
#include "resultnode.h"
#include "resultvector.h"
#include <vespa/document/fieldvalue/iteratorhandler.h>
+#include <vespa/document/base/fieldpath.h>
namespace search::expression {
diff --git a/searchlib/src/vespa/searchlib/memoryindex/field_inverter.h b/searchlib/src/vespa/searchlib/memoryindex/field_inverter.h
index 1c1998fb423..5a7c8d0f7bc 100644
--- a/searchlib/src/vespa/searchlib/memoryindex/field_inverter.h
+++ b/searchlib/src/vespa/searchlib/memoryindex/field_inverter.h
@@ -4,7 +4,6 @@
#include "i_field_index_remove_listener.h"
#include <vespa/document/annotation/span.h>
-#include <vespa/document/fieldvalue/document.h>
#include <vespa/searchlib/index/docidandfeatures.h>
#include <vespa/vespalib/stllike/allocator.h>
#include <vespa/vespalib/stllike/hash_map.h>
@@ -15,6 +14,12 @@ namespace search::index {
class Schema;
}
+namespace document {
+ class FieldValue;
+ class StringFieldValue;
+ class ArrayFieldValue;
+ class WeightedSetFieldValue;
+}
namespace search::memoryindex {
class IOrderedFieldIndexInserter;
@@ -299,7 +304,7 @@ public:
/**
* Invert a normal text field, based on annotations.
*/
- void invertField(uint32_t docId, const document::FieldValue::UP &val);
+ void invertField(uint32_t docId, const std::unique_ptr<document::FieldValue> &val);
/**
* Setup remove of word in old version of document.
diff --git a/searchlib/src/vespa/searchlib/memoryindex/invert_task.cpp b/searchlib/src/vespa/searchlib/memoryindex/invert_task.cpp
index fb6e1328b8b..8fa9de7da74 100644
--- a/searchlib/src/vespa/searchlib/memoryindex/invert_task.cpp
+++ b/searchlib/src/vespa/searchlib/memoryindex/invert_task.cpp
@@ -5,6 +5,7 @@
#include "field_inverter.h"
#include "invert_context.h"
#include "url_field_inverter.h"
+#include <vespa/document/fieldvalue/document.h>
namespace search::memoryindex {