From f3ec7806f415dddcde82033436d8d7b30ab1ee11 Mon Sep 17 00:00:00 2001 From: YouROK <8YouROK8@mail.ru> Date: Mon, 13 Feb 2023 18:13:45 +0300 Subject: [PATCH] add log --- server/rutor/rutor.go | 3 +++ server/rutor/torrsearch/index.go | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/server/rutor/rutor.go b/server/rutor/rutor.go index ed44794..c984996 100644 --- a/server/rutor/rutor.go +++ b/server/rutor/rutor.go @@ -137,6 +137,9 @@ func loadDB() { log.TLogln("Index rutor db") torrsearch.NewIndex(torrs) + log.TLogln("Torrents count:", len(torrs)) + log.TLogln("Indexed words:", len(torrsearch.GetIDX())) + } else { log.TLogln("Error load rutor db:", err) } diff --git a/server/rutor/torrsearch/index.go b/server/rutor/torrsearch/index.go index 45f6e12..dd0197d 100644 --- a/server/rutor/torrsearch/index.go +++ b/server/rutor/torrsearch/index.go @@ -18,6 +18,10 @@ func Search(text string) []int { return idx.search(text) } +func GetIDX() Index { + return idx +} + func (idx Index) add(torrs []*models.TorrentDetails) { for ID, torr := range torrs { for _, token := range analyze(torr.Title) {