diff --git a/internal/core/src/common/Json.h b/internal/core/src/common/Json.h index 992d45646b64f..6baddeaa849ad 100644 --- a/internal/core/src/common/Json.h +++ b/internal/core/src/common/Json.h @@ -191,7 +191,8 @@ class Json { // it's always safe to add the padding, // as we have allocated the memory with this padding - auto doc = parser.parse(data_.data() + offset, length); + auto doc = parser.parse( + data_.data() + offset, length, length + simdjson::SIMDJSON_PADDING); AssertInfo(doc.error() == simdjson::SUCCESS, "failed to parse the json {}: {}", std::string(data_.data() + offset, length), diff --git a/internal/core/src/index/JsonKeyInvertedIndex.cpp b/internal/core/src/index/JsonKeyInvertedIndex.cpp index 395753ae817d1..121be27a2c6a2 100644 --- a/internal/core/src/index/JsonKeyInvertedIndex.cpp +++ b/internal/core/src/index/JsonKeyInvertedIndex.cpp @@ -82,7 +82,7 @@ JsonKeyInvertedIndex::TravelJson(const char* json, } else if (current.type == JSMN_STRING) { Assert(current.size == 0); AddInvertedRecord( - path, offset, current.start, current.end - current.start); + path, offset, current.start - 1, current.end - current.start + 1); index++; } } diff --git a/internal/indexnode/task_stats.go b/internal/indexnode/task_stats.go index f153360dde62f..02e649994c44d 100644 --- a/internal/indexnode/task_stats.go +++ b/internal/indexnode/task_stats.go @@ -332,7 +332,8 @@ func (st *statsTask) Execute(ctx context.Context) error { log.Ctx(ctx).Warn("stats wrong, failed to create text index", zap.Error(err)) return err } - } else if st.req.GetSubJobType() == indexpb.StatsSubJob_JsonKeyIndexJob { + } + if st.req.GetSubJobType() == indexpb.StatsSubJob_Sort || st.req.GetSubJobType() == indexpb.StatsSubJob_JsonKeyIndexJob { err = st.createJSONKeyIndex(ctx, st.req.GetStorageConfig(), st.req.GetCollectionID(),