aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2021-03-20 12:42:41 +0100
committerGitHub <noreply@github.com>2021-03-20 12:42:41 +0100
commit1d7cd7c72d9bceaa9a44d5498cdd45071b2483f3 (patch)
tree22968d7a99119fa692bd77770a66923aab058702
parent3d421adc759258273fcef30226ffd70c4cab0c5c (diff)
parentac78916d40707a7acaa13085d7f493a060e721c6 (diff)
Merge pull request #17086 from vespa-engine/toregge/perform-simple-lookup-in-unordered-dictionary-when-available-pass2
More lookups in unordered dictionary.
-rw-r--r--searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.cpp9
-rw-r--r--vespalib/src/vespa/vespalib/datastore/i_unique_store_dictionary.h1
-rw-r--r--vespalib/src/vespa/vespalib/datastore/unique_store_dictionary.h1
-rw-r--r--vespalib/src/vespa/vespalib/datastore/unique_store_dictionary.hpp7
4 files changed, 18 insertions, 0 deletions
diff --git a/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.cpp b/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.cpp
index 10a998da46b..c7c0805b1a4 100644
--- a/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.cpp
@@ -45,6 +45,15 @@ PostingListSearchContext::~PostingListSearchContext() = default;
void
PostingListSearchContext::lookupTerm(const vespalib::datastore::EntryComparator &comp)
{
+ if (_dictionary.get_has_unordered_dictionary()) {
+ // Note: Diversity requires _lowerDictItr and upperDictItr to be setup
+ auto lookup_result = _dictionary.find_posting_list(comp, _frozenDictionary.getRoot());
+ if (lookup_result.first.valid()) {
+ _pidx = lookup_result.second;
+ _uniqueValues = 1u;
+ }
+ return;
+ }
_lowerDictItr.lower_bound(_frozenDictionary.getRoot(), EnumIndex(), comp);
_upperDictItr = _lowerDictItr;
if (_upperDictItr.valid() && !comp.less(EnumIndex(), _upperDictItr.getKey())) {
diff --git a/vespalib/src/vespa/vespalib/datastore/i_unique_store_dictionary.h b/vespalib/src/vespa/vespalib/datastore/i_unique_store_dictionary.h
index 2c495ca9a1e..bc686d4804a 100644
--- a/vespalib/src/vespa/vespalib/datastore/i_unique_store_dictionary.h
+++ b/vespalib/src/vespa/vespalib/datastore/i_unique_store_dictionary.h
@@ -48,6 +48,7 @@ public:
virtual void build(vespalib::ConstArrayRef<EntryRef> refs) = 0;
virtual void build_with_payload(vespalib::ConstArrayRef<EntryRef> refs, vespalib::ConstArrayRef<uint32_t> payloads) = 0;
virtual std::unique_ptr<ReadSnapshot> get_read_snapshot() const = 0;
+ virtual bool get_has_unordered_dictionary() const = 0;
};
}
diff --git a/vespalib/src/vespa/vespalib/datastore/unique_store_dictionary.h b/vespalib/src/vespa/vespalib/datastore/unique_store_dictionary.h
index c5630dbabfb..c24f4f237c3 100644
--- a/vespalib/src/vespa/vespalib/datastore/unique_store_dictionary.h
+++ b/vespalib/src/vespa/vespalib/datastore/unique_store_dictionary.h
@@ -77,6 +77,7 @@ public:
void build(vespalib::ConstArrayRef<EntryRef> refs) override;
void build_with_payload(vespalib::ConstArrayRef<EntryRef>, vespalib::ConstArrayRef<uint32_t> payloads) override;
std::unique_ptr<ReadSnapshot> get_read_snapshot() const override;
+ bool get_has_unordered_dictionary() const override;
};
}
diff --git a/vespalib/src/vespa/vespalib/datastore/unique_store_dictionary.hpp b/vespalib/src/vespa/vespalib/datastore/unique_store_dictionary.hpp
index 963a2dc72a1..b6378d3bd75 100644
--- a/vespalib/src/vespa/vespalib/datastore/unique_store_dictionary.hpp
+++ b/vespalib/src/vespa/vespalib/datastore/unique_store_dictionary.hpp
@@ -271,4 +271,11 @@ UniqueStoreDictionary<DictionaryT, ParentT, UnorderedDictionaryT>::get_read_snap
return std::make_unique<ReadSnapshotImpl>(_dict.getFrozenView());
}
+template <typename DictionaryT, typename ParentT, typename UnorderedDictionaryT>
+bool
+UniqueStoreDictionary<DictionaryT, ParentT, UnorderedDictionaryT>::get_has_unordered_dictionary() const
+{
+ return has_unordered_dictionary;
+}
+
}