Resolve Facets and Sorting Issues with Typesense
TLDR Ethan needed assistance with getting all facet values and sorting results by date using Typesense. Jason provided guidance on how to use Typesense properties to accomplish these tasks, and resolved issues related to specific use-cases provided by Ethan and Rushil.
10
1
Jul 25, 2023 (4 months ago)
Ethan
11:07 PMJul 26, 2023 (4 months ago)
Jason
12:00 AMfacet_by: fieldName
and max_facet_values: 9999999
(some large number)Ethan
12:32 AMJason
12:46 AMlimit
and showMoreLimit
parameters in RefinementList or any of the other filter widgets, which the adapter then uses internally to set facet_by and max_facet_valuesEthan
12:47 AMEthan
12:47 AMJason
12:48 AMJason
12:48 AMCould you elaborate on this? This is how I’ve seen refinementList work by default
Ethan
12:48 AMJason
12:49 AMEthan
12:49 AMEthan
12:53 AMmarketing
option, if I first filter by internships then this facet option wont appear in our refinement listJason
12:54 AMJason
12:56 AMJason
12:57 AMJason
12:57 AMEthan
12:58 AMJason
12:59 AMEthan
01:00 AMJason
01:02 AM1
Jason
01:46 AMv2.7.1-3
of the adapterEthan
02:35 AMEthan
02:35 AMJason
03:09 AMJason
03:09 AMSpecifically the
items
array, in the format described in that sectionEthan
06:38 AMEthan
06:52 AM_text_match:desc
default for every query? or should it be specified and somehow our default sort is already updates_date:descJason
04:33 PMIf so, could you copy-as-curl the network request to Typesense for both sort orders and DM it to me?
Jason
04:34 PMIf no sort_by is mentioned, yes this is default.
If a sort_by is mentioned,
_text_match:desc
is added as the last sort parameter, after the sorts you’ve specified in sort_byJason
07:52 PM"default_sorting_field": "updated_date"
in the collection schema. So when you don’t specify a sort_by parameter in the search, Typesense automatically sorts by updated_date:desc
. This is why the results look similar when you add sort_by=updated_date:desc
Ethan
07:53 PMJason
07:54 PMq
is something other than *
, which is when text_match is calculated. Otherwise text_match is identical for a wild-card *
query1
Ethan
07:57 PMJason
07:58 PMEthan
08:00 PMEthan
08:01 PMJason
08:03 PMEthan
08:04 PMJason
08:09 PMJason
08:10 PMJason
08:11 PMEthan
08:11 PMJason
08:11 PMJason
08:12 PMgroup_by: company_name
and set group_limit: 1
Ethan
08:12 PMEthan
08:13 PMJason
08:13 PM1
Ethan
08:15 PMJason
08:17 PMEthan
08:20 PMEthan
08:21 PM1
1
Ethan
08:34 PMJason
08:46 PMRushil
09:21 PMdefault_sorting_field
?Rushil
09:32 PMobjectId
. It seems like this isn’t possible on Typesense thoughJason
09:35 PMUnfortunately no. You would have to create a new collection and reindex your data in it.
1
Jason
09:36 PMDo you let Algolia auto-generate these objectIds or do you generate them on your side?
Rushil
09:36 PMRushil
09:37 PMWe generate the object IDs and sync them to Algolia. We’re doing the same thing with Typesense with
id
Jason
09:38 PMid
which is used to dedupe records. However, you can’t use the id
field for sorting. So you would have to duplicate the same id
in a new field called say sortId and then use that field for sorting1
Rushil
09:50 PMposting_id
field. I think I may have misread something, but can you sort string fields? I’m running into errors when tryingJason
09:51 PMsort: true
in the schema for that field definition1
Jason
09:51 PMBut you can mimic the default_sorting_field behavior, by just using sort_by explicitly in the search query
1
Ethan
09:52 PMJason
09:52 PMRushil
09:52 PMJason
09:53 PMJason
09:54 PM1
Ethan
09:55 PMJason
09:57 PM1
Typesense
Indexed 3015 threads (79% resolved)
Similar Threads
Querying with Typesense-Js and Handling Null Values
michtio was querying using typesense-js and receiving fewer results than expected. Kishore Nallan suggested using different query parameters. Further discussion led to the handling of 'null' values and filtering syntax in the search queries. The thread ended with Jason offering migration support from Algolia to Typesense.
Query on Facet Values, `max_facet_values` , and `facet_query_num_typos`.
Jan asked about sorting facet values, managing `max_facet_values` and issues with `facet_query_num_typos`. Jason clarified the details on instantsearch widget handling of `max_facet_values` and identified a bug on the Typesense Server. Jason suggested a solution to the sorting issue.
Range Filtering and Faceting Discussion
Phil asked about the requirements for range filtering, which Jason explained does not always require faceting. Discussion about different possibilities with Algolia and Typesense ensued, resulting in Phil successfully utilizing the 'Configure' widget.
Typesense Sorting Query and Bug Report
michtio is new to Typesense and is querying sorting implementation. Jason shares resources and suggests use of specific adapters. However, michtio shares a bug found when applying a filter on Typesense. Jason asks for a GitHub issue to be opened for the bug.
Troubleshooting Typesense Setup and Understanding Facets and Keywords
Demitri encountered errors when exploring Typesense for the first time. Jason guided them through troubleshooting and discussed facets, keyword settings, and widget configurations. Helin shared a Python demo app and its source code to help Demitri with their project.