mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-02 04:04:43 +08:00
feat(globalsearch): Added search_tags based filter for global search in dashboard (#5341)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com> Co-authored-by: Abhishek Kanojia <89402434+Abhitator216@users.noreply.github.com>
This commit is contained in:
@ -66,6 +66,24 @@ pub async fn msearch_results(
|
||||
.switch()?;
|
||||
}
|
||||
};
|
||||
if let Some(search_tags) = filters.search_tags {
|
||||
if !search_tags.is_empty() {
|
||||
query_builder
|
||||
.add_filter_clause(
|
||||
"feature_metadata.search_tags.keyword".to_string(),
|
||||
search_tags
|
||||
.iter()
|
||||
.filter_map(|search_tag| {
|
||||
// TODO: Add trait based inputs instead of converting this to strings
|
||||
serde_json::to_value(search_tag)
|
||||
.ok()
|
||||
.and_then(|a| a.as_str().map(|a| a.to_string()))
|
||||
})
|
||||
.collect(),
|
||||
)
|
||||
.switch()?;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
let response_text: OpenMsearchOutput = client
|
||||
@ -173,6 +191,24 @@ pub async fn search_results(
|
||||
.switch()?;
|
||||
}
|
||||
};
|
||||
if let Some(search_tags) = filters.search_tags {
|
||||
if !search_tags.is_empty() {
|
||||
query_builder
|
||||
.add_filter_clause(
|
||||
"feature_metadata.search_tags.keyword".to_string(),
|
||||
search_tags
|
||||
.iter()
|
||||
.filter_map(|search_tag| {
|
||||
// TODO: Add trait based inputs instead of converting this to strings
|
||||
serde_json::to_value(search_tag)
|
||||
.ok()
|
||||
.and_then(|a| a.as_str().map(|a| a.to_string()))
|
||||
})
|
||||
.collect(),
|
||||
)
|
||||
.switch()?;
|
||||
}
|
||||
};
|
||||
};
|
||||
query_builder
|
||||
.set_offset_n_count(search_req.offset, search_req.count)
|
||||
|
||||
Reference in New Issue
Block a user