pub struct IngestChannel(_);
Expand description

The Sonic Channel Ingest mode is used for altering the search index (push, pop and flush). Once in this mode, you cannot switch to other modes or gain access to commands from other modes.

Available commands

In this mode you can use push, pop, flushc, flushb, flusho, bucket_count, object_count, word_count, ping and quit commands.

Note: This mode requires enabling the ingest feature.

Implementations

Stop connection.

let channel = IngestChannel::start(
    "localhost:1491",
    "SecretPassword",
)?;

channel.quit()?;

Ping server.

let channel = IngestChannel::start(
    "localhost:1491",
    "SecretPassword",
)?;

channel.ping()?;

Push search data in the index.

Note: This method requires enabling the ingest feature and start connection in Ingest mode.

let ingest_channel = IngestChannel::start(
    "localhost:1491",
    "SecretPassword",
)?;

let result = ingest_channel.push(PushRequest::new(
    Dest::col("search").obj("recipe:295"),
    "Sweet Teriyaki Beef Skewers"
))?;
assert_eq!(result, ());

Pop search data from the index. Returns removed words count as usize type.

Note: This method requires enabling the ingest feature and start connection in Ingest mode.

let ingest_channel = IngestChannel::start(
    "localhost:1491",
    "SecretPassword",
)?;

let dest = Dest::col("search").obj("recipe:295");
let result = ingest_channel.pop(PopRequest::new(dest, "beef"))?;
assert_eq!(result, 1);

Flush all indexed data from collections.

Note: This method requires enabling the ingest feature and start connection in Ingest mode.

let ingest_channel = IngestChannel::start(
    "localhost:1491",
    "SecretPassword",
)?;

let flushc_count = ingest_channel.flush(FlushRequest::collection("search"))?;
dbg!(flushc_count);
let flushb_count = ingest_channel.flush(FlushRequest::bucket("search", "default"))?;
dbg!(flushb_count);
let flusho_count = ingest_channel.flush(
    FlushRequest::object("search", "default", "recipe:295")
)?;
dbg!(flusho_count);

Count indexed search data of your collection.

Note: This method requires enabling the ingest feature and start connection in Ingest mode.

let ingest_channel = IngestChannel::start(
    "localhost:1491",
    "SecretPassword",
)?;

let bucket_count = ingest_channel.count(CountRequest::buckets("search"))?;
dbg!(bucket_count);
let object_count = ingest_channel.count(CountRequest::objects("search", "default"))?;
dbg!(object_count);
let word_count = ingest_channel.count(
    CountRequest::words("search", "default", "recipe:256")
)?;
dbg!(object_count);

Trait Implementations

Formats the value using the given formatter. Read more
Sonic channel struct
Returns reference for sonic stream of connection
Connects to sonic backend and run start command. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.