Commit 485d4c32 authored by Kamal Dodiya's avatar Kamal Dodiya
Browse files

Add POST to get search result

parent fd40ad32
Pipeline #171537 passed with stage
in 1 minute and 11 seconds
......@@ -42,3 +42,21 @@ async def get_search_results(search_query: SearchQuery):
transformed_search_result_docs = await transform_search_result(search_result)
response = SearchResult(meta=meta, matches=transformed_search_result_docs)
return response
@app.post("/search", response_model=SearchResult)
async def get_search_results(search_query: SearchQuery):
"""
Query SOLR with the search string and additional parameter and transform result
as expected by the client
"""
solr_query_input = await transform_request_for_solr(search_query)
search_result = await solr.get_search_results(solr_query_input)
meta = {
"total_hits": search_result["response"]["numFound"],
"page": search_query.page,
"per_page": search_query.per_page,
}
transformed_search_result_docs = await transform_search_result(search_result)
response = SearchResult(meta=meta, matches=transformed_search_result_docs)
return response
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment