Merge pull request #31 from lbryio/bugfix/x/jeffreypicard/return-empty-list-on-no-index

Fix behavior when the index isn't there.
This commit is contained in:
Alex Grin 2022-01-10 11:30:26 -05:00 committed by GitHub
commit 78f35cc96c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -260,6 +260,7 @@ func (s *Server) Search(ctx context.Context, in *pb.SearchRequest) (*pb.Outputs,
res, err := client.IndexStats(searchIndices[0]).Do(ctx) res, err := client.IndexStats(searchIndices[0]).Do(ctx)
if err != nil { if err != nil {
log.Printf("Error on ES index stats\n%v\n", err) log.Printf("Error on ES index stats\n%v\n", err)
return &pb.Outputs{}, nil
} }
numRefreshes := res.Indices[searchIndices[0]].Primaries.Refresh.Total numRefreshes := res.Indices[searchIndices[0]].Primaries.Refresh.Total
if numRefreshes != s.NumESRefreshes { if numRefreshes != s.NumESRefreshes {