some tests and major cleanup
This commit is contained in:
parent
8ef2a2547c
commit
16671b3406
30 changed files with 192057 additions and 202431 deletions
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue