From 7044d2aaee5733a9d9b0f242ee98e8d4a3750264 Mon Sep 17 00:00:00 2001 From: rr- Date: Sun, 12 Mar 2017 18:30:42 +0100 Subject: [PATCH] server/posts: ignore old elasticsearch results --- server/szurubooru/func/posts.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/server/szurubooru/func/posts.py b/server/szurubooru/func/posts.py index aa4e137f..fffefa94 100644 --- a/server/szurubooru/func/posts.py +++ b/server/szurubooru/func/posts.py @@ -682,10 +682,12 @@ def search_by_image_exact(image_content: bytes) -> Optional[model.Post]: def search_by_image(image_content: bytes) -> List[PostLookalike]: ret = [] for result in image_hash.search_by_image(image_content): - ret.append(PostLookalike( - score=result.score, - distance=result.distance, - post=get_post_by_id(result.path))) + post = try_get_post_by_id(result.path) + if post: + ret.append(PostLookalike( + score=result.score, + distance=result.distance, + post=post)) return ret