diff options
author | Geir Storli <geirst@oath.com> | 2018-06-08 14:25:34 +0000 |
---|---|---|
committer | Geir Storli <geirst@oath.com> | 2018-06-08 14:26:52 +0000 |
commit | 063244d49b36a30c5f6666fd16e22e159493d7c8 (patch) | |
tree | 026234ab8bb0d377fbf4dd03f0ffa493ff2398bf /searchcore | |
parent | e424d13893a85185c4ce07deeea04e5050660d7b (diff) |
More descriptive names on internal functions.
Diffstat (limited to 'searchcore')
-rw-r--r-- | searchcore/src/vespa/searchcore/proton/attribute/document_field_extractor.cpp | 32 | ||||
-rw-r--r-- | searchcore/src/vespa/searchcore/proton/attribute/document_field_extractor.h | 8 |
2 files changed, 20 insertions, 20 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/attribute/document_field_extractor.cpp b/searchcore/src/vespa/searchcore/proton/attribute/document_field_extractor.cpp index 1aa398a23d5..64c3455be84 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/document_field_extractor.cpp +++ b/searchcore/src/vespa/searchcore/proton/attribute/document_field_extractor.cpp @@ -168,7 +168,7 @@ namespace { template <typename ExtractorFunc> std::unique_ptr<FieldValue> -getMapFieldValue(const FieldValue *outerFieldValue, const FieldPathEntry &innerEntry, ExtractorFunc &&extractor) +extractFieldFromMap(const FieldValue *outerFieldValue, const FieldPathEntry &innerEntry, ExtractorFunc &&extractor) { if (outerFieldValue != nullptr && checkInherits(*outerFieldValue, MapFieldValue::classId)) { const auto outerMap = static_cast<const MapFieldValue *>(outerFieldValue); @@ -184,7 +184,7 @@ getMapFieldValue(const FieldValue *outerFieldValue, const FieldPathEntry &innerE template <typename CollectionFieldValueT, typename ExtractorFunc> std::unique_ptr<FieldValue> -extractArrayFromStructCollection(const FieldValue *outerFieldValue, const FieldPathEntry &innerEntry, ExtractorFunc &&extractor) +extractFieldFromStructCollection(const FieldValue *outerFieldValue, const FieldPathEntry &innerEntry, ExtractorFunc &&extractor) { if (outerFieldValue != nullptr && checkInherits(*outerFieldValue, CollectionFieldValueT::classId)) { const auto *outerCollection = static_cast<const CollectionFieldValueT *>(outerFieldValue); @@ -205,30 +205,30 @@ extractArrayFromStructCollection(const FieldValue *outerFieldValue, const FieldP } std::unique_ptr<FieldValue> -DocumentFieldExtractor::getStructArrayFieldValue(const FieldPath &fieldPath) +DocumentFieldExtractor::extractFieldFromStructArray(const FieldPath &fieldPath) { - return extractArrayFromStructCollection<ArrayFieldValue>(getCachedFieldValue(fieldPath[0]), fieldPath[1], + return extractFieldFromStructCollection<ArrayFieldValue>(getCachedFieldValue(fieldPath[0]), fieldPath[1], [](const auto *elem){ return elem; }); } std::unique_ptr<FieldValue> -DocumentFieldExtractor::getMapKeyFieldValue(const FieldPath &fieldPath) +DocumentFieldExtractor::extractKeyFieldFromMap(const FieldPath &fieldPath) { - return getMapFieldValue(getCachedFieldValue(fieldPath[0]), fieldPath[1], - [](const auto &elem){ return elem.first; }); + return extractFieldFromMap(getCachedFieldValue(fieldPath[0]), fieldPath[1], + [](const auto &elem){ return elem.first; }); } std::unique_ptr<document::FieldValue> -DocumentFieldExtractor::getPrimitiveMapFieldValue(const FieldPath &fieldPath) +DocumentFieldExtractor::extractValueFieldFromPrimitiveMap(const FieldPath &fieldPath) { - return getMapFieldValue(getCachedFieldValue(fieldPath[0]), fieldPath[1], - [](const auto &elem){ return elem.second; }); + return extractFieldFromMap(getCachedFieldValue(fieldPath[0]), fieldPath[1], + [](const auto &elem){ return elem.second; }); } std::unique_ptr<document::FieldValue> -DocumentFieldExtractor::getStructMapFieldValue(const FieldPath &fieldPath) +DocumentFieldExtractor::extractValueFieldFromStructMap(const FieldPath &fieldPath) { - return extractArrayFromStructCollection<MapFieldValue>(getCachedFieldValue(fieldPath[0]), fieldPath[2], + return extractFieldFromStructCollection<MapFieldValue>(getCachedFieldValue(fieldPath[0]), fieldPath[2], [](const auto *elem){ return elem->second; }); } @@ -240,14 +240,14 @@ DocumentFieldExtractor::getFieldValue(const FieldPath &fieldPath) } else if (fieldPath.size() == 2) { auto lastElemType = fieldPath[1].getType(); if (lastElemType == FieldPathEntry::Type::STRUCT_FIELD) { - return getStructArrayFieldValue(fieldPath); + return extractFieldFromStructArray(fieldPath); } else if (lastElemType == FieldPathEntry::Type::MAP_ALL_KEYS) { - return getMapKeyFieldValue(fieldPath); + return extractKeyFieldFromMap(fieldPath); } else { - return getPrimitiveMapFieldValue(fieldPath); + return extractValueFieldFromPrimitiveMap(fieldPath); } } else if (fieldPath.size() == 3) { - return getStructMapFieldValue(fieldPath); + return extractValueFieldFromStructMap(fieldPath); } return std::unique_ptr<FieldValue>(); } diff --git a/searchcore/src/vespa/searchcore/proton/attribute/document_field_extractor.h b/searchcore/src/vespa/searchcore/proton/attribute/document_field_extractor.h index da94dda7d31..b9543bd87c8 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/document_field_extractor.h +++ b/searchcore/src/vespa/searchcore/proton/attribute/document_field_extractor.h @@ -27,10 +27,10 @@ class DocumentFieldExtractor const document::FieldValue *getCachedFieldValue(const document::FieldPathEntry &fieldPathEntry); std::unique_ptr<document::FieldValue> getSimpleFieldValue(const document::FieldPath &fieldPath); - std::unique_ptr<document::FieldValue> getStructArrayFieldValue(const document::FieldPath &fieldPath); - std::unique_ptr<document::FieldValue> getMapKeyFieldValue(const document::FieldPath &fieldPath); - std::unique_ptr<document::FieldValue> getPrimitiveMapFieldValue(const document::FieldPath &fieldPath); - std::unique_ptr<document::FieldValue> getStructMapFieldValue(const document::FieldPath &fieldPath); + std::unique_ptr<document::FieldValue> extractFieldFromStructArray(const document::FieldPath &fieldPath); + std::unique_ptr<document::FieldValue> extractKeyFieldFromMap(const document::FieldPath &fieldPath); + std::unique_ptr<document::FieldValue> extractValueFieldFromPrimitiveMap(const document::FieldPath &fieldPath); + std::unique_ptr<document::FieldValue> extractValueFieldFromStructMap(const document::FieldPath &fieldPath); public: DocumentFieldExtractor(const document::Document &doc); |