diff --git a/webapi/Search.go b/webapi/Search.go index a22ee12..7b05987 100644 --- a/webapi/Search.go +++ b/webapi/Search.go @@ -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() } diff --git a/webapi/readme.md b/webapi/readme.md index 1d22fd7..f2c6d66 100644 --- a/webapi/readme.md +++ b/webapi/readme.md @@ -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.