I think a potential fix for this could be made in scorch.go. Bleve currently does the following when using indexes in read-only mode:
if s.readOnly {
rootBoltOpt.ReadOnly = true
}
Bolt allows you to specify your own function for opening files, however, so Bleve could be updated to add a function that looks something like:
func openReadOnlyBoltFile(path string, flag int, mode os.FileMode) (*os.File, error) {
file, err := os.OpenFile(path, flag, mode)
if err != nil {
file, err = os.OpenFile(path, os.O_RDONLY, mode)
}
return file, err
}
Then the if block above could be modified to:
if s.readOnly {
rootBoltOpt.ReadOnly = true
rootBoltOpt.OpenFile = openReadOnlyBoltFile
}
This resolves the issue for me, but admittedly looks more like a workaround than a clean fix. I'd welcome any thoughts on whether this looks like a viable approach for this issue.
Thank you,
Chris