minor bugfixes and cleanup

This commit is contained in:
ston1th 2018-09-19 00:10:16 +02:00
commit 97d914bce4
26 changed files with 198 additions and 221 deletions

View file

@ -21,10 +21,7 @@ This is the [Index](/wiki/Index) page.
You can customize it how you like.`
)
/*const (
maxResult = 1e6
maxSearchResult = 101
)*/
const blevePath = "bleve"
func dbErr(i interface{}) error {
return fmt.Errorf("db: %s", i)
@ -37,13 +34,12 @@ type DB struct {
Index *index.Index
}
func New(indexPath string) (db *DB, err error) {
func New(datadir string) (db *DB, err error) {
db = &DB{cache: cache.NewCache()}
//TODO
//db.Index, err = index.NewIndex(indexPath)
//if err != nil {
// return
//}
db.Index, err = index.NewIndex(datadir + "/" + blevePath)
if err != nil {
return
}
db.users, err = store.NewBoltStore(usersFile, nil)
if err != nil {
@ -80,7 +76,5 @@ func (db *DB) Close() error {
if err != nil {
return err
}
return nil
//TODO
//return db.Index.Close()
return db.Index.Close()
}