some tests and major cleanup

This commit is contained in:
ston1th 2018-10-19 23:08:32 +02:00
commit 16671b3406
30 changed files with 192057 additions and 202431 deletions

View file

@ -3,7 +3,7 @@
package index
import (
"fmt"
"errors"
"git.giftfish.de/ston1th/gowiki/pkg/core"
"github.com/blevesearch/bleve"
"html/template"
@ -18,10 +18,6 @@ type indexPage struct {
Search string `json:"search"`
}
func indexErr(i interface{}) error {
return fmt.Errorf("index: %s", i)
}
type Index struct {
i bleve.Index
}
@ -32,13 +28,13 @@ func NewIndex(path string) (i *Index, err error) {
mapping := bleve.NewIndexMapping()
bi, err = bleve.New(path, mapping)
if err != nil {
err = indexErr(err)
err = errors.New("index: " + err.Error())
return
}
} else {
bi, err = bleve.Open(path)
if err != nil {
err = indexErr(err)
err = errors.New("index: " + err.Error())
return
}
}