public FilterScript(Map<String, Object> params, SearchLookup lookup, LeafReaderContext leafContext) { this.params = params; this.leafLookup = lookup.getLeafSearchLookup(leafContext); }
public SearchScript(Map<String, Object> params, SearchLookup lookup, LeafReaderContext leafContext) { this.params = params; // TODO: remove leniency when painless does not implement SearchScript for executable script cases this.leafLookup = leafContext == null ? null : lookup.getLeafSearchLookup(leafContext); }
public TermsSetQueryScript(Map<String, Object> params, SearchLookup lookup, LeafReaderContext leafContext) { this.params = new ParameterMap(params, DEPRECATIONS); this.leafLookup = lookup.getLeafSearchLookup(leafContext); }
public MapScript(Map<String, Object> params, Object state, SearchLookup lookup, LeafReaderContext leafContext) { this.state = state; this.leafLookup = leafContext == null ? null : lookup.getLeafSearchLookup(leafContext); if (leafLookup != null) { params = new HashMap<>(params); // copy params so we aren't modifying input params.putAll(leafLookup.asMap()); // add lookup vars params = new ParameterMap(params, DEPRECATIONS); // wrap with deprecations } this.params = params; }
public ScoreScript(Map<String, Object> params, SearchLookup lookup, LeafReaderContext leafContext) { // null check needed b/c of expression engine subclass if (lookup == null) { assert params == null; assert leafContext == null; this.params = null; this.leafLookup = null; } else { this.leafLookup = lookup.getLeafSearchLookup(leafContext); params = new HashMap<>(params); params.putAll(leafLookup.asMap()); this.params = new ParameterMap(params, DEPRECATIONS); } }
public FilterScript(Map<String, Object> params, SearchLookup lookup, LeafReaderContext leafContext) { this.params = params; this.leafLookup = lookup.getLeafSearchLookup(leafContext); }
public SearchScript(Map<String, Object> params, SearchLookup lookup, LeafReaderContext leafContext) { this.params = params; // TODO: remove leniency when painless does not implement SearchScript for executable script cases this.leafLookup = leafContext == null ? null : lookup.getLeafSearchLookup(leafContext); }
public ScoreScript(Map<String, Object> params, SearchLookup lookup, LeafReaderContext leafContext) { this.params = params; this.leafLookup = lookup.getLeafSearchLookup(leafContext); }
public SearchScript(Map<String, Object> params, SearchLookup lookup, LeafReaderContext leafContext) { this.params = params; this.lookup = lookup; this.leafContext = leafContext; // TODO: remove leniency when painless does not implement SearchScript for executable script cases this.leafLookup = leafContext == null ? null : lookup.getLeafSearchLookup(leafContext); }
public MapScript(Map<String, Object> params, Object state, SearchLookup lookup, LeafReaderContext leafContext) { super(params, state); this.leafLookup = leafContext == null ? null : lookup.getLeafSearchLookup(leafContext); }
public FilterScript(Map<String, Object> params, SearchLookup lookup, LeafReaderContext leafContext) { this.params = params; this.leafLookup = lookup.getLeafSearchLookup(leafContext); }
@Override public LeafSearchScript getLeafSearchScript(LeafReaderContext context) throws IOException { script.setLookup(lookup.getLeafSearchLookup(context)); return script; } @Override
public TermsSetQueryScript(Map<String, Object> params, SearchLookup lookup, LeafReaderContext leafContext) { this.params = new ParameterMap(params, DEPRECATIONS); this.leafLookup = lookup.getLeafSearchLookup(leafContext); }
@Override public LeafSearchScript getLeafSearchScript(LeafReaderContext context) throws IOException { script.setLookup(lookup.getLeafSearchLookup(context)); return script; } @Override
public TermsSetQueryScript(Map<String, Object> params, SearchLookup lookup, LeafReaderContext leafContext) { this.params = new ParameterMap(params, DEPRECATIONS); this.leafLookup = lookup.getLeafSearchLookup(leafContext); }
public FilterScript newInstance(LeafReaderContext context) throws IOException { LeafSearchLookup leafLookup = lookup.getLeafSearchLookup(context); Map<String, Object> ctx = new HashMap<>(leafLookup.asMap()); if (vars != null) { ctx.putAll(vars); } return new FilterScript(ctx, lookup, context) { @Override public boolean execute() { return (boolean) script.apply(ctx); } @Override public void setDocument(int doc) { leafLookup.setDocument(doc); } }; } }
public MapScript(Map<String, Object> params, Object state, SearchLookup lookup, LeafReaderContext leafContext) { this.state = state; this.leafLookup = leafContext == null ? null : lookup.getLeafSearchLookup(leafContext); if (leafLookup != null) { params = new HashMap<>(params); // copy params so we aren't modifying input params.putAll(leafLookup.asMap()); // add lookup vars params = new ParameterMap(params, DEPRECATIONS); // wrap with deprecations } this.params = params; }
public ScoreScript(Map<String, Object> params, SearchLookup lookup, LeafReaderContext leafContext) { // null check needed b/c of expression engine subclass if (lookup == null) { assert params == null; assert leafContext == null; this.params = null; this.leafLookup = null; } else { this.leafLookup = lookup.getLeafSearchLookup(leafContext); params = new HashMap<>(params); params.putAll(leafLookup.asMap()); this.params = new ParameterMap(params, DEPRECATIONS); } }
@Override public LeafSearchScript getLeafSearchScript(LeafReaderContext context) throws IOException { final LeafSearchLookup leafLookup = lookup.getLeafSearchLookup(context); Map<String, Object> allVars = new HashMap<>(); allVars.putAll(leafLookup.asMap()); if (vars != null) { allVars.putAll(vars); } Script scriptObject; try { scriptObject = createScript(compiledScript.compiled(), allVars); } catch (InstantiationException | IllegalAccessException e) { throw new ScriptException("failed to build search " + compiledScript, e); } return new GroovyScript(compiledScript, scriptObject, leafLookup, logger); }
public void initialize(Engine.Searcher docSearcher, ParsedDocument parsedDocument) { this.docSearcher = docSearcher; IndexReader indexReader = docSearcher.reader(); LeafReaderContext atomicReaderContext = indexReader.leaves().get(0); LeafSearchLookup leafLookup = lookup().getLeafSearchLookup(atomicReaderContext); leafLookup.setDocument(0); leafLookup.source().setSource(parsedDocument.source()); Map<String, SearchHitField> fields = new HashMap<>(); for (IndexableField field : parsedDocument.rootDoc().getFields()) { fields.put(field.name(), new InternalSearchHitField(field.name(), Collections.emptyList())); } hitContext().reset( new InternalSearchHit(0, "unknown", new Text(parsedDocument.type()), fields), atomicReaderContext, 0, docSearcher.searcher() ); }