2022-10-09 19:43:51 +02:00
|
|
|
pub mod encoder;
|
2021-03-24 11:03:01 +01:00
|
|
|
pub mod index;
|
|
|
|
pub mod server;
|
|
|
|
pub mod service;
|
2021-02-18 19:50:52 +01:00
|
|
|
|
2021-03-15 18:11:10 +01:00
|
|
|
pub use index::{GetAllDocumentsOptions, GetDocumentOptions};
|
2022-04-28 10:48:57 +02:00
|
|
|
pub use server::{default_settings, Server};
|
2021-02-18 19:50:52 +01:00
|
|
|
|
|
|
|
/// Performs a search test on both post and get routes
|
|
|
|
#[macro_export]
|
|
|
|
macro_rules! test_post_get_search {
|
|
|
|
($server:expr, $query:expr, |$response:ident, $status_code:ident | $block:expr) => {
|
2022-12-07 08:20:47 -07:00
|
|
|
let post_query: meilisearch::routes::search::SearchQueryPost =
|
2021-02-18 19:50:52 +01:00
|
|
|
serde_json::from_str(&$query.clone().to_string()).unwrap();
|
2022-12-07 08:20:47 -07:00
|
|
|
let get_query: meilisearch::routes::search::SearchQuery = post_query.into();
|
2021-02-18 19:50:52 +01:00
|
|
|
let get_query = ::serde_url_params::to_string(&get_query).unwrap();
|
|
|
|
let ($response, $status_code) = $server.search_get(&get_query).await;
|
2022-10-20 18:00:07 +02:00
|
|
|
let _ = ::std::panic::catch_unwind(|| $block)
|
|
|
|
.map_err(|e| panic!("panic in get route: {:?}", e.downcast_ref::<&str>().unwrap()));
|
2021-02-18 19:50:52 +01:00
|
|
|
let ($response, $status_code) = $server.search_post($query).await;
|
2022-10-20 18:00:07 +02:00
|
|
|
let _ = ::std::panic::catch_unwind(|| $block)
|
|
|
|
.map_err(|e| panic!("panic in post route: {:?}", e.downcast_ref::<&str>().unwrap()));
|
2021-02-18 19:50:52 +01:00
|
|
|
};
|
|
|
|
}
|