7 releases

0.3.2 Oct 16, 2020
0.3.1 Aug 7, 2020
0.2.2 Aug 1, 2020
0.2.1 Jul 26, 2020
0.1.0 Jul 23, 2020

#96 in Concurrency

Download history 38/week @ 2020-07-15 63/week @ 2020-07-22 31/week @ 2020-07-29 21/week @ 2020-08-05 37/week @ 2020-08-12 15/week @ 2020-08-19 10/week @ 2020-08-26 32/week @ 2020-09-02 43/week @ 2020-09-09 1/week @ 2020-09-16 4/week @ 2020-09-23 9/week @ 2020-09-30 2/week @ 2020-10-07 17/week @ 2020-10-14

99 downloads per month

MPL-2.0 license

45KB
1K SLoC

Sonic Channel

Rust client for sonic search backend.

We recommend you start with the documentation.

Installation

Add sonic-channel = { version = "0.3" } as a dependency in Cargo.toml.

Cargo.toml example:

[package]
name = "my-crate"
version = "0.1.0"
authors = ["Me <user@rust-lang.org>"]

[dependencies]
sonic-channel = { version = "0.3" }

Example usage

Search channel

Note: This example requires enabling the search feature, enabled by default.

use sonic_channel::*;

fn main() -> result::Result<()> {
    let channel = SonicChannel::connect_with_start(
        ChannelMode::Search,
        "localhost:1491",
        "SecretPassword",
    )?;

    let objects = channel.query("collection", "bucket", "recipe")?;
    dbg!(objects);

    Ok(())
}

Ingest channel

Note: This example requires enabling the ingest feature.

use sonic_channel::*;

fn main() -> result::Result<()> {
    let mut channel = SonicChannel::connect_with_start(
        ChannelMode::Ingest,
        "localhost:1491",
        "SecretPassword",
    )?;

    let pushed = channel.push("collection", "bucket", "object:1", "my best recipe")?;
    // or
    // let pushed = channel.push_with_locale("collection", "bucket", "object:1", "Мой лучший рецепт", "rus")?;
    dbg!(pushed);

    Ok(())
}

Control channel

Note: This example requires enabling the control feature.

use sonic_channel::*;

fn main() -> result::Result<()> {
    let mut channel = SonicChannel::connect_with_start(
        ChannelMode::Control,
        "localhost:1491",
        "SecretPassword",
    )?;

    let result = channel.consolidate()?;
    assert_eq!(result, true);

    Ok(())
}

Available features

  • default - ["search"]
  • search - Add sonic search mode with methods
  • ignite - Add sonic ignite mode with methods
  • control - Add sonic control mode with methods

Dependencies

~1.5MB
~40K SLoC