time taken to do search, increase ivfflat probes

This commit is contained in:
Dylan Knutson
2025-07-30 19:51:39 +00:00
parent 154c9787d6
commit 335c1a3c6d
3 changed files with 6 additions and 1 deletions

View File

@@ -156,11 +156,13 @@ class Domain::PostsController < DomainController
@uploaded_image_data_uri = create_thumbnail(image_path, content_type)
@uploaded_hash_value = generate_fingerprint(image_path)
@uploaded_detail_hash_value = generate_detail_fingerprint(image_path)
before = Time.now
similar_fingerprints =
helpers.find_similar_fingerprints(
fingerprint_value: @uploaded_hash_value,
fingerprint_detail_value: @uploaded_detail_hash_value,
).take(10)
@time_taken = Time.now - before
@matches = similar_fingerprints
@good_matches =

View File

@@ -90,7 +90,7 @@ module Domain
oversearch: 2,
includes: {}
)
ActiveRecord::Base.connection.execute("SET ivfflat.probes = 10")
ActiveRecord::Base.connection.execute("SET ivfflat.probes = 20")
Domain::PostFile::BitFingerprint
.order(

View File

@@ -36,6 +36,9 @@
No results found
<% end %>
</div>
<div class="text-gray-400 text-xs">
<%= "took #{(@time_taken * 1000).round(1)} ms" %>
</div>
</div>
</div>
<div class="flex flex-wrap gap-3 justify-center max-w-full">