diff --git a/engine.go b/engine.go index 4437837..991dc32 100644 --- a/engine.go +++ b/engine.go @@ -14,7 +14,7 @@ import ( const timeFmt = "2006-01-02 15:04:05" -var titleRe = regexp.MustCompile("[^a-zA-Z0-9+]+") +var titleRe = regexp.MustCompile("[^a-zA-Z0-9+ ]+") func now() string { return time.Now().Format(timeFmt) @@ -225,8 +225,6 @@ func (e *Engine) GetAll(public bool) (t Titles, err error) { return } } - t = make(Titles, len(res.Hits)-1) - i := 0 for _, v := range res.Hits { if v.ID == "Index" { continue @@ -241,8 +239,7 @@ func (e *Engine) GetAll(public bool) (t Titles, err error) { } f, ok := field.(*document.TextField) if ok { - t[i] = Title{string(f.Value()), v.ID} - i++ + t = append(t, Title{string(f.Value()), v.ID}) break } }