Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preserve elasticsearch order #1674

Closed

Conversation

lizozom
Copy link
Contributor

@lizozom lizozom commented Mar 5, 2019

Summary

Now that we've added the ability to unsort a talbe, we need to be able to use InMemoryTable to show search results in the order defined by ElasticSearch.

To achieve that, I added the preserveSearchResultOrder flag, which in conjunction with allowNeutralSort, will clear existing sorting upon search.

If initial sorting is provided, it's restored when the query is cleared.

Checklist

  • This was checked in mobile
  • This was checked in IE11
  • This was checked in dark mode
  • Any props added have proper autodocs
  • Documentation examples were added
  • A changelog entry exists and is marked appropriately
  • This was checked for breaking changes and labeled appropriately
    [ ] Jest tests were updated or added to match the most common scenarios
  • This was checked against keyboard-only and screenreader scenarios
    ~~ [ ] This required updates to Framer X components~~

@lizozom lizozom changed the title Preserve elasticsearch order 1670 Preserve elasticsearch order Mar 5, 2019
@lizozom lizozom self-assigned this Mar 5, 2019
@lizozom lizozom added the tables label Mar 5, 2019
@chandlerprall
Copy link
Contributor

Is the underlying issue here that unsorting the table does not return it to the original data order?

@lizozom
Copy link
Contributor Author

lizozom commented Mar 5, 2019

@chandlerprall The underlaying issue is that searching a sorted table does not show the correct order returned by ES.

This is all relevant only for InMemoryTable of course.

src/components/basic_table/in_memory_table.js Show resolved Hide resolved
src/components/basic_table/in_memory_table.js Outdated Show resolved Hide resolved
src/components/basic_table/in_memory_table.js Outdated Show resolved Hide resolved
@lizozom lizozom requested a review from chandlerprall March 6, 2019 15:55
if (!shouldClear) {
// don't change sorting
return {};
} else if (isQueryEmpty && sorting) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorting is an object and will always be truthy here

@chandlerprall
Copy link
Contributor

Brought up this PR for discussion in slack with @elastic/kibana-design. We've concluded that not clearing the table's sort when the query changes more often matches a user's expectations and follows similar table implementations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants