mirror of
https://github.com/PeernetOfficial/core.git
synced 2026-07-22 20:57:50 +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
|
// Terminate terminates all searches
|
||||||
|
|||||||
@@ -171,7 +171,11 @@ func apiSearchResult(w http.ResponseWriter, r *http.Request) {
|
|||||||
|
|
||||||
// set the status
|
// set the status
|
||||||
if len(result.Files) > 0 {
|
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 {
|
} else {
|
||||||
switch job.Status {
|
switch job.Status {
|
||||||
case SearchStatusLive:
|
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?
|
// embedded statistics?
|
||||||
if returnStats, _ := strconv.ParseBool(r.Form.Get("stats")); returnStats {
|
if returnStats, _ := strconv.ParseBool(r.Form.Get("stats")); returnStats {
|
||||||
result.Statistic = job.Statistics()
|
result.Statistic = job.Statistics()
|
||||||
|
|||||||
Reference in New Issue
Block a user