mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-04 20:37:15 +02:00
feat(http): update the documents resource
- Return Documents API resources on `/documents` in an array in the the results field. - Add limit, offset and total in the response body. - Rename `attributesToRetrieve` into `fields` (only for the `/documents` endpoints, not for the `/search` ones). - The `displayedAttributes` settings does not impact anymore the displayed fields returned in the `/documents` endpoints. These settings only impacts the `/search` endpoint. Fix #2372
This commit is contained in:
parent
ab39df9693
commit
ddad6cc069
11 changed files with 217 additions and 200 deletions
|
@ -524,18 +524,19 @@ where
|
|||
Ok(settings)
|
||||
}
|
||||
|
||||
/// Return the total number of documents contained in the index + the selected documents.
|
||||
pub async fn documents(
|
||||
&self,
|
||||
uid: String,
|
||||
offset: usize,
|
||||
limit: usize,
|
||||
attributes_to_retrieve: Option<Vec<String>>,
|
||||
) -> Result<Vec<Document>> {
|
||||
) -> Result<(u64, Vec<Document>)> {
|
||||
let index = self.index_resolver.get_index(uid).await?;
|
||||
let documents =
|
||||
let result =
|
||||
spawn_blocking(move || index.retrieve_documents(offset, limit, attributes_to_retrieve))
|
||||
.await??;
|
||||
Ok(documents)
|
||||
Ok(result)
|
||||
}
|
||||
|
||||
pub async fn document(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue