This commit is contained in:
YouROK
2023-02-13 18:13:45 +03:00
parent 2e04c93cd2
commit f3ec7806f4
2 changed files with 7 additions and 0 deletions

View File

@@ -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)
}

View File

@@ -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) {