mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-02 11:56:07 -04:00
Include approximate count of search results
This commit is contained in:
parent
51fb590c0e
commit
d9a5c56930
2 changed files with 61 additions and 3 deletions
|
@ -152,11 +152,15 @@ class SearchHandler(BaseHandler):
|
|||
|
||||
highlights = set()
|
||||
|
||||
count = None
|
||||
|
||||
if order_by == "rank":
|
||||
search_result = yield self.store.search_msgs(
|
||||
room_ids, search_term, keys
|
||||
)
|
||||
|
||||
count = search_result["count"]
|
||||
|
||||
if search_result["highlights"]:
|
||||
highlights.update(search_result["highlights"])
|
||||
|
||||
|
@ -207,6 +211,8 @@ class SearchHandler(BaseHandler):
|
|||
if search_result["highlights"]:
|
||||
highlights.update(search_result["highlights"])
|
||||
|
||||
count = search_result["count"]
|
||||
|
||||
results = search_result["results"]
|
||||
|
||||
results_map = {r["event"].event_id: r for r in results}
|
||||
|
@ -359,7 +365,7 @@ class SearchHandler(BaseHandler):
|
|||
|
||||
rooms_cat_res = {
|
||||
"results": results,
|
||||
"count": len(results),
|
||||
"count": count,
|
||||
"highlights": list(highlights),
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue