Displaying Paginated List of Distinct Cities from Documents
TLDR gab was struggling to paginate a list of distinct cities in documents. Kishore Nallan suggested to use the group_by
command, and adjusting group_limit
to display only a single document per city.
Apr 19, 2022 (21 months ago)
gab
10:22 AMI have documents with a "city" facet field.
I would like to display paginated list of cities.
How could I browse all cities ? (page 1: 20 groups, page 2: 20 groups, etc)
Also I don't want hits for each groups.
I also tried with
facet_by
but it doesn't seem to be the proper way of doing it.Kishore Nallan
10:25 AMgab
10:25 AMKishore Nallan
10:26 AMgab
10:29 AM• I wonder if I'm browsing groups or documents using per_page/page
• Also I cannot remove hits from results. I tried with limit_hits:0 (Also with "group_limit":1)
Kishore Nallan
10:37 AMKishore Nallan
10:38 AMgroup_limit: 1
to limit to just a single doc per group.gab
10:50 AMit seems so far I can browse properly
{
"collection": "warehouses",
"query_by": "name",
"per_page": 20,
"page":"1",
"group_by": "city",
"q":"",
"sort_by":"city:asc",
"group_limit": 1,
}
Kishore Nallan
10:53 AMTypesense
Indexed 3015 threads (79% resolved)
Similar Threads
Increase Search Result Size and Filter Special Characters
Anton requested pagination beyond 250 hits per page and precise filtering for terms with special characters. Jason suggested multi-search as a workaround and planned to address special character filtering in an upcoming release. A Github issue was created to track this feature request.
Equitable Distribution of Suppliers in Ecommerce Platform
Max has a problem with pagination, distribution, and grouping in an ecommerce use case. Jason suggests using "group_by" but notes that dynamic group sizes are not possible.
Moving from Algolia to Typesense: Questions and Answers
Juan sought advice from Kishore Nallan about moving from Algolia to Typesense, handling MultiSearch, setting parameters, checking imported documents, and a specific syntax query.
Limiting Results by Facets in `queryBy` Clause
gab asks about limiting results by facets in the `queryBy` clause. Kishore Nallan suggests making multiple queries independently using the multi_search endpoint.
Retrieving All Documents: Challenges and Considerations
Masahiro asked about retrieving all documents in one query. Harisaran suggested increasing the `per_page` parameter. Kishore Nallan clarified that getting all results is possible via pagination or export, but implementing query + export feature is in the backlog. It was also discussed that extensively scrolling through search results can cause slower performance.