blob: 569efa8939452a2164bc330792b27f5804d3d823 (
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
26
27
28
29
30
31
32
33
34
35
36
37
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "bodyfielddetector.h"
#include "valuenodes.h"
#include <vespa/document/base/exceptions.h>
#include <vespa/document/repo/documenttyperepo.h>
#include <vespa/document/datatype/documenttype.h>
namespace document::select {
void
BodyFieldDetector::detectFieldType(const FieldValueNode *expr, const DocumentType &type)
{
if (type.getName() != expr->getDocType()) {
return;
}
try {
FieldPath path;
type.buildFieldPath(path, expr->getFieldName());
if ( ! path.empty() ) {
foundHeaderField = true;
}
} catch (FieldNotFoundException &) {
}
}
void
BodyFieldDetector::visitFieldValueNode(const FieldValueNode& expr)
{
_repo.forEachDocumentType([&](const DocumentType &type) {
detectFieldType(&expr, type);
});
}
}
|