summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--searchlib/src/tests/attribute/enum_comparator/enum_comparator_test.cpp54
-rw-r--r--searchlib/src/vespa/searchlib/attribute/enum_store_dictionary.cpp8
-rw-r--r--searchlib/src/vespa/searchlib/attribute/enumcomparator.h4
-rw-r--r--searchlib/src/vespa/searchlib/attribute/enumstore.cpp2
-rw-r--r--searchlib/src/vespa/searchlib/attribute/enumstore.hpp6
-rw-r--r--searchlib/src/vespa/searchlib/attribute/multinumericpostattribute.hpp2
-rw-r--r--searchlib/src/vespa/searchlib/attribute/multistringpostattribute.hpp4
-rw-r--r--searchlib/src/vespa/searchlib/attribute/postinglistattribute.h2
-rw-r--r--searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.cpp4
-rw-r--r--vespalib/src/tests/datastore/unique_store_dictionary/unique_store_dictionary_test.cpp2
-rw-r--r--vespalib/src/vespa/vespalib/datastore/entry_comparator.h2
-rw-r--r--vespalib/src/vespa/vespalib/datastore/entry_comparator_wrapper.h2
-rw-r--r--vespalib/src/vespa/vespalib/datastore/unique_store_comparator.h2
-rw-r--r--vespalib/src/vespa/vespalib/datastore/unique_store_dictionary.hpp8
-rw-r--r--vespalib/src/vespa/vespalib/datastore/unique_store_string_comparator.h2
15 files changed, 52 insertions, 52 deletions
diff --git a/searchlib/src/tests/attribute/enum_comparator/enum_comparator_test.cpp b/searchlib/src/tests/attribute/enum_comparator/enum_comparator_test.cpp
index 4e1e1c6d792..ccd30c72b0e 100644
--- a/searchlib/src/tests/attribute/enum_comparator/enum_comparator_test.cpp
+++ b/searchlib/src/tests/attribute/enum_comparator/enum_comparator_test.cpp
@@ -44,12 +44,12 @@ Test::requireThatNumericComparatorIsWorking()
EnumIndex e1 = es.insert(10);
EnumIndex e2 = es.insert(30);
auto cmp1 = es.make_comparator();
- EXPECT_TRUE(cmp1(e1, e2));
- EXPECT_TRUE(!cmp1(e2, e1));
- EXPECT_TRUE(!cmp1(e1, e1));
+ EXPECT_TRUE(cmp1.less(e1, e2));
+ EXPECT_TRUE(!cmp1.less(e2, e1));
+ EXPECT_TRUE(!cmp1.less(e1, e1));
auto cmp2 = es.make_comparator(20);
- EXPECT_TRUE(cmp2(EnumIndex(), e2));
- EXPECT_TRUE(!cmp2(e2, EnumIndex()));
+ EXPECT_TRUE(cmp2.less(EnumIndex(), e2));
+ EXPECT_TRUE(!cmp2.less(e2, EnumIndex()));
}
void
@@ -60,15 +60,15 @@ Test::requireThatFloatComparatorIsWorking()
EnumIndex e2 = es.insert(30.5);
EnumIndex e3 = es.insert(std::numeric_limits<float>::quiet_NaN());
auto cmp1 = es.make_comparator();
- EXPECT_TRUE(cmp1(e1, e2));
- EXPECT_TRUE(!cmp1(e2, e1));
- EXPECT_TRUE(!cmp1(e1, e1));
- EXPECT_TRUE(cmp1(e3, e1)); // nan
- EXPECT_TRUE(!cmp1(e1, e3)); // nan
- EXPECT_TRUE(!cmp1(e3, e3)); // nan
+ EXPECT_TRUE(cmp1.less(e1, e2));
+ EXPECT_TRUE(!cmp1.less(e2, e1));
+ EXPECT_TRUE(!cmp1.less(e1, e1));
+ EXPECT_TRUE(cmp1.less(e3, e1)); // nan
+ EXPECT_TRUE(!cmp1.less(e1, e3)); // nan
+ EXPECT_TRUE(!cmp1.less(e3, e3)); // nan
auto cmp2 = es.make_comparator(20.5);
- EXPECT_TRUE(cmp2(EnumIndex(), e2));
- EXPECT_TRUE(!cmp2(e2, EnumIndex()));
+ EXPECT_TRUE(cmp2.less(EnumIndex(), e2));
+ EXPECT_TRUE(!cmp2.less(e2, EnumIndex()));
}
void
@@ -79,14 +79,14 @@ Test::requireThatStringComparatorIsWorking()
EnumIndex e2 = es.insert("aa");
EnumIndex e3 = es.insert("aB");
auto cmp1 = es.make_comparator();
- EXPECT_TRUE(cmp1(e1, e2)); // similar folded, fallback to regular
- EXPECT_TRUE(!cmp1(e2, e1));
- EXPECT_TRUE(!cmp1(e1, e1));
- EXPECT_TRUE(cmp1(e2, e3)); // folded compare
+ EXPECT_TRUE(cmp1.less(e1, e2)); // similar folded, fallback to regular
+ EXPECT_TRUE(!cmp1.less(e2, e1));
+ EXPECT_TRUE(!cmp1.less(e1, e1));
+ EXPECT_TRUE(cmp1.less(e2, e3)); // folded compare
EXPECT_TRUE(strcmp("aa", "aB") > 0); // regular
auto cmp2 = es.make_comparator("AB");
- EXPECT_TRUE(cmp2(EnumIndex(), e3));
- EXPECT_TRUE(!cmp2(e3, EnumIndex()));
+ EXPECT_TRUE(cmp2.less(EnumIndex(), e3));
+ EXPECT_TRUE(!cmp2.less(e3, EnumIndex()));
}
void
@@ -124,16 +124,16 @@ Test::requireThatFoldedComparatorIsWorking()
EnumIndex e3 = es.insert("aB");
EnumIndex e4 = es.insert("Folded");
auto cmp1 = es.make_folded_comparator();
- EXPECT_TRUE(!cmp1(e1, e2)); // similar folded
- EXPECT_TRUE(!cmp1(e2, e1)); // similar folded
- EXPECT_TRUE(cmp1(e2, e3)); // folded compare
- EXPECT_TRUE(!cmp1(e3, e2)); // folded compare
+ EXPECT_TRUE(!cmp1.less(e1, e2)); // similar folded
+ EXPECT_TRUE(!cmp1.less(e2, e1)); // similar folded
+ EXPECT_TRUE(cmp1.less(e2, e3)); // folded compare
+ EXPECT_TRUE(!cmp1.less(e3, e2)); // folded compare
auto cmp2 = es.make_folded_comparator("fol", false);
auto cmp3 = es.make_folded_comparator("fol", true);
- EXPECT_TRUE(cmp2(EnumIndex(), e4));
- EXPECT_TRUE(!cmp2(e4, EnumIndex()));
- EXPECT_TRUE(!cmp3(EnumIndex(), e4)); // similar when prefix
- EXPECT_TRUE(!cmp3(e4, EnumIndex())); // similar when prefix
+ EXPECT_TRUE(cmp2.less(EnumIndex(), e4));
+ EXPECT_TRUE(!cmp2.less(e4, EnumIndex()));
+ EXPECT_TRUE(!cmp3.less(EnumIndex(), e4)); // similar when prefix
+ EXPECT_TRUE(!cmp3.less(e4, EnumIndex())); // similar when prefix
}
int
diff --git a/searchlib/src/vespa/searchlib/attribute/enum_store_dictionary.cpp b/searchlib/src/vespa/searchlib/attribute/enum_store_dictionary.cpp
index 19d30317c7b..ed16dc2d8d8 100644
--- a/searchlib/src/vespa/searchlib/attribute/enum_store_dictionary.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/enum_store_dictionary.cpp
@@ -122,7 +122,7 @@ EnumStoreDictionary<DictionaryT>::find_matching_enums(const vespalib::datastore:
{
std::vector<IEnumStore::EnumHandle> result;
auto itr = this->_dict.getFrozenView().find(Index(), cmp);
- while (itr.valid() && !cmp(Index(), itr.getKey())) {
+ while (itr.valid() && !cmp.less(Index(), itr.getKey())) {
result.push_back(itr.getKey().ref());
++itr;
}
@@ -169,7 +169,7 @@ UniqueStoreAddResult
EnumStoreFoldedDictionary::add(const EntryComparator& comp, std::function<EntryRef(void)> insertEntry)
{
auto it = _dict.lowerBound(EntryRef(), comp);
- if (it.valid() && !comp(EntryRef(), it.getKey())) {
+ if (it.valid() && !comp.less(EntryRef(), it.getKey())) {
// Entry already exists
return UniqueStoreAddResult(it.getKey(), false);
}
@@ -177,7 +177,7 @@ EnumStoreFoldedDictionary::add(const EntryComparator& comp, std::function<EntryR
_dict.insert(it, newRef, EntryRef().ref());
// Maybe move posting list reference from next entry
++it;
- if (it.valid() && EntryRef(it.getData()).valid() && !(*_folded_compare)(newRef, it.getKey())) {
+ if (it.valid() && EntryRef(it.getData()).valid() && !_folded_compare->less(newRef, it.getKey())) {
EntryRef posting_list_ref(it.getData());
_dict.thaw(it);
it.writeData(EntryRef().ref());
@@ -198,7 +198,7 @@ EnumStoreFoldedDictionary::remove(const EntryComparator& comp, EntryRef ref)
_dict.remove(it);
// Maybe copy posting list reference to next entry
if (posting_list_ref.valid()) {
- if (it.valid() && !EntryRef(it.getData()).valid() && !(*_folded_compare)(ref, it.getKey())) {
+ if (it.valid() && !EntryRef(it.getData()).valid() && !_folded_compare->less(ref, it.getKey())) {
this->_dict.thaw(it);
it.writeData(posting_list_ref.ref());
} else {
diff --git a/searchlib/src/vespa/searchlib/attribute/enumcomparator.h b/searchlib/src/vespa/searchlib/attribute/enumcomparator.h
index aaf47987a5d..e0a5b456fd5 100644
--- a/searchlib/src/vespa/searchlib/attribute/enumcomparator.h
+++ b/searchlib/src/vespa/searchlib/attribute/enumcomparator.h
@@ -51,7 +51,7 @@ public:
return compare(lhs, rhs) == 0;
}
- bool operator() (const vespalib::datastore::EntryRef lhs, const vespalib::datastore::EntryRef rhs) const override {
+ bool less(const vespalib::datastore::EntryRef lhs, const vespalib::datastore::EntryRef rhs) const override {
return compare(get(lhs), get(rhs)) < 0;
}
};
@@ -95,7 +95,7 @@ public:
return compare_folded(lhs, rhs) == 0;
}
- bool operator() (const vespalib::datastore::EntryRef lhs, const vespalib::datastore::EntryRef rhs) const override {
+ bool less(const vespalib::datastore::EntryRef lhs, const vespalib::datastore::EntryRef rhs) const override {
if (use_prefix()) {
return compare_folded_prefix(get(lhs), get(rhs), _prefix_len) < 0;
}
diff --git a/searchlib/src/vespa/searchlib/attribute/enumstore.cpp b/searchlib/src/vespa/searchlib/attribute/enumstore.cpp
index 0ad8a7d7c5b..ecd55138df1 100644
--- a/searchlib/src/vespa/searchlib/attribute/enumstore.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/enumstore.cpp
@@ -35,7 +35,7 @@ EnumStoreT<const char*>::load_unique_value(const void* src,
if (prev_idx.valid()) {
auto cmp = make_comparator(value);
- assert(cmp(prev_idx, Index()));
+ assert(cmp.less(prev_idx, Index()));
}
return sz;
}
diff --git a/searchlib/src/vespa/searchlib/attribute/enumstore.hpp b/searchlib/src/vespa/searchlib/attribute/enumstore.hpp
index 54c756ee437..c1098f079e6 100644
--- a/searchlib/src/vespa/searchlib/attribute/enumstore.hpp
+++ b/searchlib/src/vespa/searchlib/attribute/enumstore.hpp
@@ -66,7 +66,7 @@ EnumStoreT<EntryT>::load_unique_value(const void* src, size_t available, Index&
if (prev_idx.valid()) {
auto cmp = make_comparator(*value);
- assert(cmp(prev_idx, Index()));
+ assert(cmp.less(prev_idx, Index()));
}
return sizeof(EntryType);
}
@@ -159,8 +159,8 @@ bool
EnumStoreT<EntryT>::is_folded_change(Index idx1, Index idx2) const
{
auto cmp = make_folded_comparator();
- assert(!cmp(idx2, idx1));
- return cmp(idx1, idx2);
+ assert(!cmp.less(idx2, idx1));
+ return cmp.less(idx1, idx2);
}
template <typename EntryT>
diff --git a/searchlib/src/vespa/searchlib/attribute/multinumericpostattribute.hpp b/searchlib/src/vespa/searchlib/attribute/multinumericpostattribute.hpp
index 1fd1cd09bea..ed19e6ae0ba 100644
--- a/searchlib/src/vespa/searchlib/attribute/multinumericpostattribute.hpp
+++ b/searchlib/src/vespa/searchlib/attribute/multinumericpostattribute.hpp
@@ -103,7 +103,7 @@ MultiValueNumericPostingAttribute<B, M>::DocumentWeightAttributeAdapter::lookup(
auto comp = self._enumStore.make_comparator(int_term);
dictItr.lower_bound(dictionary_snapshot, EnumIndex(), comp);
- if (dictItr.valid() && !comp(EnumIndex(), dictItr.getKey())) {
+ if (dictItr.valid() && !comp.less(EnumIndex(), dictItr.getKey())) {
vespalib::datastore::EntryRef pidx(dictItr.getData());
if (pidx.valid()) {
const PostingList &plist = self.getPostingList();
diff --git a/searchlib/src/vespa/searchlib/attribute/multistringpostattribute.hpp b/searchlib/src/vespa/searchlib/attribute/multistringpostattribute.hpp
index 25d7858ea81..f97a4e281a8 100644
--- a/searchlib/src/vespa/searchlib/attribute/multistringpostattribute.hpp
+++ b/searchlib/src/vespa/searchlib/attribute/multistringpostattribute.hpp
@@ -115,7 +115,7 @@ MultiValueStringPostingAttributeT<B, T>::DocumentWeightAttributeAdapter::lookup(
auto comp = self._enumStore.make_folded_comparator(term.c_str());
dictItr.lower_bound(dictionary_snapshot, enumstore::Index(), comp);
- if (dictItr.valid() && !comp(enumstore::Index(), dictItr.getKey())) {
+ if (dictItr.valid() && !comp.less(enumstore::Index(), dictItr.getKey())) {
vespalib::datastore::EntryRef pidx(dictItr.getData());
if (pidx.valid()) {
const PostingList &plist = self.getPostingList();
@@ -134,7 +134,7 @@ MultiValueStringPostingAttributeT<B, T>::DocumentWeightAttributeAdapter::collect
Dictionary::ConstIterator dictItr(vespalib::btree::BTreeNode::Ref(), dictionary.getAllocator());
auto comp = self._enumStore.make_folded_comparator();
dictItr.lower_bound(dictionary_snapshot, enum_idx, comp);
- while (dictItr.valid() && !comp(enum_idx, dictItr.getKey())) {
+ while (dictItr.valid() && !comp.less(enum_idx, dictItr.getKey())) {
callback(dictItr.getKey());
++dictItr;
}
diff --git a/searchlib/src/vespa/searchlib/attribute/postinglistattribute.h b/searchlib/src/vespa/searchlib/attribute/postinglistattribute.h
index 5f2eb02ecd2..eab8d1576fd 100644
--- a/searchlib/src/vespa/searchlib/attribute/postinglistattribute.h
+++ b/searchlib/src/vespa/searchlib/attribute/postinglistattribute.h
@@ -28,7 +28,7 @@ public:
_cmp(cmp)
{ }
- bool operator<(const EnumPostingPair &rhs) const { return (*_cmp)(_idx, rhs._idx); }
+ bool operator<(const EnumPostingPair &rhs) const { return _cmp->less(_idx, rhs._idx); }
IEnumStore::Index getEnumIdx() const { return _idx; }
};
diff --git a/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.cpp b/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.cpp
index 972baa267ce..1c9b8dbf7b2 100644
--- a/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.cpp
@@ -46,7 +46,7 @@ PostingListSearchContext::lookupTerm(const vespalib::datastore::EntryComparator
{
_lowerDictItr.lower_bound(_frozenDictionary.getRoot(), EnumIndex(), comp);
_upperDictItr = _lowerDictItr;
- if (_upperDictItr.valid() && !comp(EnumIndex(), _upperDictItr.getKey())) {
+ if (_upperDictItr.valid() && !comp.less(EnumIndex(), _upperDictItr.getKey())) {
++_upperDictItr;
_uniqueValues = 1u;
}
@@ -59,7 +59,7 @@ PostingListSearchContext::lookupRange(const vespalib::datastore::EntryComparator
{
_lowerDictItr.lower_bound(_frozenDictionary.getRoot(), EnumIndex(), low);
_upperDictItr = _lowerDictItr;
- if (_upperDictItr.valid() && !high(EnumIndex(), _upperDictItr.getKey())) {
+ if (_upperDictItr.valid() && !high.less(EnumIndex(), _upperDictItr.getKey())) {
_upperDictItr.seekPast(EnumIndex(), high);
}
_uniqueValues = _upperDictItr - _lowerDictItr;
diff --git a/vespalib/src/tests/datastore/unique_store_dictionary/unique_store_dictionary_test.cpp b/vespalib/src/tests/datastore/unique_store_dictionary/unique_store_dictionary_test.cpp
index 6a9215c3eb9..fc5709072b9 100644
--- a/vespalib/src/tests/datastore/unique_store_dictionary/unique_store_dictionary_test.cpp
+++ b/vespalib/src/tests/datastore/unique_store_dictionary/unique_store_dictionary_test.cpp
@@ -25,7 +25,7 @@ public:
Comparator(uint32_t to_find)
: _to_find(to_find)
{}
- bool operator()(const EntryRef lhs, const EntryRef rhs) const override {
+ bool less(const EntryRef lhs, const EntryRef rhs) const override {
return resolve(lhs).ref() < resolve(rhs).ref();
}
};
diff --git a/vespalib/src/vespa/vespalib/datastore/entry_comparator.h b/vespalib/src/vespa/vespalib/datastore/entry_comparator.h
index d0b5b307a9e..027b27bec08 100644
--- a/vespalib/src/vespa/vespalib/datastore/entry_comparator.h
+++ b/vespalib/src/vespa/vespalib/datastore/entry_comparator.h
@@ -19,7 +19,7 @@ public:
/**
* Returns true if the value represented by lhs ref is less than the value represented by rhs ref.
*/
- virtual bool operator()(const EntryRef lhs, const EntryRef rhs) const = 0;
+ virtual bool less(const EntryRef lhs, const EntryRef rhs) const = 0;
};
}
diff --git a/vespalib/src/vespa/vespalib/datastore/entry_comparator_wrapper.h b/vespalib/src/vespa/vespalib/datastore/entry_comparator_wrapper.h
index 199d074b453..2856103b3e1 100644
--- a/vespalib/src/vespa/vespalib/datastore/entry_comparator_wrapper.h
+++ b/vespalib/src/vespa/vespalib/datastore/entry_comparator_wrapper.h
@@ -16,7 +16,7 @@ public:
: _comp(comp)
{ }
bool operator()(const EntryRef &lhs, const EntryRef &rhs) const {
- return _comp(lhs, rhs);
+ return _comp.less(lhs, rhs);
}
};
diff --git a/vespalib/src/vespa/vespalib/datastore/unique_store_comparator.h b/vespalib/src/vespa/vespalib/datastore/unique_store_comparator.h
index 3226c4563cc..c99345252d3 100644
--- a/vespalib/src/vespa/vespalib/datastore/unique_store_comparator.h
+++ b/vespalib/src/vespa/vespalib/datastore/unique_store_comparator.h
@@ -93,7 +93,7 @@ public:
{
}
- bool operator()(const EntryRef lhs, const EntryRef rhs) const override {
+ bool less(const EntryRef lhs, const EntryRef rhs) const override {
const EntryType &lhsValue = get(lhs);
const EntryType &rhsValue = get(rhs);
return UniqueStoreComparatorHelper<EntryT>::less(lhsValue, rhsValue);
diff --git a/vespalib/src/vespa/vespalib/datastore/unique_store_dictionary.hpp b/vespalib/src/vespa/vespalib/datastore/unique_store_dictionary.hpp
index 8ecf71d08c7..6fcf15e69c1 100644
--- a/vespalib/src/vespa/vespalib/datastore/unique_store_dictionary.hpp
+++ b/vespalib/src/vespa/vespalib/datastore/unique_store_dictionary.hpp
@@ -29,7 +29,7 @@ UniqueStoreDictionary<DictionaryT, ParentT>::
ReadSnapshotImpl::count(const EntryComparator& comp) const
{
auto itr = _frozen_view.lowerBound(EntryRef(), comp);
- if (itr.valid() && !comp(EntryRef(), itr.getKey())) {
+ if (itr.valid() && !comp.less(EntryRef(), itr.getKey())) {
return 1u;
}
return 0u;
@@ -43,7 +43,7 @@ ReadSnapshotImpl::count_in_range(const EntryComparator& low,
{
auto low_itr = _frozen_view.lowerBound(EntryRef(), low);
auto high_itr = low_itr;
- if (high_itr.valid() && !high(EntryRef(), high_itr.getKey())) {
+ if (high_itr.valid() && !high.less(EntryRef(), high_itr.getKey())) {
high_itr.seekPast(EntryRef(), high);
}
return high_itr - low_itr;
@@ -94,7 +94,7 @@ UniqueStoreDictionary<DictionaryT, ParentT>::add(const EntryComparator &comp,
std::function<EntryRef(void)> insertEntry)
{
auto itr = _dict.lowerBound(EntryRef(), comp);
- if (itr.valid() && !comp(EntryRef(), itr.getKey())) {
+ if (itr.valid() && !comp.less(EntryRef(), itr.getKey())) {
return UniqueStoreAddResult(itr.getKey(), false);
} else {
@@ -109,7 +109,7 @@ EntryRef
UniqueStoreDictionary<DictionaryT, ParentT>::find(const EntryComparator &comp)
{
auto itr = _dict.lowerBound(EntryRef(), comp);
- if (itr.valid() && !comp(EntryRef(), itr.getKey())) {
+ if (itr.valid() && !comp.less(EntryRef(), itr.getKey())) {
return itr.getKey();
} else {
return EntryRef();
diff --git a/vespalib/src/vespa/vespalib/datastore/unique_store_string_comparator.h b/vespalib/src/vespa/vespalib/datastore/unique_store_string_comparator.h
index 140e38dbef1..a3bd1267049 100644
--- a/vespalib/src/vespa/vespalib/datastore/unique_store_string_comparator.h
+++ b/vespalib/src/vespa/vespalib/datastore/unique_store_string_comparator.h
@@ -44,7 +44,7 @@ public:
{
}
- bool operator()(const EntryRef lhs, const EntryRef rhs) const override {
+ bool less(const EntryRef lhs, const EntryRef rhs) const override {
const char *lhs_value = get(lhs);
const char *rhs_value = get(rhs);
return (strcmp(lhs_value, rhs_value) < 0);