diff --git a/webapi/Search Job.go b/webapi/Search Job.go index 80f1f9f..9a79dcf 100644 --- a/webapi/Search Job.go +++ b/webapi/Search Job.go @@ -359,7 +359,7 @@ func (job *SearchJob) IsTerminated() bool { // } // } - return false + return job.Status == SearchStatusTerminated || job.Status == SearchStatusNoIndex } // Terminate terminates all searches diff --git a/webapi/Search.go b/webapi/Search.go index 3c44761..b954f4c 100644 --- a/webapi/Search.go +++ b/webapi/Search.go @@ -171,7 +171,11 @@ func apiSearchResult(w http.ResponseWriter, r *http.Request) { // set the status if len(result.Files) > 0 { - result.Status = 0 // 0 = Success with results + if job.IsSearchResults() { + result.Status = 0 // 0 = Success with results + } else { + result.Status = 1 // No more results to expect + } } else { switch job.Status { case SearchStatusLive: @@ -185,8 +189,6 @@ func apiSearchResult(w http.ResponseWriter, r *http.Request) { } } - //if !job.IsSearchResults() { // if no fresh results to be expected - // embedded statistics? if returnStats, _ := strconv.ParseBool(r.Form.Get("stats")); returnStats { result.Statistic = job.Statistics()