Expressions: Wrap at 140 columns (#34493)
Apply our standard line length to all of the java files in the `lang-expression` plugin.
This commit is contained in:
parent
5d74f8085b
commit
1452d55155
|
@ -656,9 +656,6 @@
|
|||
<suppress files="server[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]update[/\\]UpdateIT.java" checks="LineLength" />
|
||||
<suppress files="server[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]validate[/\\]SimpleValidateQueryIT.java" checks="LineLength" />
|
||||
<suppress files="server[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]versioning[/\\]SimpleVersioningIT.java" checks="LineLength" />
|
||||
<suppress files="modules[/\\]lang-expression[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]script[/\\]expression[/\\]ExpressionScriptEngine.java" checks="LineLength" />
|
||||
<suppress files="modules[/\\]lang-expression[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]script[/\\]expression[/\\]MoreExpressionTests.java" checks="LineLength" />
|
||||
<suppress files="modules[/\\]lang-expression[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]script[/\\]expression[/\\]StoredExpressionTests.java" checks="LineLength" />
|
||||
<suppress files="modules[/\\]lang-painless[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]painless[/\\]ContextExampleTests.java" checks="LineLength" />
|
||||
<suppress files="modules[/\\]reindex[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]index[/\\]reindex[/\\]TransportUpdateByQueryAction.java" checks="LineLength" />
|
||||
<suppress files="plugins[/\\]analysis-icu[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]index[/\\]analysis[/\\]IcuCollationTokenFilterFactory.java" checks="LineLength" />
|
||||
|
|
|
@ -455,7 +455,8 @@ public class ExpressionScriptEngine extends AbstractComponent implements ScriptE
|
|||
// TODO: document and/or error if params contains _score?
|
||||
// NOTE: by checking for the variable in params first, it allows masking document fields with a global constant,
|
||||
// but if we were to reverse it, we could provide a way to supply dynamic defaults for documents missing the field?
|
||||
private static void bindFromParams(@Nullable final Map<String, Object> params, final SimpleBindings bindings, final String variable) throws ParseException {
|
||||
private static void bindFromParams(@Nullable final Map<String, Object> params,
|
||||
final SimpleBindings bindings, final String variable) throws ParseException {
|
||||
// NOTE: by checking for the variable in vars first, it allows masking document fields with a global constant,
|
||||
// but if we were to reverse it, we could provide a way to supply dynamic defaults for documents missing the field?
|
||||
Object value = params.get(variable);
|
||||
|
|
|
@ -120,7 +120,8 @@ public class MoreExpressionTests extends ESIntegTestCase {
|
|||
client().prepareIndex("test", "doc", "1").setSource("text", "hello goodbye"),
|
||||
client().prepareIndex("test", "doc", "2").setSource("text", "hello hello hello goodbye"),
|
||||
client().prepareIndex("test", "doc", "3").setSource("text", "hello hello goodebye"));
|
||||
ScoreFunctionBuilder<?> score = ScoreFunctionBuilders.scriptFunction(new Script(ScriptType.INLINE, "expression", "1 / _score", Collections.emptyMap()));
|
||||
ScoreFunctionBuilder<?> score = ScoreFunctionBuilders.scriptFunction(
|
||||
new Script(ScriptType.INLINE, "expression", "1 / _score", Collections.emptyMap()));
|
||||
SearchRequestBuilder req = client().prepareSearch().setIndices("test");
|
||||
req.setQuery(QueryBuilders.functionScoreQuery(QueryBuilders.termQuery("text", "hello"), score).boostMode(CombineFunction.REPLACE));
|
||||
req.setSearchType(SearchType.DFS_QUERY_THEN_FETCH); // make sure DF is consistent
|
||||
|
@ -190,7 +191,10 @@ public class MoreExpressionTests extends ESIntegTestCase {
|
|||
}
|
||||
|
||||
public void testMultiValueMethods() throws Exception {
|
||||
ElasticsearchAssertions.assertAcked(prepareCreate("test").addMapping("doc", "double0", "type=double", "double1", "type=double", "double2", "type=double"));
|
||||
ElasticsearchAssertions.assertAcked(prepareCreate("test").addMapping("doc",
|
||||
"double0", "type=double",
|
||||
"double1", "type=double",
|
||||
"double2", "type=double"));
|
||||
ensureGreen("test");
|
||||
|
||||
Map<String, Object> doc1 = new HashMap<>();
|
||||
|
|
|
@ -65,8 +65,8 @@ public class StoredExpressionTests extends ESIntegTestCase {
|
|||
}
|
||||
try {
|
||||
client().prepareSearch()
|
||||
.setSource(
|
||||
new SearchSourceBuilder().scriptField("test1", new Script(ScriptType.STORED, null, "script1", Collections.emptyMap())))
|
||||
.setSource(new SearchSourceBuilder().scriptField("test1",
|
||||
new Script(ScriptType.STORED, null, "script1", Collections.emptyMap())))
|
||||
.setIndices("test").setTypes("scriptTest").get();
|
||||
fail("search script should have been rejected");
|
||||
} catch(Exception e) {
|
||||
|
|
Loading…
Reference in New Issue