v0.16-ACTAUL-V0.1

This commit is contained in:
2022-12-04 13:46:23 +05:30
parent e6c091dde0
commit dd12d80988
3 changed files with 24 additions and 12 deletions

View File

@@ -45,7 +45,7 @@ pub async fn delete_book(bookid: i32, client: &Client) {
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)
let results : SearchResults<BookMeili> = books.search().with_query(search).with_offset((page-1)*12)
.execute::<BookMeili>().await.unwrap();
let formatted_results : Vec<BookMeili> = (results.hits).iter().map(|r| r.result.clone()).collect();