mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-07-27 08:41:00 +00:00
fix clippy warnings
This commit is contained in:
@ -78,22 +78,22 @@ impl Data {
|
||||
Ok(Data { inner })
|
||||
}
|
||||
|
||||
pub async fn settings<S: AsRef<str>>(&self, uid: S) -> anyhow::Result<Settings> {
|
||||
self.index_controller.settings(uid.as_ref().to_string()).await
|
||||
pub async fn settings(&self, uid: String) -> anyhow::Result<Settings> {
|
||||
self.index_controller.settings(uid).await
|
||||
}
|
||||
|
||||
pub async fn list_indexes(&self) -> anyhow::Result<Vec<IndexMetadata>> {
|
||||
self.index_controller.list_indexes().await
|
||||
}
|
||||
|
||||
pub async fn index(&self, uid: impl AsRef<str>) -> anyhow::Result<Option<IndexMetadata>> {
|
||||
self.index_controller.get_index(uid.as_ref().to_string()).await
|
||||
pub async fn index(&self, uid: String) -> anyhow::Result<IndexMetadata> {
|
||||
self.index_controller.get_index(uid).await
|
||||
}
|
||||
|
||||
pub async fn create_index(&self, uid: impl AsRef<str>, primary_key: Option<impl AsRef<str>>) -> anyhow::Result<IndexMetadata> {
|
||||
pub async fn create_index(&self, uid: String, primary_key: Option<String>) -> anyhow::Result<IndexMetadata> {
|
||||
let settings = IndexSettings {
|
||||
uid: Some(uid.as_ref().to_string()),
|
||||
primary_key: primary_key.map(|s| s.as_ref().to_string()),
|
||||
uid: Some(uid),
|
||||
primary_key,
|
||||
};
|
||||
|
||||
let meta = self.index_controller.create_index(settings).await?;
|
||||
|
@ -4,12 +4,12 @@ use crate::index::{SearchQuery, SearchResult};
|
||||
use super::Data;
|
||||
|
||||
impl Data {
|
||||
pub async fn search<S: AsRef<str>>(
|
||||
pub async fn search(
|
||||
&self,
|
||||
index: S,
|
||||
index: String,
|
||||
search_query: SearchQuery,
|
||||
) -> anyhow::Result<SearchResult> {
|
||||
self.index_controller.search(index.as_ref().to_string(), search_query).await
|
||||
self.index_controller.search(index, search_query).await
|
||||
}
|
||||
|
||||
pub async fn retrieve_documents(
|
||||
@ -24,11 +24,11 @@ impl Data {
|
||||
|
||||
pub async fn retrieve_document(
|
||||
&self,
|
||||
index: impl AsRef<str> + Sync + Send + 'static,
|
||||
document_id: impl AsRef<str> + Sync + Send + 'static,
|
||||
index: String,
|
||||
document_id: String,
|
||||
attributes_to_retrieve: Option<Vec<String>>,
|
||||
) -> anyhow::Result<Map<String, Value>>
|
||||
{
|
||||
self.index_controller.document(index.as_ref().to_string(), document_id.as_ref().to_string(), attributes_to_retrieve).await
|
||||
self.index_controller.document(index, document_id, attributes_to_retrieve).await
|
||||
}
|
||||
}
|
||||
|
@ -9,14 +9,14 @@ use super::Data;
|
||||
impl Data {
|
||||
pub async fn add_documents(
|
||||
&self,
|
||||
index: impl AsRef<str> + Send + Sync + 'static,
|
||||
index: String,
|
||||
method: IndexDocumentsMethod,
|
||||
format: UpdateFormat,
|
||||
stream: Payload,
|
||||
primary_key: Option<String>,
|
||||
) -> anyhow::Result<UpdateStatus>
|
||||
{
|
||||
let update_status = self.index_controller.add_documents(index.as_ref().to_string(), method, format, stream, primary_key).await?;
|
||||
let update_status = self.index_controller.add_documents(index, method, format, stream, primary_key).await?;
|
||||
Ok(update_status)
|
||||
}
|
||||
|
||||
@ -27,53 +27,53 @@ impl Data {
|
||||
create: bool,
|
||||
) -> anyhow::Result<UpdateStatus> {
|
||||
let update = self.index_controller.update_settings(index, settings, create).await?;
|
||||
Ok(update.into())
|
||||
Ok(update)
|
||||
}
|
||||
|
||||
pub async fn clear_documents(
|
||||
&self,
|
||||
index: impl AsRef<str> + Sync + Send + 'static,
|
||||
index: String,
|
||||
) -> anyhow::Result<UpdateStatus> {
|
||||
let update = self.index_controller.clear_documents(index.as_ref().to_string()).await?;
|
||||
let update = self.index_controller.clear_documents(index).await?;
|
||||
Ok(update)
|
||||
}
|
||||
|
||||
pub async fn delete_documents(
|
||||
&self,
|
||||
index: impl AsRef<str> + Sync + Send + 'static,
|
||||
index: String,
|
||||
document_ids: Vec<String>,
|
||||
) -> anyhow::Result<UpdateStatus> {
|
||||
let update = self.index_controller.delete_documents(index.as_ref().to_string(), document_ids).await?;
|
||||
Ok(update.into())
|
||||
let update = self.index_controller.delete_documents(index, document_ids).await?;
|
||||
Ok(update)
|
||||
}
|
||||
|
||||
pub async fn delete_index(
|
||||
&self,
|
||||
index: impl AsRef<str> + Send + Sync + 'static,
|
||||
index: String,
|
||||
) -> anyhow::Result<()> {
|
||||
self.index_controller.delete_index(index.as_ref().to_owned()).await?;
|
||||
self.index_controller.delete_index(index).await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn get_update_status(&self, index: impl AsRef<str>, uid: u64) -> anyhow::Result<Option<UpdateStatus>> {
|
||||
self.index_controller.update_status(index.as_ref().to_string(), uid).await
|
||||
pub async fn get_update_status(&self, index: String, uid: u64) -> anyhow::Result<UpdateStatus> {
|
||||
self.index_controller.update_status(index, uid).await
|
||||
}
|
||||
|
||||
pub async fn get_updates_status(&self, index: impl AsRef<str>) -> anyhow::Result<Vec<UpdateStatus>> {
|
||||
self.index_controller.all_update_status(index.as_ref().to_string()).await
|
||||
pub async fn get_updates_status(&self, index: String) -> anyhow::Result<Vec<UpdateStatus>> {
|
||||
self.index_controller.all_update_status(index).await
|
||||
}
|
||||
|
||||
pub async fn update_index(
|
||||
&self,
|
||||
uid: impl AsRef<str>,
|
||||
primary_key: Option<impl AsRef<str>>,
|
||||
new_uid: Option<impl AsRef<str>>
|
||||
uid: String,
|
||||
primary_key: Option<String>,
|
||||
new_uid: Option<String>
|
||||
) -> anyhow::Result<IndexMetadata> {
|
||||
let settings = IndexSettings {
|
||||
uid: new_uid.map(|s| s.as_ref().to_string()),
|
||||
primary_key: primary_key.map(|s| s.as_ref().to_string()),
|
||||
uid: new_uid,
|
||||
primary_key,
|
||||
};
|
||||
|
||||
self.index_controller.update_index(uid.as_ref().to_string(), settings).await
|
||||
self.index_controller.update_index(uid, settings).await
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user