mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-26 20:15:07 +08:00
Add a totalHits field on finite pagination return
This commit is contained in:
parent
0fa5c9b515
commit
e9d493c052
@ -118,6 +118,7 @@ pub enum HitsInfo {
|
|||||||
hits_per_page: usize,
|
hits_per_page: usize,
|
||||||
page: usize,
|
page: usize,
|
||||||
total_pages: usize,
|
total_pages: usize,
|
||||||
|
total_hits: usize,
|
||||||
},
|
},
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
OffsetLimit {
|
OffsetLimit {
|
||||||
@ -299,8 +300,8 @@ impl Index {
|
|||||||
HitsInfo::Pagination {
|
HitsInfo::Pagination {
|
||||||
hits_per_page,
|
hits_per_page,
|
||||||
page: offset / hits_per_page + 1,
|
page: offset / hits_per_page + 1,
|
||||||
// TODO @many: estimation for now but we should ask milli to return an exact value
|
|
||||||
total_pages: (number_of_hits + hits_per_page - 1) / query.hits_per_page,
|
total_pages: (number_of_hits + hits_per_page - 1) / query.hits_per_page,
|
||||||
|
total_hits: number_of_hits,
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
HitsInfo::OffsetLimit {
|
HitsInfo::OffsetLimit {
|
||||||
|
Loading…
Reference in New Issue
Block a user