index out of range bugfix
This commit is contained in:
parent
3f79fc8e6c
commit
f4fcf0d9a8
1 changed files with 2 additions and 5 deletions
|
|
@ -14,7 +14,7 @@ import (
|
||||||
|
|
||||||
const timeFmt = "2006-01-02 15:04:05"
|
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 {
|
func now() string {
|
||||||
return time.Now().Format(timeFmt)
|
return time.Now().Format(timeFmt)
|
||||||
|
|
@ -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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue