diff options
| author | Hunternif <hunternif@gmail.com> | 2022-10-02 04:52:36 +0100 |
|---|---|---|
| committer | Hunternif <hunternif@gmail.com> | 2022-10-02 04:52:36 +0100 |
| commit | e1ea5f54f5d6b7364e28b34d69bb7862f44a9b04 (patch) | |
| tree | 7a5bd8e425c3e87828c1dd9e8d5855d88552a17c | |
| parent | 757d0ee8a6fc54e10d6f7c28d79b927d8eb0382d (diff) | |
server: fix post count for lookalikes
| -rw-r--r-- | server/szurubooru/api/post_api.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/server/szurubooru/api/post_api.py b/server/szurubooru/api/post_api.py index 3a35bf8..b89a7f6 100644 --- a/server/szurubooru/api/post_api.py +++ b/server/szurubooru/api/post_api.py @@ -331,8 +331,9 @@ def get_posts_lookalikes( post_id = _get_post_id(params) post = posts.get_post_by_id(post_id) sig = image_hash.unpack_signature(post.signature.signature) - lookalikes = posts.search_by_signature(sig, limit, threshold) - # exclude the same post: + # limit + 1 because the original post will be excluded + lookalikes = posts.search_by_signature(sig, limit + 1, threshold) + # exclude the original post: lookalikes = filter(lambda la: la[1].post_id != post_id, lookalikes) lookalikes = sorted(lookalikes, key=lambda la: la[0]) return { |