3 releases

0.1.2 May 15, 2020
0.1.1 May 14, 2020
0.1.0 May 13, 2020

#12 in #meilisearch

MIT license

24KB
477 lines

MEILIB

caveat!!! [WIP]

MIT licensed crate Build Status

meilib is a client for MeiliSearch. MeiliSearch is a powerful, fast, open-source, easy to use and deploy search engine. Both searching and indexing are highly customizable. Features such as typo-tolerance, filters, and synonyms are provided out-of-the-box. For more information about features go to documentation.

API Documentation

More examples

More examples can be found in the examples directory.

Changelog

Release notes are available in CHANGELOG.md.


lib.rs:

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

Dependencies

~29MB
~594K SLoC