Skip to content

Commit 659fcac

Browse files
authored
Merge pull request #2524 from aduffeck/fix-bleve-batches
Fix bleve batches
2 parents 210d282 + 71c0a46 commit 659fcac

2 files changed

Lines changed: 21 additions & 1 deletion

File tree

services/search/pkg/bleve/batch.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ func (b *Batch) Move(id, parentID, location string) error {
7171
if err := b.batch.Index(resource.ID, resource); err != nil {
7272
return err
7373
}
74+
if b.batch.Size() >= b.size {
75+
if err := b.Push(); err != nil {
76+
return err
77+
}
78+
}
7479
}
7580

7681
return nil
@@ -88,6 +93,11 @@ func (b *Batch) Delete(id string) error {
8893
if err := b.batch.Index(resource.ID, resource); err != nil {
8994
return err
9095
}
96+
if b.batch.Size() >= b.size {
97+
if err := b.Push(); err != nil {
98+
return err
99+
}
100+
}
91101
}
92102

93103
return nil
@@ -105,6 +115,11 @@ func (b *Batch) Restore(id string) error {
105115
if err := b.batch.Index(resource.ID, resource); err != nil {
106116
return err
107117
}
118+
if b.batch.Size() >= b.size {
119+
if err := b.Push(); err != nil {
120+
return err
121+
}
122+
}
108123
}
109124

110125
return nil
@@ -142,6 +157,11 @@ func (b *Batch) Purge(id string, onlyDeleted bool) error {
142157

143158
for _, resource := range affectResources {
144159
b.batch.Delete(resource.ID)
160+
if b.batch.Size() >= b.size {
161+
if err := b.Push(); err != nil {
162+
return err
163+
}
164+
}
145165
}
146166

147167
return nil

services/search/pkg/config/defaults/defaultconfig.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ func DefaultConfig() *config.Config {
6464
AckWait: 1 * time.Minute,
6565
},
6666
ContentExtractionSizeLimit: 20 * 1024 * 1024, // Limit content extraction to <20MB files by default
67-
BatchSize: 500,
67+
BatchSize: 50,
6868
}
6969
}
7070

0 commit comments

Comments
 (0)