[][src]Struct sonic_channel::SearchChannel

pub struct SearchChannel(_);

The Sonic Channel Search mode is used for querying the search index. 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 query, suggest, ping and quit commands.

Note: This mode requires enabling the search feature.

Implementations

impl SearchChannel[src]

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

Stop connection.

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

channel.quit()?;

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

Ping server.

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

channel.ping()?;

impl SearchChannel[src]

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

Query objects in database.

Note: This method requires enabling the search feature and start connection in Search mode.

let search_channel = SearchChannel::start(
    "localhost:1491",
    "SecretPassword",
)?;

let result = search_channel.query("search", "default", "Beef")?;
dbg!(result);

pub fn query_with_limit<'a>(
    &self,
    collection: &'a str,
    bucket: &'a str,
    terms: &'a str,
    limit: usize
) -> Result<<QueryCommand<'_> as StreamCommand>::Response>
[src]

Query limited objects in database. This method similar query but you can configure limit of result.

Note: This method requires enabling the search feature and start connection in Search mode.

let search_channel = SearchChannel::start(
    "localhost:1491",
    "SecretPassword",
)?;

let result = search_channel.query_with_limit(
    "search",
    "default",
    "Beef",
    10,
)?;
dbg!(result);

pub fn query_with_limit_and_offset<'a>(
    &self,
    collection: &'a str,
    bucket: &'a str,
    terms: &'a str,
    limit: usize,
    offset: usize
) -> Result<<QueryCommand<'_> as StreamCommand>::Response>
[src]

Query limited objects in database. This method similar query_with_limit but you can put offset in your query.

Note: This method requires enabling the search feature and start connection in Search mode.

let search_channel = SearchChannel::start(
    "localhost:1491",
    "SecretPassword",
)?;

let result = search_channel.query_with_limit_and_offset(
    "search",
    "default",
    "Beef",
    10,
    10,
)?;
dbg!(result);

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

Suggest auto-completes words.

Note: This method requires enabling the search feature and start connection in Search mode.

let search_channel = SearchChannel::start(
    "localhost:1491",
    "SecretPassword",
)?;

let result = search_channel.suggest("search", "default", "Beef")?;
dbg!(result);

pub fn suggest_with_limit<'a>(
    &self,
    collection: &'a str,
    bucket: &'a str,
    word: &'a str,
    limit: usize
) -> Result<<SuggestCommand<'_> as StreamCommand>::Response>
[src]

Suggest auto-completes words with limit.

Note: This method requires enabling the search feature and start connection in Search mode.

let search_channel = SearchChannel::start(
    "localhost:1491",
    "SecretPassword",
)?;

let result = search_channel.suggest_with_limit("search", "default", "Beef", 5)?;
dbg!(result);

Trait Implementations

impl Debug for SearchChannel[src]

impl SonicChannel for SearchChannel[src]

type Channel = SearchChannel

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.