Discussing Ability to Sort by a Text Field
TLDR Aljosa asks about sorting by text fields and proposes a workaround. Kishore Nallan discusses database implications and possible workarounds, informing that changes may require reindexing. Andrew expresses interest in string sorting.
Oct 23, 2021 (27 months ago)
Or perhaps I'm crazy and you can do alphabetical sorts ?
Kishore Nallan03:49 PM
Kishore Nallan03:50 PM
Kishore Nallan03:54 PM
Kishore Nallan03:55 PM
Kishore Nallan03:56 PM
Kishore Nallan03:57 PM
I feel like I'm missing something in my understanding. In our case we have a regular "name" field which is maybe 30 characters at most. We could call it a "title" field to better illustrate the type of field.
So before actually sending the documents to typesense for indexing, is there anything preventing me from pre-sorting in my code and creating a numerical value from 1 to X based on the output of that sort ?
Kishore Nallan04:00 PM
Kishore Nallan04:01 PM
Kishore Nallan04:03 PM
In our case we push items to the database and have a listener/subscriber on
@AfterUpdateevents which keeps Typesense in sync. We'd need to add a trigger which updates the sort on all items if the title field is modified on one of them.
It works better for our case because despite having millions of documents, they are segregated cleanly into about 5-10k chunks.
As for supporting sorting on any string length, it doesn't seem worth it. Algolia certainly discourage people from doing it except in rare circumstances and even then as a separate index or something.
Sorting by a fixed length title sort of field could be interesting but I'm not sure how to determine what an optimal length is. 8 characters is probably good enough because at a glance I doubt most people can mentally sort past a certain number of characters, although in titles starting with the same word it would be easier to identify something that's not sorted correctly past the first 8 characters.
Kishore Nallan04:13 PM
Kishore Nallan04:13 PM
Kishore Nallan04:16 PM
Indexed 3005 threads (79% resolved)
Issues Sorting Multiple Fields with Sort_by in Typesense Query
Rishabh was having trouble sorting two fields separately with a single query. Jason explained that a secondary sorting will only occur if the first sort results in matching values. They clarified the functionality of sorting in various search engines.
Issue with Sorting Search Request
Anton encounters an issue with sorting a search request due to an assuredly existing field appearing absent. Jason complements by revealing string sorting isn't supported. Kishore Nallan confirms future support for string sorting, despite its memory-demands.
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.
Resolve Facets and Sorting Issues with Typesense
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.
Adjusting Text Match Score Calculation in TypeSense
Johannes wanted to modify the Text Match Score calculation in TypeSense to improve search results returns. With counsel from Jason and Kishore Nallan, various solutions were proposed, including creating a Github issue, attempting different parameters, and updating Docker to a new version to resolve the matter.