[−][src]Crate meilib
A well designed api client for MeiliSearch.
CAVEAT: WIP
Quick Start
To get you started quickly, the easiest and highest-level way to create
index is to use [create_index
];
use meilib::{Config, client::Client, CreateIndexRequest}; #[actix_rt::main] async fn main() -> std::io::Result<()> { let uid = "demo".to_string(); let name = "demoname".to_string(); // construct a request param let req_data = CreateIndexRequest { uid, name, primary_key: None}; // config contains MeiliSearch server's host and port let config = Config::new("http://127.0.0.1".to_string(), 7700); // Client is api interface, using async/await. let res = Client::new(config).create_index(req_data).await; match res { Ok(index) => { println!("ceate index: {:?}", index); }, Err(err) => { println!("err: {:?}", err); } } Ok(()) }
Output:
{"name":"demoname","uid":"demo","createdAt":"2020-05-14T08:56:24.483670375Z","updatedAt":"2020-05-14T08:56:24.484410846Z","primaryKey":null}
Installation
This crate requires a MeiliSearch server to run. See here to install and run MeiliSearch.
For the user guide and further documentation, can be found
here
Modules
client | Module containing all the api interfaces |
error | Module containing ServiceError |
Structs
Config | Including sever's host and port |
CreateIndexRequest | Including create index's params |
DeleteIndexRequest | Including delete index's params |
DocumentRequest | Including add documents request params |
DocumentState | Including documents related response |
Index | Index structure |
Indexes | Collection of Indexes |
UpdateIndexRequest | Including update index's params |
Traits
Document | Userdefined Document MUST impl |