diff --git a/app/Models/query_params.py b/app/Models/query_params.py index 03c369d..6a1b857 100644 --- a/app/Models/query_params.py +++ b/app/Models/query_params.py @@ -21,11 +21,13 @@ def __init__( ratio_tolerance: Annotated[ float, Query(gt=0, lt=1, description="The tolerance of the aspect ratio.")] = 0.1, min_width: Annotated[int | None, Query(geq=0, description="The minimum width of the image.")] = None, - min_height: Annotated[int | None, Query(geq=0, description="The minimum height of the image.")] = None): + min_height: Annotated[int | None, Query(geq=0, description="The minimum height of the image.")] = None, + starred: Annotated[bool | None, Query(description="Whether the image is starred.")] = None): self.preferred_ratio = preferred_ratio self.ratio_tolerance = ratio_tolerance self.min_width = min_width self.min_height = min_height + self.starred = starred if self.preferred_ratio: self.min_ratio = self.preferred_ratio * (1 - self.ratio_tolerance) diff --git a/app/Services/vector_db_context.py b/app/Services/vector_db_context.py index e860063..658e042 100644 --- a/app/Services/vector_db_context.py +++ b/app/Services/vector_db_context.py @@ -180,6 +180,14 @@ def getFiltersByFilterParam(filter_param: FilterParams | None) -> models.Filter ) )) + if filter_param.starred is not None: + filters.append(models.FieldCondition( + key="starred", + match=models.MatchValue( + value=filter_param.starred + ) + )) + if len(filters) > 0: return models.Filter( must=filters