mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-18 19:05:06 +00:00
Fix issues after merging in master
This commit is contained in:
parent
ac3db8c30f
commit
4de4c795b7
@ -150,7 +150,6 @@ import static org.elasticsearch.rest.RestRequest.Method.POST;
|
|||||||
|
|
||||||
* */
|
* */
|
||||||
public class RestRankEvalAction extends BaseRestHandler {
|
public class RestRankEvalAction extends BaseRestHandler {
|
||||||
//private ScriptService scriptService;
|
|
||||||
|
|
||||||
public RestRankEvalAction(Settings settings, RestController controller) {
|
public RestRankEvalAction(Settings settings, RestController controller) {
|
||||||
super(settings);
|
super(settings);
|
||||||
@ -189,4 +188,9 @@ public class RestRankEvalAction extends BaseRestHandler {
|
|||||||
|
|
||||||
rankEvalRequest.setRankEvalSpec(spec);
|
rankEvalRequest.setRankEvalSpec(spec);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "rank_eval_action";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,12 +33,11 @@ import org.elasticsearch.common.xcontent.NamedXContentRegistry;
|
|||||||
import org.elasticsearch.common.xcontent.XContentParser;
|
import org.elasticsearch.common.xcontent.XContentParser;
|
||||||
import org.elasticsearch.common.xcontent.XContentType;
|
import org.elasticsearch.common.xcontent.XContentType;
|
||||||
import org.elasticsearch.index.query.QueryParseContext;
|
import org.elasticsearch.index.query.QueryParseContext;
|
||||||
import org.elasticsearch.script.ExecutableScript;
|
|
||||||
import org.elasticsearch.script.Script;
|
import org.elasticsearch.script.Script;
|
||||||
import org.elasticsearch.script.ScriptService;
|
import org.elasticsearch.script.ScriptService;
|
||||||
|
import org.elasticsearch.script.TemplateScript;
|
||||||
import org.elasticsearch.search.SearchHit;
|
import org.elasticsearch.search.SearchHit;
|
||||||
import org.elasticsearch.search.builder.SearchSourceBuilder;
|
import org.elasticsearch.search.builder.SearchSourceBuilder;
|
||||||
import org.elasticsearch.template.CompiledTemplate;
|
|
||||||
import org.elasticsearch.threadpool.ThreadPool;
|
import org.elasticsearch.threadpool.ThreadPool;
|
||||||
import org.elasticsearch.transport.TransportService;
|
import org.elasticsearch.transport.TransportService;
|
||||||
|
|
||||||
@ -97,10 +96,10 @@ public class TransportRankEvalAction
|
|||||||
ratedRequests.size());
|
ratedRequests.size());
|
||||||
Map<String, Exception> errors = new ConcurrentHashMap<>(ratedRequests.size());
|
Map<String, Exception> errors = new ConcurrentHashMap<>(ratedRequests.size());
|
||||||
|
|
||||||
Map<String, CompiledTemplate> scriptsWithoutParams = new HashMap<>();
|
Map<String, TemplateScript.Factory> scriptsWithoutParams = new HashMap<>();
|
||||||
for (Entry<String, Script> entry : qualityTask.getTemplates().entrySet()) {
|
for (Entry<String, Script> entry : qualityTask.getTemplates().entrySet()) {
|
||||||
scriptsWithoutParams.put(entry.getKey(),
|
scriptsWithoutParams.put(entry.getKey(),
|
||||||
scriptService.compileTemplate(entry.getValue(), ExecutableScript.CONTEXT));
|
scriptService.compile(entry.getValue(), TemplateScript.CONTEXT));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (RatedRequest ratedRequest : ratedRequests) {
|
for (RatedRequest ratedRequest : ratedRequests) {
|
||||||
@ -110,8 +109,8 @@ public class TransportRankEvalAction
|
|||||||
if (ratedSearchSource == null) {
|
if (ratedSearchSource == null) {
|
||||||
Map<String, Object> params = ratedRequest.getParams();
|
Map<String, Object> params = ratedRequest.getParams();
|
||||||
String templateId = ratedRequest.getTemplateId();
|
String templateId = ratedRequest.getTemplateId();
|
||||||
CompiledTemplate compiled = scriptsWithoutParams.get(templateId);
|
TemplateScript.Factory templateScript = scriptsWithoutParams.get(templateId);
|
||||||
String resolvedRequest = compiled.run(params);
|
String resolvedRequest = templateScript.newInstance(params).execute();
|
||||||
try (XContentParser subParser = createParser(namedXContentRegistry, new BytesArray(resolvedRequest),
|
try (XContentParser subParser = createParser(namedXContentRegistry, new BytesArray(resolvedRequest),
|
||||||
XContentType.JSON)) {
|
XContentType.JSON)) {
|
||||||
QueryParseContext parseContext = new QueryParseContext(subParser);
|
QueryParseContext parseContext = new QueryParseContext(subParser);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user