pub struct SearchChannel(_);
Expand description

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

Stop connection.

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

channel.quit()?;

Ping server.

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

channel.ping()?;

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(QueryRequest::new(
    Dest::col("search"),
    "Beef",
))?;
dbg!(result);

let result = search_channel.query(
    QueryRequest::new(Dest::col("search"), "Beef").limit(10)
)?;
dbg!(result);

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(
    SuggestRequest::new(Dest::col("search"), "Beef")
)?;
dbg!(result);

let result = search_channel.suggest(
    SuggestRequest::new(Dest::col("search"), "Beef").limit(2)
)?;
dbg!(result);

Enumerates all words in an index.

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.list(
    ListRequest::new(Dest::col("search"))
)?;
dbg!(result);

let result = search_channel.list(
    ListRequest::new(Dest::col("search")).limit(2)
)?;
dbg!(result);

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.