Union parameter not passed in multi-search queries
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 55/100
Hướng nghiên cứu
Start at the MultiSearch.perform entry point shown in the issue and inspect how search_queries becomes the request body. Ensure the Union option is forwarded with the searches, then verify that multi-search requests using Union produce the expected grouped results.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
I tried to use multi-search with "Union" type on typesense==1.1.1.
Snippet:
for model, collection in model_and_collection:
query.append(
{
"collection": collection.schema_name,
"query_by": collection.query_by_fields,
"q": q,
}
)
results = client.multi_search.perform(
{
"union": True,
"searches": query,
}, {
"per_page": self.paginate_by,
"page": page_number,
}
)
But I realized that the result doesn't consider the union parameter. I have as many results as collection, and not a "grouped" hits results as expected.
After some investigation, I found out that the parameter "union" is not passed to the query.
def perform(
self,
search_queries: MultiSearchRequestSchema,
common_params: typing.Union[MultiSearchCommonParameters, None] = None,
) -> MultiSearchResponse:
"""
Perform a multi-search operation.
This method allows executing multiple search queries in a single API call.
It processes the search parameters, sends the request to the Typesense API,
and returns the multi-search response.
Args:
search_queries (MultiSearchRequestSchema):
A dictionary containing the list of search queries to perform.
The dictionary should have a 'searches' key with a list of search
parameter dictionaries.
common_params (Union[MultiSearchCommonParameters, None], optional):
Common parameters to apply to all search queries. Defaults to None.
Returns:
MultiSearchResponse:
The response from the multi-search operation, containing
the results of all search queries.
"""
stringified_search_params = [
stringify_search_params(search_params)
for search_params in search_queries.get("searches")
]
search_body = {"searches": stringified_search_params}
response: MultiSearchResponse = self.api_call.post(
MultiSearch.resource_path,
body=search_body,
params=common_params,
as_json=True,
entity_type=MultiSearchResponse,
)
return response
In the code above, you can see that "union" is not put into search_body.
Adding a line like that fixed it:
search_body["union"] = search_queries.get('union', False)
I will try to submit a MR about it.
- Ngôn ngữ chính
- Python
- Star
- 247
- Fork
- 68
- Merge trung bình
- 22 giờ 47 phút
- Pull request đã merge (30 ngày)
- 8
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của typesense/typesense-python
-
`MultiSearchResponse` type does not account for union search response shapeCó thể đã có người làm @tharropoulos đã nhận 174 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
typesense/typesense-python#128 ·
-
`documents.Documents.import_()` `batch_size` argument is ignored, type of `import_parameters` is missing `batch_size`Có thể đã có người làm @tharropoulos đã nhận 247 ngày trước. Đang mở
Độ khó 2/5 1-2 ngày Mức phù hợp với người mới 68/100
typesense/typesense-python#124 ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 68/100
typesense/typesense-python#100 ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
typesense/typesense-python#122 · 3 bình luận ·
-
[Bug] - DeprecationWarning on instantiation of ClientCó thể đã có người làm @tharropoulos đã nhận 268 ngày trước. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 55/100
typesense/typesense-python#114 · 8 bình luận ·
Tất cả issue của typesense/typesense-python
Issue tương tự
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
GoogleCloudPlatform/gce-rescue#195 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
Maintainer thường phản hồi trong vòng 1 ngày
-
intake mcp-intake needs-ac needs-human-review priority:medium
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
Ikalus1988/MisakaNet#3848 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 75/100
521xueweihan/HelloGitHub#4105 ·
-
bug size:XS
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
Maintainer thường phản hồi trong vòng 1 ngày