Adds dedplication back in

This commit is contained in:
Mouse Reeve 2020-05-03 13:32:23 -07:00
parent ace1daa1f9
commit aeea1c3fee

View file

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