0
0
Fork 0

scorch InternalID() handles case of unknown docId

This commit is contained in:
Steve Yen 2017-11-30 08:36:01 -08:00
parent 848aca4639
commit 67986d41bf
2 changed files with 9 additions and 1 deletions

View File

@ -93,6 +93,14 @@ func TestIndexReader(t *testing.T) {
t.Errorf("count was 2, but only saw %d", actualCount)
}
internalIDBogus, err := indexReader.InternalID("a-bogus-docId")
if err != nil {
t.Fatal(err)
}
if internalIDBogus != nil {
t.Errorf("expected bogus docId to have nil InternalID")
}
internalID2, err := indexReader.InternalID("2")
if err != nil {
t.Fatal(err)

View File

@ -256,7 +256,7 @@ func (i *IndexSnapshot) InternalID(id string) (rv index.IndexInternalID, err err
}()
next, err := tfr.Next(nil)
if err != nil {
if err != nil || next == nil {
return nil, err
}