How can we change the default sorby selected value...
# community-help
s
How can we change the default sorby selected value in the sortBy widget. I know that whichever value is passed as empty request( i.e. default text_match) ordering will be selected. For example in this site: https://cadcodemanas.redstart.dev/search-with-typesense/ Relevant Paragraph is the default one. I want to make Relevant Date the default one. How do I go about that?
j
In this code:
Copy code
search.addWidgets([
  sortBy({
    container: "#sort-by",
    items: [
      { label: "Default", value: "products" },
      { label: "Price (asc)", value: "products/sort/price:asc" },
      { label: "Price (desc)", value: "products/sort/price:desc" },
    ],
  }),
]);
I think the first email of the
items
array determines which is the default sort by used by instantsearch