Skip to content

Allow exact matching on first/last name in browse officer formย #484

@AetherUnbound

Description

@AetherUnbound

When using the search form, we always perform an ILIKE search with the wildcards on both sides:

if form_data.get("last_name"):
officer_query = officer_query.filter(
Officer.last_name.ilike(f"%%{form_data['last_name']}%%")
)
if form_data.get("first_name"):
officer_query = officer_query.filter(
Officer.first_name.ilike(f"%%{form_data['first_name']}%%")
)

However, there are cases where we know the first few or last few letters of an officer's name given what we can see of their badge. Any searches we do now search for the term's presence in the entire word, which makes it difficult to be specific with the search text.

It would be nice to add the capacity to do an exact search if a user supplies a wildcard value. For instance, sh would search throughout the field, but sh* would require the term at the beginning of the word and *sh would require the term at the end of the word.

Metadata

Metadata

Assignees

No one assigned

    Labels

    backendRelated to the backend/server-sidefrontendRelated to the frontend/client-side

    Type

    No type

    Projects

    Status

    ๐Ÿ“‹ Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions