question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Multiple OR RefinementListFilters produces weird behavior

See original GitHub issue

options

When you select multiple options in an OR RefinementListFilter and then select one from another group, you can end up in a weird state as shown in the above screenshot. You can go to http://demo.fittery.com/twillory/ and pass in colors[0]=Red&patterns[0]=Stripe for an even weirder state where you can get stuck – only way to get out of the filter combo is to hit back or refresh the page.

The code in question for reference:

<LayoutBody>
  <SideBar>
    <RefinementListFilter id="colors" title="Colors" field="colors.raw" operator="OR"/>
    <RefinementListFilter id="patterns" title="Patterns" field="patterns.raw" operator="OR"/>
    <RefinementListFilter id="cuffs" title="Cuffs" field="custom_filters_a.raw" operator="OR"/>
    <RefinementListFilter id="collars" title="Collars" field="custom_filters_b.raw" operator="OR"/>
  </SideBar>
  <LayoutResults>
    <Hits mod="sk-hits-grid" hitsPerPage={100} itemComponent={ItemHit}/>
    <NoHits/>
  </LayoutResults>
</LayoutBody>

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:2
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
GregoryPotdevincommented, May 3, 2016

@joemcelroy It’s pretty easy to re-inject the missing values in the accessor’s getBuckets method

I’d like to point out, though, that we’ll be hitting a limit in terms of performance. We already have 1 component which dynamically transforms the returned buckets, and that’s MenuFilter (to add the “all” entry). The limit is that each time render is called it generates a new bucket and breaks the lazy re-rendering as the props aren’t shallowly equal anymore even if the data hasn’t changed. Injecting the missing value will have exactly the same issue.

I think the correct solution to this problem is to stop using the ES response as is and give the accessors the opportunity to update part of it when it is received. The same why the query is partially built with buildSharedQuery, when the response is received it could be passed to all accessors for transformations (like accessor.mapQueryResults ?). This could be the time to inject the “all” entry and missing values. SearchkitManager could keep a rawResults value to be able to re-run the map logic in case accessor options are changed (like having a showAll prop on MenuFilter).

This could also be used for infinite scrolling, by just letting an InfinitePaginator load more results and append to the query results (and let React refresh the whole list). Not good enough for cache management and random page access but that would require management the hits independently from the queryResults.

@joemcelroy I’ll try to post 2 PRs, one with a quick fix in the accessor that could be released as 0.9.4 and one to experiment with the query resulting mapping.

0reactions
Jaikantcommented, Apr 5, 2017

@ssetem @joemcelroy I am seeing the same behaviour, where the filters show only if there are available results to search within. If the filter is not applicable to the existing search results, the filter is not displayed. I think an option to yet display the filters would be great.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Issue with Multiple Reactive Filters and Updateselectinputs
Issue with Multiple Reactive Filters and Updateselectinputs - Strange Behavior ... I am struggling to solve an issue with passing multiple filters ......
Read more >
Excel Filter strange behaviour - Microsoft Community
I have a simple spreadsheet (15 cols, 1100 rows) that has a filter on headings. If I click on the down arrow in...
Read more >
weird behavior with filtering - Microsoft Power BI Community
Solved: Below are the screen shot of two tables in Power Bi. One without any filter and the other is filter with Average...
Read more >
Hitting enter in AJAX view block produces weird behavior in ...
I am using Search API + Elasticsearch Connector + Views + Better Exposed Filter + Layouts Library. I have a view block with...
Read more >
Strange filter behaviour - Bug reports - Metabase Discussion
The underlying query has various values I want to filter on. ... but the query doesn't fail, it just creates multiple legends.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found