diff --git a/cmd/ui/ui.go b/cmd/ui/ui.go
index 50b854328935a0a51ff79a78d5e66c0c66b60b82..a12a66699b010842f1c32a50655cfd3899379189 100644
--- a/cmd/ui/ui.go
+++ b/cmd/ui/ui.go
@@ -13,10 +13,6 @@
"git.gabrielgio.me/dict/db"
)
-const (
- memory = ":memory:"
-)
-
var UICommand = &cli.Command{
Name: "ui",
Usage: "interactive dictionary",
@@ -34,12 +30,7 @@ },
}
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 @@ defer tx.Unlock()
search = v
go func(v string) {
- words, err := db.SelectDict(ctx, v, 100)
+ words, err := db.SelectDict(ctx, v, 20)
if err != nil {
return
}
diff --git a/db/db.go b/db/db.go
index c3699d79fe965aea28372e1b68f1950d4775fb86..24c2a31e219d10174de8923941f207f4496cb93c 100644
--- a/db/db.go
+++ b/db/db.go
@@ -57,7 +57,7 @@ ctx,
`SELECT
word, line
FROM words
- WHERE word MATCH ?
+ WHERE words MATCH ?
ORDER BY rank
LIMIT ?;`,
query, limit,