diff --git a/index/store/gouchstore/batch.go b/index/store/gouchstore/batch.go index 603b33dc..dd96f3af 100644 --- a/index/store/gouchstore/batch.go +++ b/index/store/gouchstore/batch.go @@ -18,12 +18,15 @@ func newGouchstoreBatch(store *GouchstoreStore) *GouchstoreBatch { } func (gb *GouchstoreBatch) Set(key, val []byte) { - doc, docInfo := kvToDocDocInfo(key, val) + id := string(key) + doc := &gouchstore.Document{ID: id, Body: val} + docInfo := &gouchstore.DocumentInfo{ID: id, ContentMeta: gouchstore.DOC_IS_COMPRESSED} gb.bulk.Set(docInfo, doc) } func (gb *GouchstoreBatch) Delete(key []byte) { - _, docInfo := kvToDocDocInfo(key, nil) + id := string(key) + docInfo := &gouchstore.DocumentInfo{ID: id, ContentMeta: gouchstore.DOC_IS_COMPRESSED} gb.bulk.Delete(docInfo) } diff --git a/index/store/gouchstore/store.go b/index/store/gouchstore/store.go index 1320e349..67250647 100644 --- a/index/store/gouchstore/store.go +++ b/index/store/gouchstore/store.go @@ -25,12 +25,17 @@ func Open(path string) (*GouchstoreStore, error) { } func (gs *GouchstoreStore) Get(key []byte) ([]byte, error) { - docInfo, err := gs.db.DocumentInfoById(string(key)) + var docInfo gouchstore.DocumentInfo + err := gs.db.DocumentInfoByIdNoAlloc(string(key), &docInfo) if err != nil && err.Error() != "document not found" { return nil, err } - if docInfo != nil && !docInfo.Deleted { - doc, err := gs.db.DocumentById(string(key)) + if err != nil && err.Error() == "document not found" { + return nil, nil + } + var doc gouchstore.Document + if !docInfo.Deleted { + err := gs.db.DocumentByIdNoAlloc(string(key), &doc) if err != nil { return nil, err }