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

Support infinite ranges on filters #4948

Merged
merged 5 commits into from
Sep 15, 2015

Conversation

epixa
Copy link
Contributor

@epixa epixa commented Sep 15, 2015

When only one side of the range is infinite, we never add a condition to
the script filter for that half of the range, so elasticsearch treats it
as infinite.

When both sides of the range are infinite, we use a match_all filter
instead of a conditional script to define the range.

range-filters

The core of the change is in epixa@6761e01. The other commits are just moving existing test files into the correct places.

Fixes #4862

When only one side of the range is infinite, we never add a condition to
the script filter for that half of the range, so elasticsearch treats it
as infinite.

When both sides of the range are infinite, we use a match_all filter
instead of a conditional script to define the range.
Test directories should live alongside the files they are testing.
Test directories should live alongside the files they are testing.
@simianhacker
Copy link
Member

Looking at the tests it seems like there is an inconsistency on how you use context vs. describe. As it stands now we use describe for every thing so for consistency sake I would just stick with describe.

@w33ble just opened #4949 to start a discussion about updating the style guide. I think it would be good to come up with a set of guidelines for when to use context vs describe.

@epixa
Copy link
Contributor Author

epixa commented Sep 15, 2015

I definitely don't want to block this PR on a styleguide discussion, so I'll change them to describe.


beforeEach(ngMock.module('kibana'));
beforeEach(ngMock.inject(function (Private, $rootScope) {
resolvePromises = () => $rootScope.$apply();
Copy link
Contributor

Choose a reason for hiding this comment

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

I get what you were doing here, but I don't think the overhead is worth it. Seeing $scope.$apply() in the code, it's clear what that command is doing since we're already in Angular land. Seeing resolvePromises means you have to go look up what that code is doing.

Calling $apply is also already pretty concise.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I was just trying to keep the tests as expressive as possible, but I'm not married to this approach. I'll swap it out with direct access to $rootScope.

@w33ble w33ble mentioned this pull request Sep 15, 2015
@w33ble
Copy link
Contributor

w33ble commented Sep 15, 2015

@epixa this can't be backported as-is, since we don't have ES6 support pre-4.2. Can you open a new issue (same as 4846, but for 4.1.3), remove the 4.1.3 label from this PR and submit a new PR for backporting?

Otherwise, this LGTM. Passing on for last looks.

@w33ble w33ble assigned Bargs and unassigned w33ble Sep 15, 2015
@epixa
Copy link
Contributor Author

epixa commented Sep 15, 2015

Yep, I can do that. How do we identify issues that should be backported? The original issue itself was not labeled for 4.1.3.

@w33ble
Copy link
Contributor

w33ble commented Sep 15, 2015

Usually bugfixes go back 1 version. In this case, #4613 fixed 4.2, and #4846 backported it to 4.1. Since both the original and backport featured this issue with infinite ranges, it needs to be fixed in both places.

This is kind of an edge case though, since 4613 was really a feature add, but it fixed some stuff that needed to be fixed in 4.1 too, which is why it was backported as a whole. More generally, the original issue will usually indicate if the fix needs to be backported as well.

@epixa
Copy link
Contributor Author

epixa commented Sep 15, 2015

Makes sense to me.

@Bargs
Copy link
Contributor

Bargs commented Sep 15, 2015

LGTM 👍

Bargs pushed a commit that referenced this pull request Sep 15, 2015
@Bargs Bargs merged commit f003c3a into elastic:master Sep 15, 2015
@epixa epixa deleted the 4862-scripted-field-range-filters branch September 16, 2015 14:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants