aboutsummaryrefslogtreecommitdiffstats
path: root/searchcore/src/vespa/searchcore/proton/matching/resolveviewvisitor.cpp
blob: df6d0d606ab661adad1f239ac034a12173fefb2d (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
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#include "resolveviewvisitor.h"
#include <vespa/document/datatype/positiondatatype.h>
#include <vespa/log/log.h>

LOG_SETUP(".proton.matching.resolveviewvisitor");

namespace proton::matching {

void
ResolveViewVisitor::visit(ProtonLocationTerm &n) {
    // if injected by query.cpp, this should work:
    n.resolve(_resolver, _indexEnv);
    if (n.numFields() == 0) {
        // if received from QRS, this is needed:
        auto oldView = n.getView();
        auto newView = document::PositionDataType::getZCurveFieldName(oldView);
        n.setView(newView);
        n.resolve(_resolver, _indexEnv);
        LOG(debug, "ProtonLocationTerm found %zu field after view change %s -> %s",
            n.numFields(), oldView.c_str(), newView.c_str());
    }
}

} // namespace