diff options
-rw-r--r-- | cmd/ui/ui.go | 13 | ||||
-rw-r--r-- | db/db.go | 2 |
2 files changed, 3 insertions, 12 deletions
diff --git a/cmd/ui/ui.go b/cmd/ui/ui.go index 50b8543..a12a666 100644 --- a/cmd/ui/ui.go +++ b/cmd/ui/ui.go @@ -13,10 +13,6 @@ import ( "git.gabrielgio.me/dict/db" ) -const ( - memory = ":memory:" -) - var UICommand = &cli.Command{ Name: "ui", Usage: "interactive dictionary", @@ -34,12 +30,7 @@ var UICommand = &cli.Command{ } func Run(ctx context.Context, name string) error { - db, err := db.Open(memory) - if err != nil { - return err - } - - err = db.Restore(ctx, name) + db, err := db.Open(name) if err != nil { return err } @@ -61,7 +52,7 @@ func Run(ctx context.Context, name string) error { search = v go func(v string) { - words, err := db.SelectDict(ctx, v, 100) + words, err := db.SelectDict(ctx, v, 20) if err != nil { return } @@ -57,7 +57,7 @@ func (d *DB) SelectDict(ctx context.Context, query string, limit int) ([]*Word, `SELECT word, line FROM words - WHERE word MATCH ? + WHERE words MATCH ? ORDER BY rank LIMIT ?;`, query, limit, |