mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-26 12:05:05 +08:00
Update analytics
This commit is contained in:
parent
0578aff8c9
commit
a2314cf436
@ -271,8 +271,8 @@ impl Segment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async fn run(mut self, meilisearch: MeiliSearch) {
|
async fn run(mut self, meilisearch: MeiliSearch) {
|
||||||
const INTERVAL: Duration = Duration::from_secs(60); // one minute
|
const INTERVAL: Duration = Duration::from_secs(60 * 60); // one hour
|
||||||
// The first batch must be sent after one minute.
|
// The first batch must be sent after one hour.
|
||||||
let mut interval =
|
let mut interval =
|
||||||
tokio::time::interval_at(tokio::time::Instant::now() + INTERVAL, INTERVAL);
|
tokio::time::interval_at(tokio::time::Instant::now() + INTERVAL, INTERVAL);
|
||||||
|
|
||||||
@ -302,7 +302,7 @@ impl Segment {
|
|||||||
.push(Identify {
|
.push(Identify {
|
||||||
context: Some(json!({
|
context: Some(json!({
|
||||||
"app": {
|
"app": {
|
||||||
"version": "prototype-pagination-4".to_string(),
|
"version": env!("CARGO_PKG_VERSION").to_string(),
|
||||||
},
|
},
|
||||||
})),
|
})),
|
||||||
user: self.user.clone(),
|
user: self.user.clone(),
|
||||||
@ -428,13 +428,14 @@ impl SearchAggregator {
|
|||||||
ret.max_terms_number = q.split_whitespace().count();
|
ret.max_terms_number = q.split_whitespace().count();
|
||||||
}
|
}
|
||||||
|
|
||||||
if query.limit.is_none() && query.offset.is_none() {
|
if query.hits_per_page.or(query.page).is_some() {
|
||||||
ret.max_limit = query.hits_per_page;
|
let limit = query.hits_per_page.unwrap_or_else(DEFAULT_SEARCH_LIMIT);
|
||||||
ret.max_offset = query.page.saturating_sub(1) * query.hits_per_page;
|
ret.max_limit = limit;
|
||||||
|
ret.max_offset = query.page.unwrap_or(1).saturating_sub(1) * limit;
|
||||||
ret.finite_pagination = 1;
|
ret.finite_pagination = 1;
|
||||||
} else {
|
} else {
|
||||||
ret.max_limit = query.limit.unwrap_or_else(DEFAULT_SEARCH_LIMIT);
|
ret.max_limit = query.limit;
|
||||||
ret.max_offset = query.offset.unwrap_or_default();
|
ret.max_offset = query.offset;
|
||||||
ret.finite_pagination = 0;
|
ret.finite_pagination = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user