index out of range bugfix

This commit is contained in:
ston1th 2016-11-17 00:01:18 +01:00
commit f4fcf0d9a8

View file

@ -225,8 +225,6 @@ func (e *Engine) GetAll(public bool) (t Titles, err error) {
return return
} }
} }
t = make(Titles, len(res.Hits)-1)
i := 0
for _, v := range res.Hits { for _, v := range res.Hits {
if v.ID == "Index" { if v.ID == "Index" {
continue continue
@ -241,8 +239,7 @@ func (e *Engine) GetAll(public bool) (t Titles, err error) {
} }
f, ok := field.(*document.TextField) f, ok := field.(*document.TextField)
if ok { if ok {
t[i] = Title{string(f.Value()), v.ID} t = append(t, Title{string(f.Value()), v.ID})
i++
break break
} }
} }