mirror of
https://github.com/PeernetOfficial/core.git
synced 2026-07-17 02:47:51 +01:00
webapi: /search/result always return stats if requested
This commit is contained in:
@@ -177,7 +177,7 @@ func apiSearchResult(w http.ResponseWriter, r *http.Request) {
|
||||
result.Status = 1 // No more results to expect
|
||||
|
||||
// embedded statistics?
|
||||
if returnStats, _ := strconv.ParseBool(r.Form.Get("stats")); returnStats && len(result.Files) > 0 {
|
||||
if returnStats, _ := strconv.ParseBool(r.Form.Get("stats")); returnStats {
|
||||
result.Statistic = job.Statistics()
|
||||
}
|
||||
|
||||
|
||||
@@ -627,7 +627,7 @@ This function returns search results. The default limit is 100.
|
||||
|
||||
If reset is set, all results will be filtered and sorted according to the provided parameters. This means that the new first result will be returned again and internal result offset is set to 0. Note that most filters must be set to -1 if they are not used (see the field comments in the `SearchRequest` structure in `/search` above).
|
||||
|
||||
The statistics of all results (regardless of applied runtime filters) can be returned immediately in the `statistics` field by specifying `&stats=1`. If will be only provided if the statistics change, i.e. if at least one file is returned. The returned statistics is the `SearchStatisticData` structure and matches with what is returned by `/search/statistic`.
|
||||
The statistics of all results (regardless of applied runtime filters) can be returned immediately in the `statistics` field by specifying `&stats=1`. The returned statistics is the `SearchStatisticData` structure and matches with what is returned by `/search/statistic`.
|
||||
|
||||
Note that the date format for the `&from=` and `&to=` parameters is "2006-01-02 15:04:05" which is different to native JSON time encoding used elsewhere. The time zone is UTC.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user