blob: c4d35a05d258ec088a6432e48174f7dcc61028cd (
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
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "select_utils.h"
#include <vespa/document/select/valuenodes.h>
namespace proton {
vespalib::string
SelectUtils::extractFieldName(const document::select::FieldValueNode &expr, bool &isComplex)
{
vespalib::string result = expr.getFieldName();
isComplex = false;
for (uint32_t i = 0; i < result.size(); ++i) {
if (result[i] == '.' || result[i] == '{' || result[i] == '[') {
// TODO: Check for struct, array, map or weigthed set
result = expr.getFieldName().substr(0, i);
isComplex = true;
break;
}
}
return result;
}
}
|