#community-help

Handling Empty Searches in Typesense

TLDR Ahmed inquired about Typesense's handling of empty searches. Jason explained the default behavior and suggested controlling the ranking using sort_by.

Powered by Struct AI
4
20mo
Solved
Join the chat
Jan 24, 2022 (20 months ago)
Ahmed
Photo of md5-17cc50dcb4d741627fb5fd9a85f48b34
Ahmed
04:48 PM
Hello, how does Typesense with empty searches? Does it simply return the entire collection sorted by date added? Is there any way I can alter how it deals with empty searches?
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
04:51 PM
By default, for * queries, Typesense will sort by the default sorting field if one is mentioned in the collection, otherwise it will fall back to the document insertion order
04:52
Jason
04:52 PM
You can control the ranking using sort_by