Fix returned status in /search/result

This commit is contained in:
Kleissner
2021-12-14 16:08:02 +01:00
parent 9262acba88
commit a67c67b7f9
3 changed files with 29 additions and 3 deletions

View File

@@ -48,6 +48,9 @@ type SearchJob struct {
// -- result data --
// Status indicates the overall search status. This will be removed later when relying on search clients.
Status int
// runtime data
//clients []*SearchClient // all search clients
clientsMutex sync.Mutex // mutex for manipulating client list
@@ -67,10 +70,18 @@ type SearchJob struct {
currentOffset int // for always getting the next results
}
const (
SearchStatusNotStarted = iota // Search was not yet started
SearchStatusLive // Search running
SearchStatusTerminated // Search is terminated. No more results are expected.
SearchStatusNoIndex // Search is terminated. No search index to use.
)
// CreateSearchJob creates a new search job and adds it to the lookup list.
// Timeout and MaxResults must be set and must not be 0.
func CreateSearchJob(Timeout time.Duration, MaxResults int, Filter SearchFilter) (job *SearchJob) {
job = &SearchJob{}
job.Status = SearchStatusNotStarted
job.id = uuid.New()
job.timeout = Timeout
job.maxResult = MaxResults