summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeir Storli <geirst@yahooinc.com>2023-12-08 16:14:32 +0100
committerGitHub <noreply@github.com>2023-12-08 16:14:32 +0100
commit441579e0a00a859ae1e1ddf4dc995be1df760346 (patch)
tree7e885502f59e9542220de6a2cdea9f23da3d4ca1
parent39032146a75f003bffb14459fee69bf8b9436fac (diff)
parent8560174a7a07c27709aee1b3ec325c07e63cf75f (diff)
Merge pull request #29595 from vespa-engine/geirst/enum-store-idx-to-integer
Add function that maps an enum store index to its integer value.
-rw-r--r--searchlib/src/vespa/searchlib/attribute/i_direct_posting_store.h7
-rw-r--r--searchlib/src/vespa/searchlib/attribute/multinumericpostattribute.h11
-rw-r--r--searchlib/src/vespa/searchlib/attribute/multinumericpostattribute.hpp31
-rw-r--r--searchlib/src/vespa/searchlib/attribute/multistringpostattribute.h11
-rw-r--r--searchlib/src/vespa/searchlib/attribute/multistringpostattribute.hpp32
5 files changed, 55 insertions, 37 deletions
diff --git a/searchlib/src/vespa/searchlib/attribute/i_direct_posting_store.h b/searchlib/src/vespa/searchlib/attribute/i_direct_posting_store.h
index 80929807ea7..6b5251772e1 100644
--- a/searchlib/src/vespa/searchlib/attribute/i_direct_posting_store.h
+++ b/searchlib/src/vespa/searchlib/attribute/i_direct_posting_store.h
@@ -54,9 +54,10 @@ public:
* (e.g. lowercased) value equals the folded value for enum_idx.
*/
virtual void collect_folded(vespalib::datastore::EntryRef enum_idx, vespalib::datastore::EntryRef dictionary_snapshot, const std::function<void(vespalib::datastore::EntryRef)>& callback) const = 0;
- virtual bool has_weight_iterator(vespalib::datastore::EntryRef idx) const noexcept = 0;
- virtual std::unique_ptr<queryeval::SearchIterator> make_bitvector_iterator(vespalib::datastore::EntryRef idx, uint32_t doc_id_limit, fef::TermFieldMatchData &match_data, bool strict) const = 0;
- virtual bool has_bitvector(vespalib::datastore::EntryRef idx) const noexcept = 0;
+ virtual bool has_weight_iterator(vespalib::datastore::EntryRef posting_idx) const noexcept = 0;
+ virtual std::unique_ptr<queryeval::SearchIterator> make_bitvector_iterator(vespalib::datastore::EntryRef posting_idx, uint32_t doc_id_limit, fef::TermFieldMatchData &match_data, bool strict) const = 0;
+ virtual bool has_bitvector(vespalib::datastore::EntryRef posting_idx) const noexcept = 0;
+ virtual int64_t get_integer_value(vespalib::datastore::EntryRef enum_idx) const noexcept = 0;
virtual ~IDirectPostingStore() = default;
};
diff --git a/searchlib/src/vespa/searchlib/attribute/multinumericpostattribute.h b/searchlib/src/vespa/searchlib/attribute/multinumericpostattribute.h
index 99bd5354593..38cf12ca909 100644
--- a/searchlib/src/vespa/searchlib/attribute/multinumericpostattribute.h
+++ b/searchlib/src/vespa/searchlib/attribute/multinumericpostattribute.h
@@ -41,11 +41,12 @@ private:
vespalib::datastore::EntryRef get_dictionary_snapshot() const override;
LookupResult lookup(const LookupKey & key, vespalib::datastore::EntryRef dictionary_snapshot) const override;
void collect_folded(vespalib::datastore::EntryRef enum_idx, vespalib::datastore::EntryRef dictionary_snapshot, const std::function<void(vespalib::datastore::EntryRef)>& callback) const override;
- void create(vespalib::datastore::EntryRef idx, std::vector<DocidWithWeightIterator> &dst) const override;
- DocidWithWeightIterator create(vespalib::datastore::EntryRef idx) const override;
- std::unique_ptr<queryeval::SearchIterator> make_bitvector_iterator(vespalib::datastore::EntryRef idx, uint32_t doc_id_limit, fef::TermFieldMatchData &match_data, bool strict) const override;
- bool has_weight_iterator(vespalib::datastore::EntryRef idx) const noexcept override;
- bool has_bitvector(vespalib::datastore::EntryRef idx) const noexcept override;
+ void create(vespalib::datastore::EntryRef posting_idx, std::vector<DocidWithWeightIterator> &dst) const override;
+ DocidWithWeightIterator create(vespalib::datastore::EntryRef posting_idx) const override;
+ std::unique_ptr<queryeval::SearchIterator> make_bitvector_iterator(vespalib::datastore::EntryRef posting_idx, uint32_t doc_id_limit, fef::TermFieldMatchData &match_data, bool strict) const override;
+ bool has_weight_iterator(vespalib::datastore::EntryRef posting_idx) const noexcept override;
+ bool has_bitvector(vespalib::datastore::EntryRef posting_idx) const noexcept override;
+ int64_t get_integer_value(vespalib::datastore::EntryRef enum_idx) const noexcept override;
bool has_always_weight_iterator() const noexcept override { return !_is_filter; }
};
DocidWithWeightPostingStoreAdapter _posting_store_adapter;
diff --git a/searchlib/src/vespa/searchlib/attribute/multinumericpostattribute.hpp b/searchlib/src/vespa/searchlib/attribute/multinumericpostattribute.hpp
index 3357b0f38de..e90940f6ca0 100644
--- a/searchlib/src/vespa/searchlib/attribute/multinumericpostattribute.hpp
+++ b/searchlib/src/vespa/searchlib/attribute/multinumericpostattribute.hpp
@@ -124,39 +124,46 @@ MultiValueNumericPostingAttribute<B, M>::DocidWithWeightPostingStoreAdapter::col
template <typename B, typename M>
void
-MultiValueNumericPostingAttribute<B, M>::DocidWithWeightPostingStoreAdapter::create(vespalib::datastore::EntryRef idx, std::vector<DocidWithWeightIterator> &dst) const
+MultiValueNumericPostingAttribute<B, M>::DocidWithWeightPostingStoreAdapter::create(vespalib::datastore::EntryRef posting_idx, std::vector<DocidWithWeightIterator> &dst) const
{
- assert(idx.valid());
- self.get_posting_store().beginFrozen(idx, dst);
+ assert(posting_idx.valid());
+ self.get_posting_store().beginFrozen(posting_idx, dst);
}
template <typename B, typename M>
DocidWithWeightIterator
-MultiValueNumericPostingAttribute<B, M>::DocidWithWeightPostingStoreAdapter::create(vespalib::datastore::EntryRef idx) const
+MultiValueNumericPostingAttribute<B, M>::DocidWithWeightPostingStoreAdapter::create(vespalib::datastore::EntryRef posting_idx) const
{
- assert(idx.valid());
- return self.get_posting_store().beginFrozen(idx);
+ assert(posting_idx.valid());
+ return self.get_posting_store().beginFrozen(posting_idx);
}
template <typename B, typename M>
std::unique_ptr<queryeval::SearchIterator>
-MultiValueNumericPostingAttribute<B, M>::DocidWithWeightPostingStoreAdapter::make_bitvector_iterator(vespalib::datastore::EntryRef idx, uint32_t doc_id_limit, fef::TermFieldMatchData &match_data, bool strict) const
+MultiValueNumericPostingAttribute<B, M>::DocidWithWeightPostingStoreAdapter::make_bitvector_iterator(vespalib::datastore::EntryRef posting_idx, uint32_t doc_id_limit, fef::TermFieldMatchData &match_data, bool strict) const
{
- return self.get_posting_store().make_bitvector_iterator(idx, doc_id_limit, match_data, strict);
+ return self.get_posting_store().make_bitvector_iterator(posting_idx, doc_id_limit, match_data, strict);
}
template <typename B, typename M>
bool
-MultiValueNumericPostingAttribute<B, M>::DocidWithWeightPostingStoreAdapter::has_weight_iterator(vespalib::datastore::EntryRef idx) const noexcept
+MultiValueNumericPostingAttribute<B, M>::DocidWithWeightPostingStoreAdapter::has_weight_iterator(vespalib::datastore::EntryRef posting_idx) const noexcept
{
- return self.get_posting_store().has_btree(idx);
+ return self.get_posting_store().has_btree(posting_idx);
}
template <typename B, typename M>
bool
-MultiValueNumericPostingAttribute<B, M>::DocidWithWeightPostingStoreAdapter::has_bitvector(vespalib::datastore::EntryRef idx) const noexcept
+MultiValueNumericPostingAttribute<B, M>::DocidWithWeightPostingStoreAdapter::has_bitvector(vespalib::datastore::EntryRef posting_idx) const noexcept
{
- return self.get_posting_store().has_bitvector(idx);
+ return self.get_posting_store().has_bitvector(posting_idx);
+}
+
+template <typename B, typename M>
+int64_t
+MultiValueNumericPostingAttribute<B, M>::DocidWithWeightPostingStoreAdapter::get_integer_value(vespalib::datastore::EntryRef enum_idx) const noexcept
+{
+ return self._enumStore.get_value(enum_idx);
}
template <typename B, typename M>
diff --git a/searchlib/src/vespa/searchlib/attribute/multistringpostattribute.h b/searchlib/src/vespa/searchlib/attribute/multistringpostattribute.h
index 1c55d697445..a8b93a93a34 100644
--- a/searchlib/src/vespa/searchlib/attribute/multistringpostattribute.h
+++ b/searchlib/src/vespa/searchlib/attribute/multistringpostattribute.h
@@ -39,11 +39,12 @@ private:
vespalib::datastore::EntryRef get_dictionary_snapshot() const override;
LookupResult lookup(const LookupKey & key, vespalib::datastore::EntryRef dictionary_snapshot) const override;
void collect_folded(vespalib::datastore::EntryRef enum_idx, vespalib::datastore::EntryRef dictionary_snapshot, const std::function<void(vespalib::datastore::EntryRef)>& callback) const override;
- void create(vespalib::datastore::EntryRef idx, std::vector<DocidWithWeightIterator> &dst) const override;
- DocidWithWeightIterator create(vespalib::datastore::EntryRef idx) const override;
- std::unique_ptr<queryeval::SearchIterator> make_bitvector_iterator(vespalib::datastore::EntryRef idx, uint32_t doc_id_limit, fef::TermFieldMatchData &match_data, bool strict) const override;
- bool has_weight_iterator(vespalib::datastore::EntryRef idx) const noexcept override;
- bool has_bitvector(vespalib::datastore::EntryRef idx) const noexcept override;
+ void create(vespalib::datastore::EntryRef posting_idx, std::vector<DocidWithWeightIterator> &dst) const override;
+ DocidWithWeightIterator create(vespalib::datastore::EntryRef posting_idx) const override;
+ std::unique_ptr<queryeval::SearchIterator> make_bitvector_iterator(vespalib::datastore::EntryRef posting_idx, uint32_t doc_id_limit, fef::TermFieldMatchData &match_data, bool strict) const override;
+ bool has_weight_iterator(vespalib::datastore::EntryRef posting_idx) const noexcept override;
+ bool has_bitvector(vespalib::datastore::EntryRef posting_idx) const noexcept override;
+ int64_t get_integer_value(vespalib::datastore::EntryRef enum_idx) const noexcept override;
bool has_always_weight_iterator() const noexcept override { return !_is_filter; }
};
DocidWithWeightPostingStoreAdapter _posting_store_adapter;
diff --git a/searchlib/src/vespa/searchlib/attribute/multistringpostattribute.hpp b/searchlib/src/vespa/searchlib/attribute/multistringpostattribute.hpp
index abc72d2c591..2909a6e0ea7 100644
--- a/searchlib/src/vespa/searchlib/attribute/multistringpostattribute.hpp
+++ b/searchlib/src/vespa/searchlib/attribute/multistringpostattribute.hpp
@@ -144,39 +144,47 @@ MultiValueStringPostingAttributeT<B, T>::DocidWithWeightPostingStoreAdapter::col
template <typename B, typename T>
void
-MultiValueStringPostingAttributeT<B, T>::DocidWithWeightPostingStoreAdapter::create(vespalib::datastore::EntryRef idx, std::vector<DocidWithWeightIterator> &dst) const
+MultiValueStringPostingAttributeT<B, T>::DocidWithWeightPostingStoreAdapter::create(vespalib::datastore::EntryRef posting_idx, std::vector<DocidWithWeightIterator> &dst) const
{
- assert(idx.valid());
- self.get_posting_store().beginFrozen(idx, dst);
+ assert(posting_idx.valid());
+ self.get_posting_store().beginFrozen(posting_idx, dst);
}
template <typename B, typename M>
DocidWithWeightIterator
-MultiValueStringPostingAttributeT<B, M>::DocidWithWeightPostingStoreAdapter::create(vespalib::datastore::EntryRef idx) const
+MultiValueStringPostingAttributeT<B, M>::DocidWithWeightPostingStoreAdapter::create(vespalib::datastore::EntryRef posting_idx) const
{
- assert(idx.valid());
- return self.get_posting_store().beginFrozen(idx);
+ assert(posting_idx.valid());
+ return self.get_posting_store().beginFrozen(posting_idx);
}
template <typename B, typename M>
bool
-MultiValueStringPostingAttributeT<B, M>::DocidWithWeightPostingStoreAdapter::has_weight_iterator(vespalib::datastore::EntryRef idx) const noexcept
+MultiValueStringPostingAttributeT<B, M>::DocidWithWeightPostingStoreAdapter::has_weight_iterator(vespalib::datastore::EntryRef posting_idx) const noexcept
{
- return self.get_posting_store().has_btree(idx);
+ return self.get_posting_store().has_btree(posting_idx);
}
template <typename B, typename M>
bool
-MultiValueStringPostingAttributeT<B, M>::DocidWithWeightPostingStoreAdapter::has_bitvector(vespalib::datastore::EntryRef idx) const noexcept
+MultiValueStringPostingAttributeT<B, M>::DocidWithWeightPostingStoreAdapter::has_bitvector(vespalib::datastore::EntryRef posting_idx) const noexcept
{
- return self.get_posting_store().has_bitvector(idx);
+ return self.get_posting_store().has_bitvector(posting_idx);
+}
+
+template <typename B, typename M>
+int64_t
+MultiValueStringPostingAttributeT<B, M>::DocidWithWeightPostingStoreAdapter::get_integer_value(vespalib::datastore::EntryRef) const noexcept
+{
+ // This is not supported for string attributes and is never called.
+ abort();
}
template <typename B, typename M>
std::unique_ptr<queryeval::SearchIterator>
-MultiValueStringPostingAttributeT<B, M>::DocidWithWeightPostingStoreAdapter::make_bitvector_iterator(vespalib::datastore::EntryRef idx, uint32_t doc_id_limit, fef::TermFieldMatchData &match_data, bool strict) const
+MultiValueStringPostingAttributeT<B, M>::DocidWithWeightPostingStoreAdapter::make_bitvector_iterator(vespalib::datastore::EntryRef posting_idx, uint32_t doc_id_limit, fef::TermFieldMatchData &match_data, bool strict) const
{
- return self.get_posting_store().make_bitvector_iterator(idx, doc_id_limit, match_data, strict);
+ return self.get_posting_store().make_bitvector_iterator(posting_idx, doc_id_limit, match_data, strict);
}
template <typename B, typename T>