manager: use the same trigram threshold for searching the journal and the users (#69191)

The search duplicate threshold is high to limit the number of false
positive, in a free text search settting we want as much results as we
can.
This commit is contained in:
Benjamin Dauvergne 2022-09-19 14:59:04 +02:00
parent 5d62a0d727
commit 1b51c4082f
1 changed files with 2 additions and 1 deletions

View File

@ -28,6 +28,7 @@ from django.utils.translation import pgettext_lazy
from django.utils.translation import ugettext_lazy as _
from django.views.generic.list import ListView
from authentic2 import app_settings
from authentic2.apps.journal.forms import JournalForm as BaseJournalForm
from authentic2.apps.journal.models import EventType, n_2_pairing
from authentic2.apps.journal.search_engine import JournalSearchEngine as BaseJournalSearchEngine
@ -74,7 +75,7 @@ class JournalSearchEngine(BaseJournalSearchEngine):
def unmatched_lexems_query(self, unmatched_lexems):
fullname = ' '.join(lexem.strip() for lexem in unmatched_lexems if lexem.strip())
if fullname:
users = User.objects.find_duplicates(fullname=fullname)
users = User.objects.find_duplicates(fullname=fullname, threshold=app_settings.A2_FTS_THRESHOLD)
return self.query_for_users(users)
def search_by_email(self, email):