When I delete all entries and try to open the writer it is failing with the following errors
error loading snapshot epoch: 18: error peeking snapshot format version 18: EOF from writer.go
error opening index: existing snapshots found, but none could be loaded, exiting
This error is not happening If I leave at least one entry.
config := bluge.DefaultConfig("index-data")
writer, err := bluge.OpenWriter(config)
if err != nil {
log.Println(err)
return
}
doc := bluge.NewDocument("a1")
doc.AddField(bluge.NewTextField("TestKey1", "TestKey Data1"))
if err = writer.Update(doc.ID(), doc); err != nil {
log.Println(err)
return
}
doc = bluge.NewDocument("a2")
doc.AddField(bluge.NewTextField("TestKey2", "TestKey Data2"))
if err = writer.Update(doc.ID(), doc); err != nil {
log.Println(err)
return
}
writer.Close()
writer, err = bluge.OpenWriter(config)
if err != nil {
log.Println(err)
return
}
if err = writer.Delete(bluge.Identifier("a1")); err != nil {
log.Println(err)
return
}
if writer.Delete(bluge.Identifier("a2")); err != nil { // If I dont remove this second entry everything working fine
log.Println(err)
return
}
writer.Close()
writer, err = bluge.OpenWriter(config)
if err != nil {
log.Println(err)
return
}
writer.Close()