pub struct AsyncSolrCloudClient {
pub context: SolrServerContext,
}Expand description
Async client for SolrCloud
§Examples
use solrstice::{AsyncSolrCloudClient, SolrServerContextBuilder, SolrSingleServerHost};
let context = SolrServerContextBuilder::new(SolrSingleServerHost::new("http://localhost:8983")).build();
let client = AsyncSolrCloudClient::new(context);Fields§
§context: SolrServerContextThe solr server context used to specify how to connect to Solr
Implementations§
Source§impl AsyncSolrCloudClient
impl AsyncSolrCloudClient
Sourcepub fn new<C: Into<SolrServerContext>>(context: C) -> AsyncSolrCloudClient
pub fn new<C: Into<SolrServerContext>>(context: C) -> AsyncSolrCloudClient
Create a new instance of AsyncSolrCloudClient
§Examples
use solrstice::{AsyncSolrCloudClient, SolrServerContextBuilder, SolrSingleServerHost};
let context = SolrServerContextBuilder::new(SolrSingleServerHost::new("http://localhost:8983")).build();
let client = AsyncSolrCloudClient::new(context);Sourcepub async fn upload_config<N: AsRef<str>, P: AsRef<Path>>(
&self,
name: N,
path: P,
) -> Result<(), Error>
pub async fn upload_config<N: AsRef<str>, P: AsRef<Path>>( &self, name: N, path: P, ) -> Result<(), Error>
Upload a config to SolrCloud
§Examples
let context = SolrServerContextBuilder::new(SolrSingleServerHost::new("http://localhost:8983")).build();
let client = AsyncSolrCloudClient::new(context);
client.upload_config("config_name", Path::new("/path/to/config")).await?;Sourcepub async fn get_configs(&self) -> Result<Vec<String>, Error>
pub async fn get_configs(&self) -> Result<Vec<String>, Error>
Get the configs existing in SolrCloud
§Examples
let context = SolrServerContextBuilder::new(SolrSingleServerHost::new("http://localhost:8983")).build();
let client = AsyncSolrCloudClient::new(context);
let configs: Vec<String> = client.get_configs().await?;Sourcepub async fn config_exists<S: AsRef<str>>(&self, name: S) -> Result<bool, Error>
pub async fn config_exists<S: AsRef<str>>(&self, name: S) -> Result<bool, Error>
Check if a config exists in SolrCloud
§Examples
let context = SolrServerContextBuilder::new(SolrSingleServerHost::new("http://localhost:8983")).build();
let client = AsyncSolrCloudClient::new(context);
let exists: bool = client.config_exists("config_name").await?;Sourcepub async fn delete_config<N: AsRef<str>>(&self, name: N) -> Result<(), Error>
pub async fn delete_config<N: AsRef<str>>(&self, name: N) -> Result<(), Error>
Delete a config from SolrCloud
§Examples
let context = SolrServerContextBuilder::new(SolrSingleServerHost::new("http://localhost:8983")).build();
let client = AsyncSolrCloudClient::new(context);
client.delete_config("config_name").await?;Sourcepub async fn create_collection<S: AsRef<str>>(
&self,
name: S,
config: S,
shards: usize,
replication_factor: usize,
) -> Result<(), Error>
pub async fn create_collection<S: AsRef<str>>( &self, name: S, config: S, shards: usize, replication_factor: usize, ) -> Result<(), Error>
Create a collection in SolrCloud
§Examples
let context = SolrServerContextBuilder::new(SolrSingleServerHost::new("http://localhost:8983")).build();
let client = AsyncSolrCloudClient::new(context);
client.create_collection("collection_name", "config_name", 1, 1).await?;Sourcepub async fn get_collections(&self) -> Result<Vec<String>, Error>
pub async fn get_collections(&self) -> Result<Vec<String>, Error>
Get collections from SolrCloud
§Examples
let context = SolrServerContextBuilder::new(SolrSingleServerHost::new("http://localhost:8983")).build();
let client = AsyncSolrCloudClient::new(context);
let collections: Vec<String> = client.get_collections().await?;Sourcepub async fn collection_exists<S: AsRef<str>>(
&self,
name: S,
) -> Result<bool, Error>
pub async fn collection_exists<S: AsRef<str>>( &self, name: S, ) -> Result<bool, Error>
Check if a collection exists in SolrCloud
§Examples
let context = SolrServerContextBuilder::new(SolrSingleServerHost::new("http://localhost:8983")).build();
let client = AsyncSolrCloudClient::new(context);
let exists: bool = client.collection_exists("collection_name").await?;Sourcepub async fn delete_collection<N: AsRef<str>>(
&self,
name: N,
) -> Result<(), Error>
pub async fn delete_collection<N: AsRef<str>>( &self, name: N, ) -> Result<(), Error>
Delete a collection from SolrCloud
§Examples
let context = SolrServerContextBuilder::new(SolrSingleServerHost::new("http://localhost:8983")).build();
let client = AsyncSolrCloudClient::new(context);
client.delete_collection("collection_name").await?;Sourcepub async fn create_alias<S: AsRef<str>>(
&self,
alias: S,
collections: &[S],
) -> Result<(), Error>
pub async fn create_alias<S: AsRef<str>>( &self, alias: S, collections: &[S], ) -> Result<(), Error>
Create an alias in SolrCloud
§Examples
let context = SolrServerContextBuilder::new(SolrSingleServerHost::new("http://localhost:8983")).build();
let client = AsyncSolrCloudClient::new(context);
client.create_alias("alias_name", &["collection1", "collection2"]).await?;Sourcepub async fn get_aliases(&self) -> Result<HashMap<String, Vec<String>>, Error>
pub async fn get_aliases(&self) -> Result<HashMap<String, Vec<String>>, Error>
Get aliases from SolrCloud
§Examples
let context = SolrServerContextBuilder::new(SolrSingleServerHost::new("http://localhost:8983")).build();
let client = AsyncSolrCloudClient::new(context);
let aliases: HashMap<String, Vec<String>> = client.get_aliases().await?;Sourcepub async fn alias_exists<N: AsRef<str>>(&self, name: N) -> Result<bool, Error>
pub async fn alias_exists<N: AsRef<str>>(&self, name: N) -> Result<bool, Error>
Check if an alias exists in SolrCloud
§Examples
let context = SolrServerContextBuilder::new(SolrSingleServerHost::new("http://localhost:8983")).build();
let client = AsyncSolrCloudClient::new(context);
let exists: bool = client.alias_exists("alias_name").await?;Sourcepub async fn delete_alias<S: AsRef<str>>(&self, name: S) -> Result<(), Error>
pub async fn delete_alias<S: AsRef<str>>(&self, name: S) -> Result<(), Error>
Delete an alias from SolrCloud
§Examples
let context = SolrServerContextBuilder::new(SolrSingleServerHost::new("http://localhost:8983")).build();
let client = AsyncSolrCloudClient::new(context);
client.delete_alias("alias_name").await?;Sourcepub async fn index<T: Serialize, B: AsRef<UpdateQuery>, C: AsRef<str>>(
&self,
builder: B,
collection: C,
data: &[T],
) -> Result<SolrResponse, Error>
pub async fn index<T: Serialize, B: AsRef<UpdateQuery>, C: AsRef<str>>( &self, builder: B, collection: C, data: &[T], ) -> Result<SolrResponse, Error>
Index some data into SolrCloud
§Examples
#[derive(Serialize)]
struct Data {id: String}
let context = SolrServerContextBuilder::new(SolrSingleServerHost::new("http://localhost:8983")).build();
let client = AsyncSolrCloudClient::new(context);
let response = client.index(&UpdateQuery::new(), "collection_name", &[Data {id: "test".to_string()}]).await?;Sourcepub async fn select<B: AsRef<SelectQuery>, D: Into<SelectDestination>>(
&self,
builder: B,
destination: D,
) -> Result<SolrResponse, Error>
pub async fn select<B: AsRef<SelectQuery>, D: Into<SelectDestination>>( &self, builder: B, destination: D, ) -> Result<SolrResponse, Error>
Select some data from SolrCloud
§Examples
let context = SolrServerContextBuilder::new(SolrSingleServerHost::new("http://localhost:8983")).build();
let client = AsyncSolrCloudClient::new(context);
let response = client.select(&SelectQuery::new().fq(["age:[* TO *]"]), "collection_name").await?;Sourcepub async fn select_raw<B: AsRef<SelectQuery>, D: Into<SelectDestination>>(
&self,
builder: B,
destination: D,
) -> Result<HashMap<String, Value>, Error>
pub async fn select_raw<B: AsRef<SelectQuery>, D: Into<SelectDestination>>( &self, builder: B, destination: D, ) -> Result<HashMap<String, Value>, Error>
Select some data from SolrCloud. Return the response directly
§Examples
let context = SolrServerContextBuilder::new(SolrSingleServerHost::new("http://localhost:8983")).build();
let client = AsyncSolrCloudClient::new(context);
let response: HashMap<String, serde_json::Value> = client.select_raw(&SelectQuery::new().fq(["age:[* TO *]"]), "collection_name").await?;Sourcepub async fn delete<B: AsRef<DeleteQuery>, C: AsRef<str>>(
&self,
builder: B,
collection: C,
) -> Result<SolrResponse, Error>
pub async fn delete<B: AsRef<DeleteQuery>, C: AsRef<str>>( &self, builder: B, collection: C, ) -> Result<SolrResponse, Error>
Delete some data from SolrCloud
§Examples
let context = SolrServerContextBuilder::new(SolrSingleServerHost::new("http://localhost:8983")).build();
let client = AsyncSolrCloudClient::new(context);
let response = client.delete(&DeleteQuery::new().ids(["document1"]).queries(["age:[* TO *]"]), "collection_name").await?;Trait Implementations§
Source§impl Clone for AsyncSolrCloudClient
impl Clone for AsyncSolrCloudClient
Source§fn clone(&self) -> AsyncSolrCloudClient
fn clone(&self) -> AsyncSolrCloudClient
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for AsyncSolrCloudClient
impl !RefUnwindSafe for AsyncSolrCloudClient
impl Send for AsyncSolrCloudClient
impl Sync for AsyncSolrCloudClient
impl Unpin for AsyncSolrCloudClient
impl !UnwindSafe for AsyncSolrCloudClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more