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:
Sandeep Kumar
2024-07-17 15:56:41 +05:30
committed by GitHub
parent 96edf52ca6
commit 35c9b8afe1
5 changed files with 50 additions and 8 deletions

View File

@ -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)