From aeea1c3fee78cedd08b1e1e7332ecafd3682c80e Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Sun, 3 May 2020 13:32:23 -0700 Subject: [PATCH] Adds dedplication back in --- fedireads/books_manager.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/fedireads/books_manager.py b/fedireads/books_manager.py index 049e55a1..ee6941a0 100644 --- a/fedireads/books_manager.py +++ b/fedireads/books_manager.py @@ -32,15 +32,21 @@ def load_more_data(book_id): def search(query, first=False): ''' find books based on arbitary keywords ''' results = [] + dedup_slug = lambda r: '%s/%s/%s' % (r.title, r.author, r.year) + result_index = [] for connector in get_connectors(): result = connector.search(query) if first and result: return result[0] + + result = [r for r in result if dedup_slug(r) not in result_index] + result_index += [dedup_slug(r) for r in result] results.append({ 'connector': connector, 'results': result, }) + return results