mirror of
https://github.com/Ernous/TorrServerJellyfin.git
synced 2025-12-19 21:46:11 +05:00
fix search
This commit is contained in:
@@ -2,7 +2,6 @@ package torrsearch
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"server/rutor/models"
|
"server/rutor/models"
|
||||||
"strconv"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Index is an inverted Index. It maps tokens to document IDs.
|
// Index is an inverted Index. It maps tokens to document IDs.
|
||||||
@@ -21,7 +20,7 @@ func Search(text string) []int {
|
|||||||
|
|
||||||
func (idx Index) add(torrs []*models.TorrentDetails) {
|
func (idx Index) add(torrs []*models.TorrentDetails) {
|
||||||
for ID, torr := range torrs {
|
for ID, torr := range torrs {
|
||||||
for _, token := range analyze(torr.Name + " " + torr.GetNames() + " " + strconv.Itoa(torr.Year)) {
|
for _, token := range analyze(torr.Title) {
|
||||||
ids := idx[token]
|
ids := idx[token]
|
||||||
if ids != nil && ids[len(ids)-1] == ID {
|
if ids != nil && ids[len(ids)-1] == ID {
|
||||||
// Don't add same ID twice.
|
// Don't add same ID twice.
|
||||||
|
|||||||
Reference in New Issue
Block a user