Rust client for sonic search backend
Find a file
2020-08-01 10:54:53 +03:00
src doc: hide quit and ping command structs 2020-08-01 10:54:53 +03:00
.gitignore chore: remove main file from repo 2020-07-18 14:59:15 +03:00
Cargo.toml doc: write examples for ingest commands 2020-08-01 10:52:22 +03:00
LICENSE Initial commit 2020-07-18 10:59:02 +03:00
README.md doc: add feature info to examples 2020-07-31 23:48:07 +03:00

Sonic Channel

Rust client for sonic search backend.

We recommend you start with the documentation.

Installation

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

Cargo.toml example:

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

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

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(())
}

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