diff options
Diffstat (limited to 'searchlib/src/vespa/searchlib/attribute/attribute_blueprint_factory.cpp')
-rw-r--r-- | searchlib/src/vespa/searchlib/attribute/attribute_blueprint_factory.cpp | 76 |
1 files changed, 2 insertions, 74 deletions
diff --git a/searchlib/src/vespa/searchlib/attribute/attribute_blueprint_factory.cpp b/searchlib/src/vespa/searchlib/attribute/attribute_blueprint_factory.cpp index 5d689f5bd81..56714bbf033 100644 --- a/searchlib/src/vespa/searchlib/attribute/attribute_blueprint_factory.cpp +++ b/searchlib/src/vespa/searchlib/attribute/attribute_blueprint_factory.cpp @@ -494,69 +494,6 @@ AttributeFieldBlueprint::getRange(vespalib::string &from, vespalib::string &to) return false; } -//----------------------------------------------------------------------------- - -class DirectAttributeBlueprint : public queryeval::SimpleLeafBlueprint -{ -private: - const IAttributeVector &_iattr; - const IDocidWithWeightPostingStore &_attr; - vespalib::datastore::EntryRef _dictionary_snapshot; - IDirectPostingStore::LookupResult _dict_entry; - -public: - DirectAttributeBlueprint(const FieldSpec &field, const IAttributeVector &iattr, - const IDocidWithWeightPostingStore &attr, - const IDirectPostingStore::LookupKey & key) - : SimpleLeafBlueprint(field), - _iattr(iattr), - _attr(attr), - _dictionary_snapshot(_attr.get_dictionary_snapshot()), - _dict_entry(_attr.lookup(key, _dictionary_snapshot)) - { - setEstimate(HitEstimate(_dict_entry.posting_size, (_dict_entry.posting_size == 0))); - } - - SearchIterator::UP createLeafSearch(const TermFieldMatchDataArray &tfmda, bool strict) const override { - assert(tfmda.size() == 1); - if (_dict_entry.posting_size == 0) { - return std::make_unique<queryeval::EmptySearch>(); - } - if (tfmda[0]->isNotNeeded()) { - auto bitvector_iterator = _attr.make_bitvector_iterator(_dict_entry.posting_idx, get_docid_limit(), *tfmda[0], strict); - if (bitvector_iterator) { - return bitvector_iterator; - } - } - if (_attr.has_btree_iterator(_dict_entry.posting_idx)) { - return std::make_unique<queryeval::DocidWithWeightSearchIterator>(*tfmda[0], _attr, _dict_entry); - } else { - return _attr.make_bitvector_iterator(_dict_entry.posting_idx, get_docid_limit(), *tfmda[0], strict); - } - } - - SearchIteratorUP createFilterSearch(bool strict, FilterConstraint constraint) const override { - (void) constraint; // We provide an iterator with exact results, so no need to take constraint into consideration. - auto wrapper = std::make_unique<FilterWrapper>(getState().numFields()); - wrapper->wrap(createLeafSearch(wrapper->tfmda(), strict)); - return wrapper; - } - - void visitMembers(vespalib::ObjectVisitor &visitor) const override { - LeafBlueprint::visitMembers(visitor); - visit_attribute(visitor, _iattr); - } - std::unique_ptr<queryeval::MatchingElementsSearch> create_matching_elements_search(const MatchingElementsFields &fields) const override { - if (fields.has_field(_iattr.getName())) { - return queryeval::MatchingElementsSearch::create(_iattr, _dictionary_snapshot, vespalib::ConstArrayRef<IDirectPostingStore::LookupResult>(&_dict_entry, 1)); - } else { - return {}; - } - } -}; - -//----------------------------------------------------------------------------- - bool check_valid_diversity_attr(const IAttributeVector *attr) { if ((attr == nullptr) || attr->hasMultiValue()) { return false; @@ -598,15 +535,6 @@ public: ~CreateBlueprintVisitor() override; template <class TermNode> - void visitSimpleTerm(TermNode &n) { - if (use_docid_with_weight_posting_store() && !_field.isFilter() && n.isRanked() && !Term::isPossibleRangeTerm(n.getTerm())) { - NodeAsKey key(n, _scratchPad); - setResult(std::make_unique<DirectAttributeBlueprint>(_field, _attr, *_dwwps, key)); - } else { - visitTerm(n); - } - } - template <class TermNode> void visitTerm(TermNode &n) { SearchContextParams scParams = createContextParams(_field.isFilter()); scParams.fuzzy_matching_algorithm(getRequestContext().get_attribute_blueprint_params().fuzzy_matching_algorithm); @@ -628,7 +556,7 @@ public: } } - void visit(NumberTerm & n) override { visitSimpleTerm(n); } + void visit(NumberTerm & n) override { visitTerm(n); } void visit(LocationTerm &n) override { visitLocation(n); } void visit(PrefixTerm & n) override { visitTerm(n); } @@ -652,7 +580,7 @@ public: } } - void visit(StringTerm & n) override { visitSimpleTerm(n); } + void visit(StringTerm & n) override { visitTerm(n); } void visit(SubstringTerm & n) override { query::SimpleRegExpTerm re(vespalib::RegexpUtil::make_from_substring(n.getTerm()), n.getView(), n.getId(), n.getWeight()); |