Struct sonic_channel::SearchChannel
source · [−]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
sourceimpl SearchChannel
impl SearchChannel
sourceimpl SearchChannel
impl SearchChannel
sourcepub fn query(
&self,
req: QueryRequest
) -> Result<<QueryCommand as StreamCommand>::Response>
pub fn query(
&self,
req: QueryRequest
) -> Result<<QueryCommand as StreamCommand>::Response>
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);
sourcepub fn suggest(
&self,
req: SuggestRequest
) -> Result<<SuggestCommand as StreamCommand>::Response>
pub fn suggest(
&self,
req: SuggestRequest
) -> Result<<SuggestCommand as StreamCommand>::Response>
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);
sourcepub fn list(
&self,
req: ListRequest
) -> Result<<ListCommand as StreamCommand>::Response>
pub fn list(
&self,
req: ListRequest
) -> Result<<ListCommand as StreamCommand>::Response>
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
sourceimpl Debug for SearchChannel
impl Debug for SearchChannel
sourceimpl SonicChannel for SearchChannel
impl SonicChannel for SearchChannel
type Channel = SearchChannel
type Channel = SearchChannel
Sonic channel struct
sourcefn stream(&self) -> &SonicStream
fn stream(&self) -> &SonicStream
Returns reference for sonic stream of connection
Auto Trait Implementations
impl !RefUnwindSafe for SearchChannel
impl Send for SearchChannel
impl !Sync for SearchChannel
impl Unpin for SearchChannel
impl UnwindSafe for SearchChannel
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more