blob: 2c661e8d41b38a05021d7b947feec1d5d4e2a973 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "query_term_decoder.h"
#include <vespa/searchlib/query/streaming/query.h>
#include <vespa/vespalib/util/exceptions.h>
namespace search {
using namespace search::streaming;
QueryTermSimple::UP
QueryTermDecoder::decodeTerm(QueryPacketT term)
{
QueryTermSimple::UP result;
QueryNodeResultFactory factory;
Query query(factory, term);
if (query.valid() && (dynamic_cast<const QueryTerm *>(&query.getRoot()))) {
result.reset(static_cast<QueryTerm *>(Query::steal(std::move(query)).release()));
} else {
throw vespalib::IllegalStateException("Failed decoding query term");
}
return result;
}
}
|