🚑 Fixed meilisearch again
This commit is contained in:
@@ -27,8 +27,8 @@ class Hit(pydantic.BaseModel):
|
|||||||
|
|
||||||
class SearchResponse(pydantic.BaseModel):
|
class SearchResponse(pydantic.BaseModel):
|
||||||
hits: List[Hit] | list[None]
|
hits: List[Hit] | list[None]
|
||||||
nbHits: int
|
# nbHits: int
|
||||||
exhaustiveNbHits: bool
|
# exhaustiveNbHits: bool
|
||||||
query: str
|
query: str
|
||||||
limit: int
|
limit: int
|
||||||
offset: int
|
offset: int
|
||||||
@@ -45,7 +45,7 @@ class SearchData(pydantic.BaseModel):
|
|||||||
attributesToCrop: Optional[list[str]] = None
|
attributesToCrop: Optional[list[str]] = None
|
||||||
cropLength: Optional[int] = 200
|
cropLength: Optional[int] = 200
|
||||||
attributesToHighlight: Optional[list[str]] = None
|
attributesToHighlight: Optional[list[str]] = None
|
||||||
matches: Optional[bool] = False
|
# matches: Optional[bool] = False
|
||||||
sort: Optional[list[str]] = None
|
sort: Optional[list[str]] = None
|
||||||
|
|
||||||
|
|
||||||
@@ -68,14 +68,15 @@ async def search(data: SearchData):
|
|||||||
"limit": data.limit,
|
"limit": data.limit,
|
||||||
"filter": data.filter,
|
"filter": data.filter,
|
||||||
"cropLength": data.cropLength,
|
"cropLength": data.cropLength,
|
||||||
"matches": data.matches,
|
# "matches": data.matches,
|
||||||
"facetsDistribution": data.facetsDistribution,
|
# "facetsDistribution": data.facetsDistribution,
|
||||||
"attributesToRetrieve": data.attributesToRetrieve,
|
"attributesToRetrieve": data.attributesToRetrieve,
|
||||||
"attributesToCrop": data.attributesToCrop,
|
"attributesToCrop": data.attributesToCrop,
|
||||||
"sort": data.sort,
|
"sort": data.sort,
|
||||||
"attributesToHighlight": data.attributesToHighlight,
|
"attributesToHighlight": data.attributesToHighlight,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
print(query)
|
||||||
return SearchResponse(**query)
|
return SearchResponse(**query)
|
||||||
|
|
||||||
|
|
||||||
@@ -86,7 +87,7 @@ async def search_get(
|
|||||||
limit: int = 20,
|
limit: int = 20,
|
||||||
filter: str | None = None, # skipcq: PYL-W0622
|
filter: str | None = None, # skipcq: PYL-W0622
|
||||||
cropLength: int = 200,
|
cropLength: int = 200,
|
||||||
matches: bool = False,
|
# matches: bool = False,
|
||||||
attributesToHighlight: Optional[str] = "*",
|
attributesToHighlight: Optional[str] = "*",
|
||||||
):
|
):
|
||||||
query = await _perform_search(
|
query = await _perform_search(
|
||||||
@@ -96,7 +97,7 @@ async def search_get(
|
|||||||
"limit": limit,
|
"limit": limit,
|
||||||
"filter": filter, # skipcq: PYL-W0622
|
"filter": filter, # skipcq: PYL-W0622
|
||||||
"cropLength": cropLength,
|
"cropLength": cropLength,
|
||||||
"matches": matches,
|
# "matches": matches,
|
||||||
"attributesToHighlight": [attributesToHighlight],
|
"attributesToHighlight": [attributesToHighlight],
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user