Rust client for sonic search backend
Find a file
dependabot[bot] 04bc0d0647 chore(deps): bump whatlang from 0.16.1 to 0.16.2
Bumps [whatlang](https://github.com/greyblake/whatlang-rs) from 0.16.1 to 0.16.2.
- [Release notes](https://github.com/greyblake/whatlang-rs/releases)
- [Changelog](https://github.com/greyblake/whatlang-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/greyblake/whatlang-rs/compare/v0.16.1...v0.16.2)

---
updated-dependencies:
- dependency-name: whatlang
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-25 17:58:36 +00:00
.github ci: fix audit-check version 2022-08-01 14:14:12 +03:00
.vim Design improvements (#13) 2022-07-18 11:07:12 +00:00
.vscode chore: refac gitignore 2022-07-21 18:19:40 +03:00
src commands/list: implement new list command to the search channel 2022-10-24 15:11:27 +00:00
tests commands/list: implement new list command to the search channel 2022-10-24 15:11:27 +00:00
.envrc nix: add flake with dev shell 2022-09-09 15:57:39 +03:00
.gitignore nix: add flake with dev shell 2022-09-09 15:57:39 +03:00
Cargo.lock chore(deps): bump whatlang from 0.16.1 to 0.16.2 2022-10-25 17:58:36 +00:00
Cargo.toml chore(deps): bump whatlang from 0.16.1 to 0.16.2 2022-10-25 17:58:36 +00:00
CODE_OF_CONDUCT.md chore: add code of conduct 2021-02-12 01:38:32 +03:00
docker-compose.test.yml commands/list: implement new list command to the search channel 2022-10-24 15:11:27 +00:00
flake.lock commands/list: implement new list command to the search channel 2022-10-24 15:11:27 +00:00
flake.nix commands/list: implement new list command to the search channel 2022-10-24 15:11:27 +00:00
LICENSE Initial commit 2020-07-18 10:59:02 +03:00
README.md doc: change version in the readme 2022-10-24 18:29:24 +03:00
sonic.cfg tests(integration): add tests for push and query 2021-12-24 17:15:54 +03:00

Sonic Channel

Build unsafe forbidden Documentation Crates.io Crates.io

Rust client for sonic search backend.

We recommend you start with the documentation.

Installation

The MSRV is: 1.58.1

Add sonic-channel = { version = "1.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 = "1.1", features = ["ingest"] }

Add default-features = false to dependency, if you want to exclude default search channel.

Example usage

Search channel

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

use sonic_channel::*;

fn main() -> result::Result<()> {
    let channel = SearchChannel::start(
        "localhost:1491",
        "SecretPassword",
    )?;

    let objects = channel.query(QueryRequest::new(
        Dest::col_buc("collection", "bucket"),
        "recipe",
    ))?;
    dbg!(objects);

    Ok(())
}

Ingest channel

Note: This example requires enabling the ingest feature.

use sonic_channel::*;

fn main() -> result::Result<()> {
    let channel = IngestChannel::start(
        "localhost:1491",
        "SecretPassword",
    )?;

    let dest = Dest::col_buc("collection", "bucket").obj("object:1");
    let pushed = channel.push(PushRequest::new(dest, "my best recipe"))?;
    // or
    // let pushed = channel.push(
    //     PushRequest::new(dest, "Мой лучший рецепт").lang(Lang::Rus)
    // )?;
    dbg!(pushed);

    Ok(())
}

Control channel

Note: This example requires enabling the control feature.

use sonic_channel::*;

fn main() -> result::Result<()> {
    let channel = ControlChannel::start(
        "localhost:1491",
        "SecretPassword",
    )?;

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

    Ok(())
}

Available features

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