[−][src]Crate sonic_channel
Sonic Channel
Rust client for sonic search backend.
Example usage
Search channel
Note: This example requires enabling the search
feature, enabled by default.
use sonic_channel::*; fn main() -> result::Result<()> { let channel = SearchChannel::start( "localhost:1491", "SecretPassword", )?; let objects = channel.query("collection", "bucket", "recipe")?; dbg!(objects); Ok(()) }
Ingest channel
Note: This example requires enabling the ingest
feature.
use sonic_channel::*; fn main() -> result::Result<()> { let mut channel = IngestChannel::start( "localhost:1491", "SecretPassword", )?; let pushed = channel.push("collection", "bucket", "object:1", "my best recipe")?; // or // let pushed = channel.push_with_locale("collection", "bucket", "object:1", "Мой лучший рецепт", "rus")?; dbg!(pushed); Ok(()) }
Control channel
Note: This example requires enabling the control
feature.
use sonic_channel::*; fn main() -> result::Result<()> { let mut channel = ControlChannel::start( "localhost:1491", "SecretPassword", )?; let result = channel.consolidate()?; assert_eq!(result, true); Ok(()) }
Modules
result | Contains sonic channel error type and custom Result type for easy configure your functions. |
Structs
ControlChannel | The Sonic Channel Control mode is used for administration purposes. Once in this mode, you cannot switch to other modes or gain access to commands from other modes. |
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. |
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. |
SonicStream | Root and Heart of this library. |
Enums
ChannelMode | Channel modes supported by sonic search backend. |
Traits
SonicChannel | This trait should be implemented for all supported sonic channels |