mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-02 21:07:58 +08:00
feat(global-search-regex-escape): escape reserved characters which break global search query (#4135)
This commit is contained in:
@ -81,7 +81,7 @@ pub async fn msearch_results(
|
|||||||
for index in SearchIndex::iter() {
|
for index in SearchIndex::iter() {
|
||||||
msearch_vector
|
msearch_vector
|
||||||
.push(json!({"index": search_index_to_opensearch_index(index,&config.indexes)}).into());
|
.push(json!({"index": search_index_to_opensearch_index(index,&config.indexes)}).into());
|
||||||
msearch_vector.push(json!({"query": {"bool": {"must": {"query_string": {"query": req.query}}, "filter": {"match_phrase": {"merchant_id": merchant_id}}}}}).into());
|
msearch_vector.push(json!({"query": {"bool": {"filter": [{"multi_match": {"type": "phrase", "query": req.query, "lenient": true}},{"match_phrase": {"merchant_id": merchant_id}}]}}}).into());
|
||||||
}
|
}
|
||||||
|
|
||||||
let response = client
|
let response = client
|
||||||
@ -128,7 +128,7 @@ pub async fn search_results(
|
|||||||
.search(SearchParts::Index(&[&search_index_to_opensearch_index(req.index.clone(),&config.indexes)]))
|
.search(SearchParts::Index(&[&search_index_to_opensearch_index(req.index.clone(),&config.indexes)]))
|
||||||
.from(search_req.offset)
|
.from(search_req.offset)
|
||||||
.size(search_req.count)
|
.size(search_req.count)
|
||||||
.body(json!({"query": {"bool": {"must": {"query_string": {"query": search_req.query}}, "filter": {"match_phrase": {"merchant_id": merchant_id}}}}}))
|
.body(json!({"query": {"bool": {"filter": [{"multi_match": {"type": "phrase", "query": search_req.query, "lenient": true}},{"match_phrase": {"merchant_id": merchant_id}}]}}}))
|
||||||
.send()
|
.send()
|
||||||
.await
|
.await
|
||||||
.map_err(|_| AnalyticsError::UnknownError)?;
|
.map_err(|_| AnalyticsError::UnknownError)?;
|
||||||
|
|||||||
Reference in New Issue
Block a user