MultiSearch performs a multi-search query. It binds the incoming JSON request to a MultiSearchParameter object, executes the multi-search query, and responds with the search results. Parameters: - c: The Gin context containing the request and response. Responses: - 400 Bad Request: If there's an e
(c *gin.Context)
| 219 | // - 400 Bad Request: If there's an error in binding JSON or performing the search. |
| 220 | // - 200 OK: If the multi-search query is successfully executed and results are returned. |
| 221 | func (a Api) MultiSearch(c *gin.Context) { |
| 222 | var searchRequests api.MultiSearchSearchesParameter |
| 223 | if err := c.BindJSON(&searchRequests); err != nil { |
| 224 | c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()}) |
| 225 | return |
| 226 | } |
| 227 | |
| 228 | resp, err := a.ledgerforge.MultiSearch(&searchRequests) |
| 229 | if err != nil { |
| 230 | c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()}) |
| 231 | return |
| 232 | } |
| 233 | |
| 234 | c.JSON(http.StatusOK, resp) |
| 235 | } |