diff --git a/internal/core/src/common/Json.h b/internal/core/src/common/Json.h index 0aa91a558f..970d3621df 100644 --- a/internal/core/src/common/Json.h +++ b/internal/core/src/common/Json.h @@ -90,6 +90,13 @@ class Json { cap); } + // WARN: this is used for fast non-copy construction, + // MUST make sure there at least SIMDJSON_PADDING bytes allocated + // after the string_view + explicit Json(const std::string_view& data) + : Json(data.data(), data.size()) { + } + // WARN: this is used for fast non-copy construction, // MUST make sure that the data points to a memory that // with size at least len + SIMDJSON_PADDING diff --git a/internal/core/src/segcore/SegmentInterface.h b/internal/core/src/segcore/SegmentInterface.h index 1bb0e5a8fa..33d4f55727 100644 --- a/internal/core/src/segcore/SegmentInterface.h +++ b/internal/core/src/segcore/SegmentInterface.h @@ -196,7 +196,7 @@ class SegmentInternalInterface : public SegmentInterface { std::vector res; res.reserve(string_views.size()); for (const auto& str_view : string_views) { - res.emplace_back(str_view); + res.emplace_back(Json(str_view)); } return PinWrapper< std::pair, FixedVector>>(