mirror of
https://github.com/PeernetOfficial/core.git
synced 2026-07-16 18:37:51 +01:00
Search results: Immediately (with results) signal if no more results will be available (search terminated).
This commit is contained in:
@@ -359,7 +359,7 @@ func (job *SearchJob) IsTerminated() bool {
|
||||
// }
|
||||
// }
|
||||
|
||||
return false
|
||||
return job.Status == SearchStatusTerminated || job.Status == SearchStatusNoIndex
|
||||
}
|
||||
|
||||
// Terminate terminates all searches
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user