mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2025-07-07 20:46:24 +02:00
fix search result amount/count being incorrect
Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
parent
e2c58e6824
commit
8f4f95e2b4
1 changed files with 4 additions and 4 deletions
|
@ -134,7 +134,7 @@ pub(crate) async fn search_events_route(
|
||||||
None => 0, // Default to the start
|
None => 0, // Default to the start
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut results = Vec::new();
|
let mut results = Vec::with_capacity(searches.len());
|
||||||
let next_batch = skip.saturating_add(limit);
|
let next_batch = skip.saturating_add(limit);
|
||||||
|
|
||||||
for _ in 0..next_batch {
|
for _ in 0..next_batch {
|
||||||
|
@ -148,8 +148,8 @@ pub(crate) async fn search_events_route(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let results: Vec<_> = results
|
let final_results: Vec<_> = results
|
||||||
.into_iter()
|
.iter()
|
||||||
.skip(skip)
|
.skip(skip)
|
||||||
.stream()
|
.stream()
|
||||||
.filter_map(|id| services.rooms.timeline.get_pdu_from_id(id).map(Result::ok))
|
.filter_map(|id| services.rooms.timeline.get_pdu_from_id(id).map(Result::ok))
|
||||||
|
@ -188,7 +188,7 @@ pub(crate) async fn search_events_route(
|
||||||
count: Some(results.len().try_into().unwrap_or_else(|_| uint!(0))),
|
count: Some(results.len().try_into().unwrap_or_else(|_| uint!(0))),
|
||||||
groups: BTreeMap::new(), // TODO
|
groups: BTreeMap::new(), // TODO
|
||||||
next_batch,
|
next_batch,
|
||||||
results,
|
results: final_results,
|
||||||
state: room_states,
|
state: room_states,
|
||||||
highlights: search_criteria
|
highlights: search_criteria
|
||||||
.search_term
|
.search_term
|
||||||
|
|
Loading…
Add table
Reference in a new issue