Rebuild index for accounts
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user