Skip to content

Custom sorting component with ReactiveList #519

Description

@NemanjaTck

Issue Type:
Question

Platform:
Web

Description:
I am currently trying to build complex sorting component and since there is not enough documentation on it I have to ask here. I will split the question in two parts.

  1. Using the default sortOptions of the ReactiveList result component, there is a problem with result relevance. To be more precise, if I set default value to the sort and then try typing something in the search component, the results will still be sorted by default sort value instead by relevance. Is there a way to avoid this with the default sortOptions provided by Reactive Search? So to have ie. SingleDropdownList component to change the current sorting of the elements in the ReactiveList?

  2. I tried to create and put CustomSort inside ReactiveComponent. The code for it is

<ReactiveComponent
  key="componentSort"
  componentId="ComponentSort"
>
  <CustomSort sortData={sortOptions} />
</ReactiveComponent>

CustomSort component has setQuery which gets triggered on button click (there are multiple sortOptions).

setValue(value) {
  this.props.setQuery({
    "query": {
      "match_all": {}
    },
    "sort": {
      value: {"order": "desc"}
    }
  });
}

Query is completely the same as the one being sent by default sortOptions (when checked in dev tools). However query does not update Reactive List component (ReactiveList has custom sort component in react). Should I have defaultQuery even if I do not want to set default sort? Is this the proper way to set up the custom sort?

Great project btw. Much more customizations available compared to SearchKit.

Screenshots: N/A

Reactivesearch version: 2.6.12

Browser: All

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions