[HTTP-UI] add the sorters

This commit is contained in:
Tamo 2021-08-31 18:49:06 +02:00
parent 4820ac71a6
commit 7483614b75
No known key found for this signature in database
GPG Key ID: 20CD8020AFA88D69

View File

@ -695,6 +695,7 @@ async fn main() -> anyhow::Result<()> {
struct QueryBody { struct QueryBody {
query: Option<String>, query: Option<String>,
filters: Option<String>, filters: Option<String>,
sorters: Option<String>,
facet_filters: Option<Vec<UntaggedEither<Vec<String>, String>>>, facet_filters: Option<Vec<UntaggedEither<Vec<String>, String>>>,
facet_distribution: Option<bool>, facet_distribution: Option<bool>,
limit: Option<usize>, limit: Option<usize>,
@ -754,6 +755,10 @@ async fn main() -> anyhow::Result<()> {
search.limit(limit); search.limit(limit);
} }
if let Some(sort) = query.sorters {
search.sort_criteria(vec![sort.parse().unwrap()]);
}
let SearchResult { matching_words, candidates, documents_ids } = let SearchResult { matching_words, candidates, documents_ids } =
search.execute().unwrap(); search.execute().unwrap();