Skip to content

Commit c1bf5dc

Browse files
committed
Fix perceptual distance index usage
1 parent cf3d697 commit c1bf5dc

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

plugins/imaging.py

+4
Original file line numberDiff line numberDiff line change
@@ -320,13 +320,17 @@ async def robot9000(self, ctx: commands.Context, *, text_query: Optional[str] =
320320
(textual_similarity_column >= self.IMAGE9000_TEXTUAL_SIMILARITY_TRESHOLD)
321321
)
322322
)
323+
.order_by("perceptual_distance")
324+
.limit(20)
323325
):
324326
similar[other_image9000]["visual"] = 1 - perceptual_distance / self.IMAGE9000_HASH_BIT_COUNT
325327
similar[other_image9000]["textual"] = textual_similarity
326328
else:
327329
for other_image9000, perceptual_distance in (
328330
server_images.add_column(perceptual_distance_column)
329331
.filter(perceptual_distance_column <= self.IMAGE9000_ACCEPTABLE_PERCEPTUAL_DISTANCE)
332+
.order_by("perceptual_distance")
333+
.limit(20)
330334
):
331335
similar[other_image9000]["visual"] = 1 - perceptual_distance / self.IMAGE9000_HASH_BIT_COUNT
332336

0 commit comments

Comments
 (0)