fixed Document() behavior ot return nil when doc doesn't exist
This commit is contained in:
parent
27f001bc14
commit
3309c698f8
|
@ -541,6 +541,14 @@ func (udc *UpsideDownCouch) DocIdReader(start, end string) (index.DocIdReader, e
|
||||||
}
|
}
|
||||||
|
|
||||||
func (udc *UpsideDownCouch) Document(id string) (*document.Document, error) {
|
func (udc *UpsideDownCouch) Document(id string) (*document.Document, error) {
|
||||||
|
// first hit the back index to confirm doc exists
|
||||||
|
backIndexRow, err := udc.backIndexRowForDoc(id)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if backIndexRow == nil {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
rv := document.NewDocument(id)
|
rv := document.NewDocument(id)
|
||||||
storedRow := NewStoredRow(id, 0, []uint64{}, 'x', nil)
|
storedRow := NewStoredRow(id, 0, []uint64{}, 'x', nil)
|
||||||
storedRowScanPrefix := storedRow.ScanPrefixForDoc()
|
storedRowScanPrefix := storedRow.ScanPrefixForDoc()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user