org.elasticsearch.script.Script.getLang()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(8.6k)|赞(0)|评价(0)|浏览(207)

本文整理了Java中org.elasticsearch.script.Script.getLang()方法的一些代码示例,展示了Script.getLang()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Script.getLang()方法的具体详情如下:
包路径:org.elasticsearch.script.Script
类名称:Script
方法名:getLang

Script.getLang介绍

[英]Method for getting language.
[中]获取语言的方法。

代码示例

代码示例来源:origin: org.elasticsearch/elasticsearch

/**
 * @deprecated Use {@link #script()} instead
 */
@Deprecated
public String scriptLang() {
  return script == null ? null : script.getLang();
}

代码示例来源:origin: org.elasticsearch/elasticsearch

private static Script deepCopyScript(Script script, SearchContext context) {
  if (script != null) {
    Map<String, Object> params = script.getParams();
    if (params != null) {
      params = deepCopyParams(params, context);
    }
    return new Script(script.getType(), script.getLang(), script.getIdOrCode(), params);
  } else {
    return null;
  }
}

代码示例来源:origin: org.elasticsearch/elasticsearch

String lang = script.getLang();
String idOrCode = script.getIdOrCode();
Map<String, String> options = script.getOptions();

代码示例来源:origin: org.elasticsearch/elasticsearch

private void updateOrCreateScript(String scriptContent, ScriptType type, String lang, Map<String, Object> params) {
  Script script = script();
  if (script == null) {
    script = new Script(type == null ? ScriptType.INLINE : type, lang, scriptContent == null ? "" : scriptContent, params);
  } else {
    String newScriptContent = scriptContent == null ? script.getIdOrCode() : scriptContent;
    ScriptType newScriptType = type == null ? script.getType() : type;
    String newScriptLang = lang == null ? script.getLang() : lang;
    Map<String, Object> newScriptParams = params == null ? script.getParams() : params;
    script = new Script(newScriptType, newScriptLang, newScriptContent, newScriptParams);
  }
  script(script);
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

/**
 * @deprecated Use {@link #script()} instead
 */
@Deprecated
public String scriptLang() {
  return script == null ? null : script.getLang();
}

代码示例来源:origin: harbby/presto-connectors

/**
 * @deprecated Use {@link #script()} instead
 */
@Deprecated
public String scriptLang() {
  return script == null ? null : script.getLang();
}

代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch

/**
 * @deprecated Use {@link #script()} instead
 */
@Deprecated
public String scriptLang() {
  return script == null ? null : script.getLang();
}

代码示例来源:origin: apache/servicemix-bundles

/**
 * @deprecated Use {@link #script()} instead
 */
@Deprecated
public String scriptLang() {
  return script == null ? null : script.getLang();
}

代码示例来源:origin: harbby/presto-connectors

private static Script insertParams(Script script, Map<String, Object> params) {
  if (script == null) {
    return null;
  }
  return new Script(script.getScript(), script.getType(), script.getLang(), params);
}

代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch

final boolean keepBucket;
if ("expression".equals(script.getLang())) {
  double scriptDoubleValue = (double) scriptReturnValue;
  keepBucket = scriptDoubleValue == 1.0;

代码示例来源:origin: harbby/presto-connectors

final boolean keepBucket;
if ("expression".equals(script.getLang())) {
  double scriptDoubleValue = (double) scriptReturnValue;
  keepBucket = scriptDoubleValue == 1.0;

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

private static Script deepCopyScript(Script script, SearchContext context) {
  if (script != null) {
    Map<String, Object> params = script.getParams();
    if (params != null) {
      params = deepCopyParams(params, context);
    }
    return new Script(script.getType(), script.getLang(), script.getIdOrCode(), params);
  } else {
    return null;
  }
}

代码示例来源:origin: harbby/presto-connectors

private static Script deepCopyScript(Script script, SearchContext context) {
  if (script != null) {
    Map<String, Object> params = script.getParams();
    if (params != null) {
      params = deepCopyParams(params, context);
    }
    return new Script(script.getScript(), script.getType(), script.getLang(), params);
  } else {
    return null;
  }
}

代码示例来源:origin: apache/servicemix-bundles

private static Script deepCopyScript(Script script, SearchContext context) {
  if (script != null) {
    Map<String, Object> params = script.getParams();
    if (params != null) {
      params = deepCopyParams(params, context);
    }
    return new Script(script.getType(), script.getLang(), script.getIdOrCode(), params);
  } else {
    return null;
  }
}

代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch

private static Script deepCopyScript(Script script, SearchContext context) {
  if (script != null) {
    Map<String, Object> params = script.getParams();
    if (params != null) {
      params = deepCopyParams(params, context);
    }
    return new Script(script.getType(), script.getLang(), script.getIdOrCode(), params);
  } else {
    return null;
  }
}

代码示例来源:origin: harbby/presto-connectors

/**
 * Checks if a script can be executed and compiles it if needed, or returns the previously compiled and cached script.
 */
public CompiledScript compile(Script script, ScriptContext scriptContext, HasContextAndHeaders headersContext, Map<String, String> params) {
  if (script == null) {
    throw new IllegalArgumentException("The parameter script (Script) must not be null.");
  }
  if (scriptContext == null) {
    throw new IllegalArgumentException("The parameter scriptContext (ScriptContext) must not be null.");
  }
  String lang = script.getLang();
  if (lang == null) {
    lang = defaultLang;
  }
  ScriptEngineService scriptEngineService = getScriptEngineServiceForLang(lang);
  if (canExecuteScript(lang, scriptEngineService, script.getType(), scriptContext) == false) {
    throw new ScriptException("scripts of type [" + script.getType() + "], operation [" + scriptContext.getKey() + "] and lang [" + lang + "] are disabled");
  }
  // TODO: fix this through some API or something, thats wrong
  // special exception to prevent expressions from compiling as update or mapping scripts
  boolean expression = "expression".equals(script.getLang());
  boolean notSupported = scriptContext.getKey().equals(ScriptContext.Standard.UPDATE.getKey()) ||
              scriptContext.getKey().equals(ScriptContext.Standard.MAPPING.getKey());
  if (expression && notSupported) {
    throw new ScriptException("scripts of type [" + script.getType() + "]," +
        " operation [" + scriptContext.getKey() + "] and lang [" + lang + "] are not supported");
  }
  return compileInternal(script, headersContext, params);
}

代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch

private void updateOrCreateScript(String scriptContent, ScriptType type, String lang, Map<String, Object> params) {
  Script script = script();
  if (script == null) {
    script = new Script(type == null ? ScriptType.INLINE : type, lang, scriptContent == null ? "" : scriptContent, params);
  } else {
    String newScriptContent = scriptContent == null ? script.getIdOrCode() : scriptContent;
    ScriptType newScriptType = type == null ? script.getType() : type;
    String newScriptLang = lang == null ? script.getLang() : lang;
    Map<String, Object> newScriptParams = params == null ? script.getParams() : params;
    script = new Script(newScriptType, newScriptLang, newScriptContent, newScriptParams);
  }
  script(script);
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

private void updateOrCreateScript(String scriptContent, ScriptType type, String lang, Map<String, Object> params) {
  Script script = script();
  if (script == null) {
    script = new Script(type == null ? ScriptType.INLINE : type, lang, scriptContent == null ? "" : scriptContent, params);
  } else {
    String newScriptContent = scriptContent == null ? script.getIdOrCode() : scriptContent;
    ScriptType newScriptType = type == null ? script.getType() : type;
    String newScriptLang = lang == null ? script.getLang() : lang;
    Map<String, Object> newScriptParams = params == null ? script.getParams() : params;
    script = new Script(newScriptType, newScriptLang, newScriptContent, newScriptParams);
  }
  script(script);
}

代码示例来源:origin: apache/servicemix-bundles

private void updateOrCreateScript(String scriptContent, ScriptType type, String lang, Map<String, Object> params) {
  Script script = script();
  if (script == null) {
    script = new Script(type == null ? ScriptType.INLINE : type, lang, scriptContent == null ? "" : scriptContent, params);
  } else {
    String newScriptContent = scriptContent == null ? script.getIdOrCode() : scriptContent;
    ScriptType newScriptType = type == null ? script.getType() : type;
    String newScriptLang = lang == null ? script.getLang() : lang;
    Map<String, Object> newScriptParams = params == null ? script.getParams() : params;
    script = new Script(newScriptType, newScriptLang, newScriptContent, newScriptParams);
  }
  script(script);
}

代码示例来源:origin: harbby/presto-connectors

private void updateOrCreateScript(String scriptContent, ScriptType type, String lang, Map<String, Object> params) {
  Script script = script();
  if (script == null) {
    script = new Script(scriptContent == null ? "" : scriptContent, type == null ? ScriptType.INLINE : type, lang, params);
  } else {
    String newScriptContent = scriptContent == null ? script.getScript() : scriptContent;
    ScriptType newScriptType = type == null ? script.getType() : type;
    String newScriptLang = lang == null ? script.getLang() : lang;
    Map<String, Object> newScriptParams = params == null ? script.getParams() : params;
    script = new Script(newScriptContent, newScriptType, newScriptLang, newScriptParams);
  }
  script(script);
}

相关文章