reactivesearch icon indicating copy to clipboard operation
reactivesearch copied to clipboard

Do not apply pristine range filters

Open joepio opened this issue 6 years ago • 5 comments

Affected Projects React

Library Version: x.y.z 3.0.0-rc.20

Describe the bug When filtering sparse data (i.e., when some of the attributes can be present, but may not be), you want filter components to only be applied when the user explicitly sets them.

For example: I work on a search app that filters by some date field, but that date field is only present in 40% of the documents. When I render the RangeSlider component, only items are shown that contain some value for the dataField attribute. This means that only documents are shown that have that specific date field.

This happens, because the RangeSlider applies a filter to the query with the range start and end values.

Ideally, this filter is only applied after the user interacts with the component. This could be fixed by adding a pristine state to RangeSlider and others, and only applies the filter when its value is false.

Perhaps this could be set as an optional prop, e.g. ignoreUntouched.

joepio avatar Jul 17 '19 15:07 joepio

Related #739

bietkul avatar Aug 16 '19 11:08 bietkul

Actually I think this is not fixed completely. While the mechanics implemented with the includeNullValues prop are necessary to get the desired behaviour, a typical solution should be to have something like the ignoreUntouched prop which @joepio proposed.

The component could then set includeNullValues to true internally as long as it is not selected, and turn it to false as soon as there has been user interaction.

In https://github.com/appbaseio/reactivesearch/issues/1096 I suggested that there could be visual indication aswell, like greyed out handles for the initial state.

janus-reith avatar Aug 26 '19 15:08 janus-reith

I agree with @janus-reith, the includeNullValues prop does not solve this issue by itself.

@bietkul Could you perhaps re-open this issue?

joepio avatar Sep 24 '19 11:09 joepio

@ShahAnuj2610 Can you please check it.

bietkul avatar Sep 24 '19 12:09 bietkul

I agree with @janus-reith, the includeNullValues prop does not solve this issue by itself.

@bietkul Could you perhaps re-open this issue?

As of now, this approach should work => https://github.com/appbaseio/reactivesearch/issues/1096#issuecomment-528411554

ShahAnuj2610 avatar Sep 24 '19 13:09 ShahAnuj2610