From 88099bec32481b83b41f3966c2a88ebf4034f1fe Mon Sep 17 00:00:00 2001 From: Arne Juul Date: Tue, 7 Jul 2020 08:51:21 +0000 Subject: clean up various issues with ParseItem class * SimpleQueryStack only used for one unit test, move it there * Actual instances of ParseItem also only used for same unit test. Split out the object representation into a separate SimpleQueryStackItem class in the unit test directory. * give location ITEM_LOCATION_TERM instead of overloading NUMTERM * ParseItem::ITEM_PAREN never used for anything, remove it * add comment for removal of PAREN enum in prelude/query/Item.java * refactor flag handling with one method per flag --- .../src/tests/extractkeywords/CMakeLists.txt | 2 + .../tests/extractkeywords/extractkeywordstest.cpp | 53 +++--- .../src/tests/extractkeywords/simplequerystack.cpp | 50 +++++ .../src/tests/extractkeywords/simplequerystack.h | 69 +++++++ .../tests/extractkeywords/simplequerystackitem.cpp | 207 +++++++++++++++++++++ .../tests/extractkeywords/simplequerystackitem.h | 153 +++++++++++++++ .../searchsummary/docsummary/dynamicteaserdfw.cpp | 8 +- 7 files changed, 512 insertions(+), 30 deletions(-) create mode 100644 searchsummary/src/tests/extractkeywords/simplequerystack.cpp create mode 100644 searchsummary/src/tests/extractkeywords/simplequerystack.h create mode 100644 searchsummary/src/tests/extractkeywords/simplequerystackitem.cpp create mode 100644 searchsummary/src/tests/extractkeywords/simplequerystackitem.h (limited to 'searchsummary') diff --git a/searchsummary/src/tests/extractkeywords/CMakeLists.txt b/searchsummary/src/tests/extractkeywords/CMakeLists.txt index edcede16bc6..5eae390a5ec 100644 --- a/searchsummary/src/tests/extractkeywords/CMakeLists.txt +++ b/searchsummary/src/tests/extractkeywords/CMakeLists.txt @@ -2,6 +2,8 @@ vespa_add_executable(searchsummary_extractkeywordstest_app TEST SOURCES extractkeywordstest.cpp + simplequerystack.cpp + simplequerystackitem.cpp DEPENDS searchsummary ) diff --git a/searchsummary/src/tests/extractkeywords/extractkeywordstest.cpp b/searchsummary/src/tests/extractkeywords/extractkeywordstest.cpp index 4abbe7d2613..017ac0b075d 100644 --- a/searchsummary/src/tests/extractkeywords/extractkeywordstest.cpp +++ b/searchsummary/src/tests/extractkeywords/extractkeywordstest.cpp @@ -2,7 +2,7 @@ #include "extractkeywordstest.h" #include -#include +#include "simplequerystack.h" #include #define NUMTESTS 5 @@ -165,7 +165,7 @@ ExtractKeywordsTest::RunTest(int testno, bool verify) case 0: { // Simple term query - stack.Push(new search::ParseItem(search::ParseItem::ITEM_TERM, "foobar")); + stack.Push(new search::SimpleQueryStackItem(search::ParseItem::ITEM_TERM, "foobar")); stack.AppendBuffer(&buf); keywords = _extractor->ExtractKeywords(vespalib::stringref(buf.GetDrainPos(), buf.GetUsedLen())); @@ -178,11 +178,14 @@ ExtractKeywordsTest::RunTest(int testno, bool verify) case 1: { + stack.Push(new search::SimpleQueryStackItem(search::ParseItem::ITEM_LOCATION_TERM, "no")); + stack.Push(new search::SimpleQueryStackItem(search::ParseItem::ITEM_NEAREST_NEIGHBOR, "no")); // multi term query - stack.Push(new search::ParseItem(search::ParseItem::ITEM_TERM, "foobar")); - stack.Push(new search::ParseItem(search::ParseItem::ITEM_TERM, "foo")); - stack.Push(new search::ParseItem(search::ParseItem::ITEM_TERM, "bar")); - stack.Push(new search::ParseItem(search::ParseItem::ITEM_OR, 3)); + stack.Push(new search::SimpleQueryStackItem(search::ParseItem::ITEM_TERM, "foobar")); + stack.Push(new search::SimpleQueryStackItem(search::ParseItem::ITEM_TERM, "foo")); + stack.Push(new search::SimpleQueryStackItem(search::ParseItem::ITEM_TERM, "bar")); + stack.Push(new search::SimpleQueryStackItem(search::ParseItem::ITEM_OR, 3)); + stack.Push(new search::SimpleQueryStackItem(search::ParseItem::ITEM_AND, 3)); stack.AppendBuffer(&buf); keywords = _extractor->ExtractKeywords(vespalib::stringref(buf.GetDrainPos(), buf.GetUsedLen())); @@ -196,10 +199,10 @@ ExtractKeywordsTest::RunTest(int testno, bool verify) case 2: { // phrase term query - stack.Push(new search::ParseItem(search::ParseItem::ITEM_TERM, "foobar")); - stack.Push(new search::ParseItem(search::ParseItem::ITEM_TERM, "foo")); - stack.Push(new search::ParseItem(search::ParseItem::ITEM_TERM, "bar")); - stack.Push(new search::ParseItem(search::ParseItem::ITEM_PHRASE, 3, "index")); + stack.Push(new search::SimpleQueryStackItem(search::ParseItem::ITEM_TERM, "foobar")); + stack.Push(new search::SimpleQueryStackItem(search::ParseItem::ITEM_TERM, "foo")); + stack.Push(new search::SimpleQueryStackItem(search::ParseItem::ITEM_TERM, "bar")); + stack.Push(new search::SimpleQueryStackItem(search::ParseItem::ITEM_PHRASE, 3, "index")); stack.AppendBuffer(&buf); keywords = _extractor->ExtractKeywords(vespalib::stringref(buf.GetDrainPos(), buf.GetUsedLen())); @@ -213,16 +216,16 @@ ExtractKeywordsTest::RunTest(int testno, bool verify) case 3: { // multiple phrase and term query - stack.Push(new search::ParseItem(search::ParseItem::ITEM_TERM, "xyzzy")); - stack.Push(new search::ParseItem(search::ParseItem::ITEM_TERM, "xyz")); - stack.Push(new search::ParseItem(search::ParseItem::ITEM_PHRASE, 2, "index")); - stack.Push(new search::ParseItem(search::ParseItem::ITEM_TERM, "foobar")); - stack.Push(new search::ParseItem(search::ParseItem::ITEM_TERM, "foo")); - stack.Push(new search::ParseItem(search::ParseItem::ITEM_TERM, "bar")); - stack.Push(new search::ParseItem(search::ParseItem::ITEM_PHRASE, 3, "index")); - stack.Push(new search::ParseItem(search::ParseItem::ITEM_TERM, "baz")); - stack.Push(new search::ParseItem(search::ParseItem::ITEM_TERM, "zog")); - stack.Push(new search::ParseItem(search::ParseItem::ITEM_AND, 3)); + stack.Push(new search::SimpleQueryStackItem(search::ParseItem::ITEM_TERM, "xyzzy")); + stack.Push(new search::SimpleQueryStackItem(search::ParseItem::ITEM_TERM, "xyz")); + stack.Push(new search::SimpleQueryStackItem(search::ParseItem::ITEM_PHRASE, 2, "index")); + stack.Push(new search::SimpleQueryStackItem(search::ParseItem::ITEM_TERM, "foobar")); + stack.Push(new search::SimpleQueryStackItem(search::ParseItem::ITEM_TERM, "foo")); + stack.Push(new search::SimpleQueryStackItem(search::ParseItem::ITEM_TERM, "bar")); + stack.Push(new search::SimpleQueryStackItem(search::ParseItem::ITEM_PHRASE, 3, "index")); + stack.Push(new search::SimpleQueryStackItem(search::ParseItem::ITEM_TERM, "baz")); + stack.Push(new search::SimpleQueryStackItem(search::ParseItem::ITEM_TERM, "zog")); + stack.Push(new search::SimpleQueryStackItem(search::ParseItem::ITEM_AND, 3)); stack.AppendBuffer(&buf); keywords = _extractor->ExtractKeywords(vespalib::stringref(buf.GetDrainPos(), buf.GetUsedLen())); @@ -236,11 +239,11 @@ ExtractKeywordsTest::RunTest(int testno, bool verify) case 4: { // phrase term query with wrong argument items - stack.Push(new search::ParseItem(search::ParseItem::ITEM_TERM, "foobar")); - stack.Push(new search::ParseItem(search::ParseItem::ITEM_TERM, "foo")); - stack.Push(new search::ParseItem(search::ParseItem::ITEM_AND, 2)); - stack.Push(new search::ParseItem(search::ParseItem::ITEM_TERM, "bar")); - stack.Push(new search::ParseItem(search::ParseItem::ITEM_PHRASE, 2, "index")); + stack.Push(new search::SimpleQueryStackItem(search::ParseItem::ITEM_TERM, "foobar")); + stack.Push(new search::SimpleQueryStackItem(search::ParseItem::ITEM_TERM, "foo")); + stack.Push(new search::SimpleQueryStackItem(search::ParseItem::ITEM_AND, 2)); + stack.Push(new search::SimpleQueryStackItem(search::ParseItem::ITEM_TERM, "bar")); + stack.Push(new search::SimpleQueryStackItem(search::ParseItem::ITEM_PHRASE, 2, "index")); stack.AppendBuffer(&buf); keywords = _extractor->ExtractKeywords(vespalib::stringref(buf.GetDrainPos(), buf.GetUsedLen())); diff --git a/searchsummary/src/tests/extractkeywords/simplequerystack.cpp b/searchsummary/src/tests/extractkeywords/simplequerystack.cpp new file mode 100644 index 00000000000..40948612858 --- /dev/null +++ b/searchsummary/src/tests/extractkeywords/simplequerystack.cpp @@ -0,0 +1,50 @@ +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. + +#include "simplequerystack.h" +#include +#include +#include + +#include +LOG_SETUP(".search.simplequerystack"); + +using vespalib::make_string; + +namespace search { + +SimpleQueryStack::SimpleQueryStack() + : _numItems(0), + _stack(nullptr) +{ +} + +SimpleQueryStack::~SimpleQueryStack() +{ + delete _stack; +} + +void +SimpleQueryStack::Push(SimpleQueryStackItem *item) +{ + item->_next = _stack; + _stack = item; + + _numItems++; +} + +void +SimpleQueryStack::AppendBuffer(RawBuf *buf) const +{ + for (SimpleQueryStackItem *item = _stack; item != nullptr; item = item->_next) { + item->AppendBuffer(buf); + } +} + + +uint32_t +SimpleQueryStack::GetSize() +{ + return _numItems; +} + +} // namespace search diff --git a/searchsummary/src/tests/extractkeywords/simplequerystack.h b/searchsummary/src/tests/extractkeywords/simplequerystack.h new file mode 100644 index 00000000000..97dd6418e48 --- /dev/null +++ b/searchsummary/src/tests/extractkeywords/simplequerystack.h @@ -0,0 +1,69 @@ +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. + +#pragma once + +#include "simplequerystackitem.h" +#include +#include + +namespace search { + +/** + * A stack of SimpleQueryStackItems. + * + * A simple stack consisting of a list of SimpleQueryStackItems. + * It is able to generate a binary encoding of itself + * to a RawBuf. + */ +class SimpleQueryStack +{ +private: + /** The number of items on the stack. */ + uint32_t _numItems; + + /** The top of the stack. + * Warning: FastQT_ProximityEmul currently assumes this is the head + * of a singly linked list (linked with _next). + */ + SimpleQueryStackItem *_stack; + +public: + SimpleQueryStack(const SimpleQueryStack &) = delete; + SimpleQueryStack& operator=(const SimpleQueryStack &) = delete; + /** + * Constructor for SimpleQueryStack. + */ + SimpleQueryStack(); + /** + * Destructor for SimpleQueryStack. + */ + ~SimpleQueryStack(); + /** + * Push an item on the stack. + * @param item The SimpleQueryStackItem to push. + */ + void Push(SimpleQueryStackItem *item); + + + /** + * Encode the contents of the stack in a binary buffer. + * @param buf Pointer to a buffer containing the encoded contents. + */ + void AppendBuffer(RawBuf *buf) const; + + /** + * Return the number of items on the stack. + * @return The number of items on the stack. + */ + uint32_t GetSize(); + /** + * Set the number of items on the stack. + * This can be used by QTs that change the stack + * under the hood. Use with care! + * @param numItems The number of items on the stack. + */ + void SetSize(uint32_t numItems) { _numItems = numItems; } +}; + +} // namespace search + diff --git a/searchsummary/src/tests/extractkeywords/simplequerystackitem.cpp b/searchsummary/src/tests/extractkeywords/simplequerystackitem.cpp new file mode 100644 index 00000000000..f717cfced64 --- /dev/null +++ b/searchsummary/src/tests/extractkeywords/simplequerystackitem.cpp @@ -0,0 +1,207 @@ +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. + +#include "simplequerystackitem.h" +#include +#include +#include + +namespace search { + +SimpleQueryStackItem::SimpleQueryStackItem() + : _next(NULL), + _sibling(NULL), + _weight(100), + _uniqueId(0), + _arg1(0), + _arg2(0), + _arg3(0), + _type(ITEM_UNDEF), + _flags(0), + _arity(0), + _indexName(), + _term() +{} + +namespace { + +void assert_term_type(ParseItem::ItemType type) { + assert(type == ParseItem::ITEM_TERM || + type == ParseItem::ITEM_NUMTERM || + type == ParseItem::ITEM_NEAREST_NEIGHBOR || + type == ParseItem::ITEM_LOCATION_TERM || + type == ParseItem::ITEM_PREFIXTERM || + type == ParseItem::ITEM_SUBSTRINGTERM || + type == ParseItem::ITEM_SUFFIXTERM || + type == ParseItem::ITEM_PURE_WEIGHTED_STRING || + type == ParseItem::ITEM_PURE_WEIGHTED_LONG || + type == ParseItem::ITEM_EXACTSTRINGTERM || + type == ParseItem::ITEM_PREDICATE_QUERY); + (void) type; +} + +void assert_arity_type(ParseItem::ItemType type) { + // types with arity, but without an index name: + assert(type == ParseItem::ITEM_OR || + type == ParseItem::ITEM_WEAK_AND || + type == ParseItem::ITEM_EQUIV || + type == ParseItem::ITEM_AND || + type == ParseItem::ITEM_NOT || + type == ParseItem::ITEM_RANK || + type == ParseItem::ITEM_ANY || + type == ParseItem::ITEM_NEAR || + type == ParseItem::ITEM_ONEAR); + (void) type; +} + +void assert_arity_and_index_type(ParseItem::ItemType type) { + // types with arity and an index name: + assert(type == ParseItem::ITEM_PHRASE || + type == ParseItem::ITEM_SAME_ELEMENT || + type == ParseItem::ITEM_WEIGHTED_SET || + type == ParseItem::ITEM_DOT_PRODUCT || + type == ParseItem::ITEM_WAND || + type == ParseItem::ITEM_WORD_ALTERNATIVES); + (void) type; +} + +int64_t term_as_n64(vespalib::stringref term) { + int64_t tmp; + vespalib::asciistream generatedTerm(term); + generatedTerm >> tmp; + return vespalib::nbo::n2h(tmp); +} + +} // namespace + + +SimpleQueryStackItem::SimpleQueryStackItem(ItemType type, int arity) : SimpleQueryStackItem() +{ + assert_arity_type(type); + SetType(type); + _arity = arity; +} + +SimpleQueryStackItem::SimpleQueryStackItem(ItemType type, int arity, const char *idx) : SimpleQueryStackItem() +{ + assert_arity_and_index_type(type); + SetType(type); + _arity = arity; + SetIndex(idx); +} + +SimpleQueryStackItem::SimpleQueryStackItem(ItemType type, const char *term) : SimpleQueryStackItem() +{ + assert_term_type(type); + SetType(type); + SetTerm(term); +} + +SimpleQueryStackItem::~SimpleQueryStackItem() +{ + delete _next; + delete _sibling; +} + +void +SimpleQueryStackItem::AppendBuffer(RawBuf *buf) const +{ + // Calculate lengths + uint32_t indexLen = _indexName.size(); + uint32_t termLen = _term.size(); + double nboVal = 0.0; + + // Put the values into the buffer. + buf->append(_type); + if (Feature_Weight()) { // this item has weight + buf->appendCompressedNumber(_weight.percent()); + } + if (feature_UniqueId()) { + buf->appendCompressedPositiveNumber(_uniqueId); + } + if (feature_Flags()) { + buf->append(_flags); + } + switch (Type()) { + case ITEM_OR: + case ITEM_EQUIV: + case ITEM_AND: + case ITEM_NOT: + case ITEM_RANK: + case ITEM_ANY: + buf->appendCompressedPositiveNumber(_arity); + break; + case ITEM_NEAR: + case ITEM_ONEAR: + buf->appendCompressedPositiveNumber(_arity); + buf->appendCompressedPositiveNumber(_arg1); + break; + case ITEM_SAME_ELEMENT: + case ITEM_WEIGHTED_SET: + case ITEM_DOT_PRODUCT: + case ITEM_PHRASE: + buf->appendCompressedPositiveNumber(_arity); + buf->appendCompressedPositiveNumber(indexLen); + buf->append(_indexName.c_str(), indexLen); + break; + case ITEM_WORD_ALTERNATIVES: + buf->appendCompressedPositiveNumber(indexLen); + buf->append(_indexName.c_str(), indexLen); + buf->appendCompressedPositiveNumber(_arity); + break; + case ITEM_WEAK_AND: + buf->appendCompressedPositiveNumber(_arity); + buf->appendCompressedPositiveNumber(_arg1); + buf->appendCompressedPositiveNumber(indexLen); + buf->append(_indexName.c_str(), indexLen); + break; + case ITEM_WAND: + buf->appendCompressedPositiveNumber(_arity); + buf->appendCompressedPositiveNumber(indexLen); + buf->append(_indexName.c_str(), indexLen); + buf->appendCompressedPositiveNumber(_arg1); // targetNumHits + nboVal = vespalib::nbo::n2h(_arg2); + buf->append(&nboVal, sizeof(nboVal)); // scoreThreshold + nboVal = vespalib::nbo::n2h(_arg3); + buf->append(&nboVal, sizeof(nboVal)); // thresholdBoostFactor + break; + case ITEM_TERM: + case ITEM_NUMTERM: + case ITEM_LOCATION_TERM: + case ITEM_PREFIXTERM: + case ITEM_SUBSTRINGTERM: + case ITEM_EXACTSTRINGTERM: + case ITEM_SUFFIXTERM: + case ITEM_REGEXP: + buf->appendCompressedPositiveNumber(indexLen); + buf->append(_indexName.c_str(), indexLen); + buf->appendCompressedPositiveNumber(termLen); + buf->append(_term.c_str(), termLen); + break; + case ITEM_PURE_WEIGHTED_STRING: + buf->appendCompressedPositiveNumber(termLen); + buf->append(_term.c_str(), termLen); + break; + case ITEM_PURE_WEIGHTED_LONG: + { + int64_t tmp = term_as_n64(_term); + buf->append(&tmp, sizeof(int64_t)); + } + break; + case ITEM_NEAREST_NEIGHBOR: + buf->appendCompressedPositiveNumber(indexLen); + buf->append(_indexName.c_str(), indexLen); + buf->appendCompressedPositiveNumber(termLen); + buf->append(_term.c_str(), termLen); + buf->appendCompressedPositiveNumber(_arg1); // targetNumHits + buf->appendCompressedPositiveNumber(_arg2); // allow_approximate + buf->appendCompressedPositiveNumber(_arg3); // explore_additional_hits + break; + case ITEM_PREDICATE_QUERY: // not handled at all here + case ITEM_MAX: + case ITEM_UNDEF: + abort(); + break; + } +} + +} diff --git a/searchsummary/src/tests/extractkeywords/simplequerystackitem.h b/searchsummary/src/tests/extractkeywords/simplequerystackitem.h new file mode 100644 index 00000000000..05250154d18 --- /dev/null +++ b/searchsummary/src/tests/extractkeywords/simplequerystackitem.h @@ -0,0 +1,153 @@ +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. + +#pragma once + +#include +#include +#include +#include + +namespace search { + +/** + * An item on the simple query stack. + * + * An object of this class represents a single item + * on the simple query stack. It has a type, which corresponds + * to the different query stack execution operations. It also + * provides an arity, and the string values indexName and term, to + * accomodate the different needs of the operations. + * It also includes a mechanism for making singly linked lists + * with sub-lists. This is used during the parsing, and also + * when constructing the simple query stack. + */ +class SimpleQueryStackItem : public ParseItem +{ +private: + SimpleQueryStackItem(const SimpleQueryStackItem &) = delete; + SimpleQueryStackItem& operator=(const SimpleQueryStackItem &) = delete; + SimpleQueryStackItem(); +public: + /** Pointer to next item in a linked list. */ + SimpleQueryStackItem *_next; + /** Pointer to first item in a sublist. */ + SimpleQueryStackItem *_sibling; + +private: + query::Weight _weight; + uint32_t _uniqueId; + uint32_t _arg1; + double _arg2; + double _arg3; + uint8_t _type; + uint8_t _flags; + +public: + /** Extra information on each item (creator id) coded in bits 12-19 of _type */ + static inline ItemCreator GetCreator(uint8_t type) { return static_cast((type >> 3) & 0x01); } + /** The old item type now uses only the lower 12 bits in a backward compatible way) */ + static inline ItemType GetType(uint8_t type) { return static_cast(type & 0x1F); } + inline ItemType Type() const { return GetType(_type); } + + static inline bool GetFeature(uint8_t type, uint8_t feature) + { return ((type & feature) != 0); } + + static inline bool GetFeature_Weight(uint8_t type) + { return GetFeature(type, IF_WEIGHT); } + + static inline bool getFeature_UniqueId(uint8_t type) + { return GetFeature(type, IF_UNIQUEID); } + + static inline bool getFeature_Flags(uint8_t type) + { return GetFeature(type, IF_FLAGS); } + + inline bool Feature(uint8_t feature) const + { return GetFeature(_type, feature); } + + inline bool Feature_Weight() const + { return GetFeature_Weight(_type); } + + inline bool feature_UniqueId() const + { return getFeature_UniqueId(_type); } + + inline bool feature_Flags() const + { return getFeature_Flags(_type); } + + static inline bool getFlag(uint8_t flags, uint8_t flag) + { return ((flags & flag) != 0); } + + /** The number of operands for the operation. */ + uint32_t _arity; + /** The name of the specified index, or NULL if no index. */ + vespalib::string _indexName; + /** The specified search term. */ + vespalib::string _term; + +/** + * Overloaded constructor for SimpleQueryStackItem. Used primarily for + * the operators, or phrase without indexName. + * + * @param type The type of the SimpleQueryStackItem. + * @param arity The arity of the operation indicated by the SimpleQueryStackItem. + */ + SimpleQueryStackItem(ItemType type, int arity); + +/** + * Overloaded constructor for SimpleQueryStackItem. Used for PHRASEs. + * + * @param type The type of the SimpleQueryStackItem. + * @param arity The arity of the operation indicated by the SimpleQueryStackItem. + * @param idx The name of the index of the SimpleQueryStackItem. + */ + SimpleQueryStackItem(ItemType type, int arity, const char *index); + +/** + * Overloaded constructor for SimpleQueryStackItem. Used for TERMs without index. + * + * @param type The type of the SimpleQueryStackItem. + * @param term The actual term string of the SimpleQueryStackItem. + */ + SimpleQueryStackItem(ItemType type, const char *term); + +/** + * Destructor for SimpleQueryStackItem. + */ + ~SimpleQueryStackItem(); + +/** + * Set the value of the _term field. + * @param term The string to set the _term field to. + */ + void SetTerm(const char *term) { _term = term; } + +/** + * Set the value of the _indexName field. + * @param idx The string to set the _indexName field to. + */ + void SetIndex(const char *index) { _indexName = index; } + + /** + * Set the type of the operator. Use this with caution, + * as this changes the semantics of the item. + * + * @param type The new type. + */ + void SetType(ItemType type) { + _type = (_type & ~0x1F) | type; + } + + /** + * Get the unique id for this item. + * + * @return unique id for this item + **/ + uint32_t getUniqueId() const { return _uniqueId; } + + /** + * Encode the item in a binary buffer. + * @param buf Pointer to a buffer containing the encoded contents. + */ + void AppendBuffer(RawBuf *buf) const; +}; + +} diff --git a/searchsummary/src/vespa/searchsummary/docsummary/dynamicteaserdfw.cpp b/searchsummary/src/vespa/searchsummary/docsummary/dynamicteaserdfw.cpp index 4872a183358..37239fe9da6 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/dynamicteaserdfw.cpp +++ b/searchsummary/src/vespa/searchsummary/docsummary/dynamicteaserdfw.cpp @@ -187,7 +187,7 @@ JuniperQueryAdapter::Traverse(juniper::IQueryVisitor *v) const v->VisitAND(&item, 2); } while (rc && iterator.next()) { - bool isSpecialToken = search::ParseItem::getFlag(iterator.getFlags(), search::ParseItem::IFLAG_SPECIALTOKEN); + bool isSpecialToken = iterator.hasSpecialTokenFlag(); switch (iterator.getType()) { case search::ParseItem::ITEM_OR: case search::ParseItem::ITEM_WEAK_AND: @@ -241,10 +241,6 @@ JuniperQueryAdapter::Traverse(juniper::IQueryVisitor *v) const if (!v->VisitPHRASE(&item, iterator.getArity())) rc = SkipItem(&iterator); break; - case search::ParseItem::ITEM_PAREN: - if (!v->VisitOther(&item, iterator.getArity())) - rc = SkipItem(&iterator); - break; case search::ParseItem::ITEM_PREFIXTERM: case search::ParseItem::ITEM_SUBSTRINGTERM: { @@ -273,6 +269,8 @@ JuniperQueryAdapter::Traverse(juniper::IQueryVisitor *v) const case search::ParseItem::ITEM_REGEXP: case search::ParseItem::ITEM_PREDICATE_QUERY: case search::ParseItem::ITEM_SAME_ELEMENT: + case search::ParseItem::ITEM_NEAREST_NEIGHBOR: + case search::ParseItem::ITEM_LOCATION_TERM: if (!v->VisitOther(&item, iterator.getArity())) { rc = SkipItem(&iterator); } -- cgit v1.2.3