mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-15 15:45:27 +03:00
fix query without filters
This commit is contained in:
parent
1f78e9ae44
commit
71a8741c36
@ -467,16 +467,22 @@ def events_search(request: Request, params: EventsSearchQueryParams = Depends())
|
|||||||
event_filters.append((start_hour_fun > time_after))
|
event_filters.append((start_hour_fun > time_after))
|
||||||
event_filters.append((start_hour_fun < time_before))
|
event_filters.append((start_hour_fun < time_before))
|
||||||
|
|
||||||
filtered_event_ids = (
|
if event_filters:
|
||||||
Event.select(Event.id).where(*event_filters).tuples().iterator()
|
filtered_event_ids = (
|
||||||
)
|
Event.select(Event.id)
|
||||||
event_ids = [event_id[0] for event_id in filtered_event_ids]
|
.where(reduce(operator.and_, event_filters))
|
||||||
|
.tuples()
|
||||||
|
.iterator()
|
||||||
|
)
|
||||||
|
event_ids = [event_id[0] for event_id in filtered_event_ids]
|
||||||
|
|
||||||
if not event_ids:
|
if not event_ids:
|
||||||
return JSONResponse(content=[]) # No events to search on
|
return JSONResponse(content=[]) # No events to search on
|
||||||
|
else:
|
||||||
|
event_ids = []
|
||||||
|
|
||||||
# Build the Chroma where clause based on the event IDs
|
# Build the Chroma where clause based on the event IDs
|
||||||
where = {"id": {"$in": event_ids}}
|
where = {"id": {"$in": event_ids}} if event_ids else {}
|
||||||
|
|
||||||
thumb_ids = {}
|
thumb_ids = {}
|
||||||
desc_ids = {}
|
desc_ids = {}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user