Struct sonic_channel::IngestChannel
source · [−]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
sourceimpl IngestChannel
impl IngestChannel
sourceimpl IngestChannel
impl IngestChannel
sourcepub fn push<'a>(
&self,
req: PushRequest
) -> Result<<PushCommand as StreamCommand>::Response>
pub fn push<'a>(
&self,
req: PushRequest
) -> Result<<PushCommand as StreamCommand>::Response>
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, ());
sourcepub fn pop(
&self,
req: PopRequest
) -> Result<<PopCommand as StreamCommand>::Response>
pub fn pop(
&self,
req: PopRequest
) -> Result<<PopCommand as StreamCommand>::Response>
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);
sourcepub fn flush(
&self,
req: FlushRequest
) -> Result<<FlushCommand as StreamCommand>::Response>
pub fn flush(
&self,
req: FlushRequest
) -> Result<<FlushCommand as StreamCommand>::Response>
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);
sourcepub fn count(
&self,
req: CountRequest
) -> Result<<CountCommand as StreamCommand>::Response>
pub fn count(
&self,
req: CountRequest
) -> Result<<CountCommand as StreamCommand>::Response>
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);