This commit is contained in:
Josh Hawkins 2024-10-18 09:28:02 -05:00
parent b56f4c4558
commit 8be2851a5a
2 changed files with 10 additions and 0 deletions

View File

@ -44,6 +44,8 @@ class EventsSearchQueryParams(BaseModel):
after: Optional[float] = None
before: Optional[float] = None
time_range: Optional[str] = DEFAULT_TIME_RANGE
has_clip: Optional[int] = None
has_snapshot: Optional[int] = None
timezone: Optional[str] = "utc"
min_score: Optional[float] = None
max_score: Optional[float] = None

View File

@ -359,6 +359,8 @@ def events_search(request: Request, params: EventsSearchQueryParams = Depends())
min_score = params.min_score
max_score = params.max_score
time_range = params.time_range
has_clip = params.has_clip
has_snapshot = params.has_snapshot
# for similarity search
event_id = params.event_id
@ -433,6 +435,12 @@ def events_search(request: Request, params: EventsSearchQueryParams = Depends())
if before:
event_filters.append((Event.start_time < before))
if has_clip is not None:
event_filters.append((Event.has_clip == has_clip))
if has_snapshot is not None:
event_filters.append((Event.has_snapshot == has_snapshot))
if min_score is not None and max_score is not None:
event_filters.append((Event.data["score"].between(min_score, max_score)))
else: