Skip to content

Commit

Permalink
enhance: add recalls response for restful api
Browse files Browse the repository at this point in the history
Signed-off-by: chasingegg <[email protected]>
  • Loading branch information
chasingegg committed Jan 17, 2025
1 parent 57ba8a7 commit 6a07c7c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions internal/distributed/proxy/httpserver/constant.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ const (
HTTPReturnMessage = "message"
HTTPReturnData = "data"
HTTPReturnCost = "cost"
HTTPReturnRecalls = "recalls"
HTTPReturnLoadState = "loadState"
HTTPReturnLoadProgress = "loadProgress"

Expand Down
6 changes: 5 additions & 1 deletion internal/distributed/proxy/httpserver/handler_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -1010,7 +1010,11 @@ func (h *HandlersV2) search(ctx context.Context, c *gin.Context, anyReq any, dbN
HTTPReturnMessage: merr.ErrInvalidSearchResult.Error() + ", error: " + err.Error(),
})
} else {
HTTPReturn(c, http.StatusOK, gin.H{HTTPReturnCode: merr.Code(nil), HTTPReturnData: outputData, HTTPReturnCost: cost})
if len(searchResp.Results.Recalls) > 0 {
HTTPReturn(c, http.StatusOK, gin.H{HTTPReturnCode: merr.Code(nil), HTTPReturnData: outputData, HTTPReturnCost: cost, HTTPReturnRecalls: searchResp.Results.Recalls})

Check warning on line 1014 in internal/distributed/proxy/httpserver/handler_v2.go

View check run for this annotation

Codecov / codecov/patch

internal/distributed/proxy/httpserver/handler_v2.go#L1014

Added line #L1014 was not covered by tests
} else {
HTTPReturn(c, http.StatusOK, gin.H{HTTPReturnCode: merr.Code(nil), HTTPReturnData: outputData, HTTPReturnCost: cost})
}
}
}
}
Expand Down

0 comments on commit 6a07c7c

Please sign in to comment.