Skip to content

Commit

Permalink
fix jsonindex parse string to int
Browse files Browse the repository at this point in the history
Signed-off-by: Xianhui.Lin <[email protected]>

fix unitest

Signed-off-by: Xianhui.Lin <[email protected]>

improve

Signed-off-by: Xianhui.Lin <[email protected]>
  • Loading branch information
JsDove committed Jan 9, 2025
1 parent 0a18c04 commit 1058d0b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion internal/core/src/common/Json.h
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
2 changes: 1 addition & 1 deletion internal/core/src/index/JsonKeyInvertedIndex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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++;
}
}
Expand Down
3 changes: 2 additions & 1 deletion internal/indexnode/task_stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down

0 comments on commit 1058d0b

Please sign in to comment.