We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ca23789 commit 16404c3Copy full SHA for 16404c3
modules/indexer/bleve/batch.go
@@ -27,13 +27,15 @@ func NewFlushingBatch(index bleve.Index, maxBatchSize int) *FlushingBatch {
27
}
28
29
30
+// Index add a new index to batch
31
func (b *FlushingBatch) Index(id string, data interface{}) error {
32
if err := b.batch.Index(id, data); err != nil {
33
return err
34
35
return b.flushIfFull()
36
37
38
+// Delete add a delete index to batch
39
func (b *FlushingBatch) Delete(id string) error {
40
b.batch.Delete(id)
41
@@ -46,6 +48,7 @@ func (b *FlushingBatch) flushIfFull() error {
46
48
return b.Flush()
47
49
50
51
+// Flush submit the batch and create a new one
52
func (b *FlushingBatch) Flush() error {
53
err := b.index.Batch(b.batch)
54
if err != nil {
0 commit comments