[][src]Struct sonic_channel::IngestChannel

pub struct IngestChannel(_);

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

impl IngestChannel[src]

pub fn quit(&self) -> Result<<QuitCommand as StreamCommand>::Response>[src]

Stop connection.

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

channel.quit()?;

pub fn ping(&self) -> Result<<PingCommand as StreamCommand>::Response>[src]

Ping server.

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

channel.ping()?;

impl IngestChannel[src]

pub fn push<'a>(
    &self,
    collection: &'a str,
    bucket: &'a str,
    object: &'a str,
    text: &'a str
) -> Result<<PushCommand<'_> as StreamCommand>::Response>
[src]

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(
    "search",
    "default",
    "recipe:295",
    "Sweet Teriyaki Beef Skewers",
)?;
assert_eq!(result, true);

pub fn push_with_locale<'a>(
    &self,
    collection: &'a str,
    bucket: &'a str,
    object: &'a str,
    text: &'a str,
    locale: &'a str
) -> Result<<PushCommand<'_> as StreamCommand>::Response>
[src]

Push search data in the index with locale parameter in ISO 639-3 code.

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_with_locale(
    "search",
    "default",
    "recipe:296",
    "Гренки с жареным картофелем и сыром",
    "rus",
)?;
assert_eq!(result, true);

pub fn pop<'a>(
    &self,
    collection: &'a str,
    bucket: &'a str,
    object: &'a str,
    text: &'a str
) -> Result<<PopCommand<'_> as StreamCommand>::Response>
[src]

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 result = ingest_channel.pop("search", "default", "recipe:295", "beef")?;
assert_eq!(result, 1);

pub fn flushc<'a>(
    &self,
    collection: &'a str
) -> Result<<FlushCommand<'_> as StreamCommand>::Response>
[src]

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.flushc("search")?;
dbg!(flushc_count);

pub fn flushb<'a>(
    &self,
    collection: &'a str,
    bucket: &'a str
) -> Result<<FlushCommand<'_> as StreamCommand>::Response>
[src]

Flush all indexed data from bucket in a collection.

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

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

let flushb_count = ingest_channel.flushb("search", "default")?;
dbg!(flushb_count);

pub fn flusho<'a>(
    &self,
    collection: &'a str,
    bucket: &'a str,
    object: &'a str
) -> Result<<FlushCommand<'_> as StreamCommand>::Response>
[src]

Flush all indexed data from an object in a bucket in collection.

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

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

let flusho_count = ingest_channel.flusho("search", "default", "recipe:296")?;
dbg!(flusho_count);

pub fn bucket_count<'a>(
    &self,
    collection: &'a str
) -> Result<<CountCommand<'_> as StreamCommand>::Response>
[src]

Bucket count in 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.bucket_count("search")?;
dbg!(bucket_count);

pub fn object_count<'a>(
    &self,
    collection: &'a str,
    bucket: &'a str
) -> Result<<CountCommand<'_> as StreamCommand>::Response>
[src]

Object count of bucket in indexed search data.

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

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

let object_count = ingest_channel.object_count("search", "default")?;
dbg!(object_count);

pub fn word_count<'a>(
    &self,
    collection: &'a str,
    bucket: &'a str,
    object: &'a str
) -> Result<<CountCommand<'_> as StreamCommand>::Response>
[src]

Object word count in indexed bucket search data.

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

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

let word_count = ingest_channel.word_count("search", "default", "recipe:296")?;
dbg!(word_count);

Trait Implementations

impl Debug for IngestChannel[src]

impl SonicChannel for IngestChannel[src]

type Channel = IngestChannel

Sonic channel struct

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.