aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile4
-rw-r--r--cmd/importer/importer.go2
-rw-r--r--cmd/server/server.go2
3 files changed, 4 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index a04902b..8190661 100644
--- a/Makefile
+++ b/Makefile
@@ -2,7 +2,6 @@ BIN?=bin/dict
GO_BUILD=go build -v --tags "fts5"
GO_RUN=go run -v --tags "fts5"
-
buid: ext
$(GO_BUILD) -o $(BIN) ./cmd/dict/main.go
@@ -12,6 +11,9 @@ run: ext
import: ext
$(GO_RUN) ./cmd/dict/main.go import
+serve: ext
+ $(GO_RUN) ./cmd/dict/main.go serve
+
ext:
gcc -shared -o ext/libsqlite3ext.so -fPIC ext/spellfix.c
diff --git a/cmd/importer/importer.go b/cmd/importer/importer.go
index 18a7a7b..47b046e 100644
--- a/cmd/importer/importer.go
+++ b/cmd/importer/importer.go
@@ -88,7 +88,7 @@ func Import(ctx context.Context, txtInput, sqliteOutput string) error {
}
}
- fmt.Printf("Consolidating")
+ fmt.Printf("\nConsolidating...")
err = db.Consolidade(ctx)
if err != nil {
return err
diff --git a/cmd/server/server.go b/cmd/server/server.go
index a0de547..76fc1e5 100644
--- a/cmd/server/server.go
+++ b/cmd/server/server.go
@@ -82,14 +82,12 @@ func handleConnection(conn net.Conn, db *db.DB) {
q := strings.ReplaceAll(string(buf), "\n", "")
- slog.Info("Query", "query", q)
ws, err := db.SelectDict(context.Background(), q, 10)
if err != nil {
slog.Error("Error selecting", "error", err)
return
}
- slog.Info("Count", "q", len(ws))
for _, w := range ws {
fmt.Fprintf(conn, "%s\n%s\n\n", w.Word, w.Line)
}