Rebuild index for accounts

This commit is contained in:
Benedikt Kulmann
2020-10-23 14:45:37 +02:00
parent f89c05cf61
commit 03a0c3d5e5
5 changed files with 69 additions and 6 deletions
+11
View File
@@ -19,6 +19,17 @@ func (s Service) RebuildIndex(ctx context.Context, request *proto.RebuildIndexRe
return err
}
accounts := make([]*proto.Account, 0)
if err := s.repo.LoadAccounts(ctx, accounts); err != nil {
return err
}
for i := range accounts {
_, err := s.index.Add(accounts[i])
if err != nil {
return err
}
}
// TODO: read all the documents and add them to the indexer.
return nil
+1 -1
View File
@@ -75,7 +75,7 @@ func New(opts ...Option) (s *Service, err error) {
func (s Service) buildIndex() (*indexer.Indexer, error) {
idx := indexer.CreateIndexer(s.Config)
if err := createIndices(idx, s.Config); err != nil {
if err := recreateContainers(idx, s.Config); err != nil {
return nil, err
}
return idx, nil