Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
AetherUnbound opened this issue Jul 27, 2024 · 0 comments
Open
Labels
backend Related to the backend/server-side frontend Related to the frontend/client-side

Comments

@AetherUnbound
Copy link
Collaborator

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.

@AetherUnbound AetherUnbound added backend Related to the backend/server-side frontend Related to the frontend/client-side labels Jul 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Related to the backend/server-side frontend Related to the frontend/client-side
Projects
Status: 📋 Backlog
Development

No branches or pull requests

1 participant