forked from lucyparsons/OpenOversight
-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Labels
backendRelated to the backend/server-sideRelated to the backend/server-sidefrontendRelated to the frontend/client-sideRelated to the frontend/client-side
Description
When using the search form, we always perform an ILIKE search with the wildcards on both sides:
OpenOversight/OpenOversight/app/utils/forms.py
Lines 278 to 285 in 3c90393
| 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
Labels
backendRelated to the backend/server-sideRelated to the backend/server-sidefrontendRelated to the frontend/client-sideRelated to the frontend/client-side
Type
Projects
Status
๐ Backlog