| 461 | } |
| 462 | |
| 463 | func typesenseHasData(ctx context.Context, client *TypesenseClient) bool { |
| 464 | resp, err := client.Client.Collection(CollectionTransactions).Retrieve(ctx) |
| 465 | if err != nil { |
| 466 | logrus.WithError(err).Debug("could not retrieve transactions collection for reindex") |
| 467 | return true |
| 468 | } |
| 469 | if resp.NumDocuments == nil { |
| 470 | return false |
| 471 | } |
| 472 | return *resp.NumDocuments > 0 |
| 473 | } |
| 474 | |
| 475 | func shouldReindex(ctx context.Context, client *TypesenseClient, ds database.IDataSource) bool { |
| 476 | if !dbHasData(ctx, ds) { |