Skip to content
  • Samuel Paccoud - DINUM's avatar
    609ff918
    🚸(backend) on user search match emails by Levenstein distance · 609ff918
    Samuel Paccoud - DINUM authored
    When the query looks like an email (includes @) we search by
    Levenstein distance because we are just trying to prevent typing
    errors, not searching anymore.
    
    It is important to still propose results with a short Levenstein
    distance because it is frequent to forget a double letter in
    someone's name for example "Pacoud" or even "pacou" instead of
    "Paccoud" and we want to prevent duplicates or failing on
    invitation.
    
    We consider the query string to be an email as soon as it contains
    a "@" character. Trying harder to identify a string that is really
    an email would lead to weird behaviors like toto@example.gouv looking
    like and email but if we continue typing toto@example.gouv.f not
    looking like an email... before toto@example.gouv.fr finally looking
    like an email. The result would be jumping from one type of search
    to the other. As soon as there is a "@" in the query, we can be
    sure that the user is not looking for a name anymore and we can
    switch to matching by Levenstein distance.
    609ff918
    🚸(backend) on user search match emails by Levenstein distance
    Samuel Paccoud - DINUM authored
    When the query looks like an email (includes @) we search by
    Levenstein distance because we are just trying to prevent typing
    errors, not searching anymore.
    
    It is important to still propose results with a short Levenstein
    distance because it is frequent to forget a double letter in
    someone's name for example "Pacoud" or even "pacou" instead of
    "Paccoud" and we want to prevent duplicates or failing on
    invitation.
    
    We consider the query string to be an email as soon as it contains
    a "@" character. Trying harder to identify a string that is really
    an email would lead to weird behaviors like toto@example.gouv looking
    like and email but if we continue typing toto@example.gouv.f not
    looking like an email... before toto@example.gouv.fr finally looking
    like an email. The result would be jumping from one type of search
    to the other. As soon as there is a "@" in the query, we can be
    sure that the user is not looking for a name anymore and we can
    switch to matching by Levenstein distance.
Loading