Rust client for sonic search backend
Find a file
Dmitriy Pleshevskiy 4a267f66b9 feat: impl std error to error
* *BREAKING CHANGES*: refac errors and add main struct with inner enum kind
* Add Result type
2020-07-19 10:17:53 +03:00
src feat: impl std error to error 2020-07-19 10:17:53 +03:00
.gitignore chore: remove main file from repo 2020-07-18 14:59:15 +03:00
Cargo.toml feat: impl std error to error 2020-07-19 10:17:53 +03:00
LICENSE Initial commit 2020-07-18 10:59:02 +03:00
README.md feat: impl std error to error 2020-07-19 10:17:53 +03:00

Sonic Channel

Rust client for sonic search backend.

We recommend you start with the documentation.

Installation

Add sonic-channel = { version = "0.1" } 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.1.0-rc3" }

Example usage

Search channel

use sonic_channel::*;

fn main() -> result::Result<()> {
    let mut channel = SonicChannel::connect("localhost:1491")?;

    channel.start(ChannelMode::Search, "SecretPassword")?;
    let objects = channel.query("collection", "bucket", "recipe")?;
    dbg!(objects);

    Ok(())
}

Ingest channel

use sonic_channel::*;

fn main() -> result::Result<()> {
    let mut channel = SonicChannel::connect("localhost:1491")?;

    channel.start(ChannelMode::Ingest, "SecretPassword")?;
    let pushed = channel.push("collection", "bucket", "user:1", "my best recipe")?;
    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