v0.15-WORKINGV1
This commit is contained in:
@@ -42,7 +42,7 @@ pub async fn delete_book(bookid: i32, client: &Client) {
|
||||
}
|
||||
|
||||
|
||||
pub async fn search_book(search: &str, page: usize, client: &Client) -> Result<Vec<BookMeili>, meilisearch_sdk::errors::Error> {
|
||||
pub async fn search_book(search: &str, page: usize, client: &Client) -> Result<(Vec<BookMeili>, usize), meilisearch_sdk::errors::Error> {
|
||||
// An index is where the documents are stored.
|
||||
let books = client.index("books");
|
||||
let results : SearchResults<BookMeili> = books.search().with_query(search).with_offset((page-1)*24)
|
||||
@@ -50,7 +50,7 @@ pub async fn search_book(search: &str, page: usize, client: &Client) -> Result<V
|
||||
|
||||
let formatted_results : Vec<BookMeili> = (results.hits).iter().map(|r| r.result.clone()).collect();
|
||||
//.iter()s.map(|r| r.formatted_result.unwrap()).collect();
|
||||
return Ok(formatted_results);
|
||||
return Ok((formatted_results, results.estimated_total_hits));
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user