Return confidence rating

This commit is contained in:
Mouse Reeve 2021-08-10 14:02:22 -07:00
parent fa396d4bc8
commit ef1896da18

View file

@ -85,7 +85,7 @@ class ImportItem(models.Model):
if self.isbn: if self.isbn:
self.book = self.get_book_from_isbn() self.book = self.get_book_from_isbn()
else: else:
# don't fall back on title/author search is isbn is present. # don't fall back on title/author search if isbn is present.
# you're too likely to mismatch # you're too likely to mismatch
book, confidence = self.get_book_from_title_author() book, confidence = self.get_book_from_title_author()
if confidence > 0.999: if confidence > 0.999:
@ -111,7 +111,10 @@ class ImportItem(models.Model):
) )
if search_result: if search_result:
# raises ConnectorException # raises ConnectorException
return search_result.connector.get_or_create_book(search_result.key) return (
search_result.connector.get_or_create_book(search_result.key),
search_result.confidence,
)
return None, 0 return None, 0
@property @property