BDMS 774 Fix WELL List filters#664
Merged
Merged
Conversation
order_sort_filter now walks every filter JSON in the request (optional filters list plus legacy single filter_). _apply_json_filter_clause supports contains, ncontains, startswith, endswith, eq, ne, comparison operators, null checks, and in, in addition to the old contains-only behavior. Any list or report that sends filter= more than once or uses operators other than contains will now get real SQL instead of silent no-ops.
get_db_things accepts filters as a list of JSON strings (merged with legacy single filter_) and passes them to order_sort_filter. Adds name_contains to narrow rows with Thing.name ILIKE for substring search without changing the full-text query path.
GET /thing/water-well, GET /thing/spring, and GET /thing now bind filter as a list so multiple Refine filters are forwarded. Same routes accept optional name_contains for substring matching on thing name alongside existing query.
jirhiker
approved these changes
Apr 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is changing
Fixes wells list filtering so column filters actually narrow results server side, supports “does not contain” and other Refine operators, forwards multiple
filterquery parameters from the UI, and makes the wells toolbar search matchThing.nameby substring instead of relying on full text search alone.Problem
filterJSON value and only implementedcontains, so “Type does not contain water” had no effect and extra filters were dropped when Refine sent severalfilter=entries.query(full text /search_vector), which often did not behave like searching for a specific well ID or name (for example DE-0229).API changes (OcotilloAPI)
services/query_helper.pyorder_sort_filterconsumes every submitted filter blob (legacy singlefilter_plus optional list)._apply_json_filter_clauseimplements Refine logical operators used by the Data Grid, includingncontains,contains,startswith,endswith,eq,ne, comparisons,null/nnull, andin, instead of onlycontains.services/thing_helper.pyget_db_thingsmerges optionalfilters: list[str]with the legacy single filter and passes them intoorder_sort_filter.name_containsto restrict rows withThing.nameILIKE%value%.api/thing.pyGET /thing/water-well,GET /thing/spring, andGET /thingbindfilteras alist[str](repeated query params) and exposename_containsas an optional query parameter.UI changes (OcotilloUI)
src/pages/ocotillo/thing/list.tsxname_contains(debounced) instead ofqueryso search aligns with substring match on well name.Deploy / rollout
name_containsrequires the new API parameter.order_sort_filter(sensors, locations, lexicon, samples, observations, contacts, thing id-links, etc.) now honor operators that were previously no-ops.