From f0ff2c99e08f967a8547318bbe83249d43278890 Mon Sep 17 00:00:00 2001 From: laureanray Date: Thu, 29 Jun 2023 13:11:59 +0800 Subject: [PATCH] enable num of results for current mirror --- internal/mirror/current_mirror.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/mirror/current_mirror.go b/internal/mirror/current_mirror.go index e2ef65b..d1cd5f5 100644 --- a/internal/mirror/current_mirror.go +++ b/internal/mirror/current_mirror.go @@ -48,9 +48,9 @@ func (m *CurrentMirror) SearchByTitle(query string) ([]book.Book, error) { page := documentparser.NewCurrentDocumentParser(document) bookResults := page.GetBookDataFromDocument() - // if len(bookResults) >= limit { - // bookResults = bookResults[:limit] - // } + if len(bookResults) >= m.config.numberOfResults { + bookResults = bookResults[:m.config.numberOfResults] + } return bookResults, err } @@ -73,9 +73,9 @@ func (m *CurrentMirror) SearchByAuthor(query string) ([]book.Book, error) { page := documentparser.NewCurrentDocumentParser(document) bookResults := page.GetBookDataFromDocument() - // if len(bookResults) >= limit { - // bookResults = bookResults[:limit] - // } + if len(bookResults) >= m.config.numberOfResults { + bookResults = bookResults[:m.config.numberOfResults] + } return bookResults, err }