Commit a567939f by Torkel Ödegaard

fix(elasticsearch): quote variable value in lucene variable mulit format, fixes #2828

parent b80dc92c
......@@ -44,7 +44,10 @@ function (angular, _) {
return '(' + value.join('|') + ')';
}
case "lucene": {
return '(' + value.join(' OR ') + ')';
var quotedValues = _.map(value, function(val) {
return '\\\"' + val + '\\\"';
});
return '(' + quotedValues.join(' OR ') + ')';
}
case "pipe": {
return value.join('|');
......
......@@ -262,7 +262,10 @@ function (angular, _, kbn) {
break;
}
case 'lucene': {
allValue = '(' + _.pluck(variable.options, 'text').join(' OR ') + ')';
var quotedValues = _.map(variable.options, function(val) {
return '\\\"' + val.text + '\\\"';
});
allValue = '(' + quotedValues.join(' OR ') + ')';
break;
}
case 'regex values': {
......
......@@ -68,7 +68,7 @@ define([
value: ['test','test2'],
}
});
expect(result).to.be('(test OR test2)');
expect(result).to.be('(\\\"test\\\" OR \\\"test2\\\")');
});
it('multi value and regex format should render regex string', function() {
......
......@@ -321,7 +321,7 @@ define([
});
it('should add lucene glob', function() {
expect(scenario.variable.options[0].value).to.be('(backend1 OR backend2)');
expect(scenario.variable.options[0].value).to.be('(\\\"backend1\\\" OR \\\"backend2\\\")');
});
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment