Coder Social home page Coder Social logo

sonic-channel's Introduction

Sonic Channel

Rust client for sonic search backend.

We recommend you start with the documentation.

Installation

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

Cargo.toml example:

[package]
name = "my-crate"
version = "0.1.0"
authors = ["Me <[email protected]>"]

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

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("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 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 channel = ControlChannel::start("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

sonic-channel's People

Contributors

pleshevskiy avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.