@Override protected Query doToQuery(QueryShardContext context) throws IOException { Query innerSpanQuery = matchBuilder.toQuery(context); assert innerSpanQuery instanceof SpanQuery; return new SpanFirstQuery((SpanQuery) innerSpanQuery, end); }
public String toString() { return "spans(" + SpanFirstQuery.this.toString() + ")"; }
SpanFirstQuery query = new SpanFirstQuery(match, end); query.setBoost(boost); if (queryName != null) { parseContext.addNamedQuery(queryName, query);
private static BiFunction<Query, Version, Result> spanFirstQuery() { return (query, version) -> { Result result = analyze(((SpanFirstQuery) query).getMatch(), version); return new Result(false, result.extractions, result.minimumShouldMatch); }; }
public Query rewrite(IndexReader reader) throws IOException { SpanFirstQuery clone = null; SpanQuery rewritten = (SpanQuery) match.rewrite(reader); if (rewritten != match) { clone = (SpanFirstQuery) this.clone(); clone.match = rewritten; } if (clone != null) { return clone; // some clauses rewrote } else { return this; // no clauses rewrote } }
public PayloadSpans getPayloadSpans(IndexReader reader) throws IOException { return (PayloadSpans) getSpans(reader); }
private static BiFunction<Query, Version, Result> spanFirstQuery() { return (query, version) -> { Result result = analyze(((SpanFirstQuery) query).getMatch(), version); return new Result(false, result.extractions, result.minimumShouldMatch); }; }
public Query rewrite(IndexReader reader) throws IOException { SpanFirstQuery clone = null; SpanQuery rewritten = (SpanQuery) match.rewrite(reader); if (rewritten != match) { clone = (SpanFirstQuery) this.clone(); clone.match = rewritten; } if (clone != null) { return clone; // some clauses rewrote } else { return this; // no clauses rewrote } }
public PayloadSpans getPayloadSpans(IndexReader reader) throws IOException { return (PayloadSpans) getSpans(reader); }
@Override protected Query doToQuery(QueryShardContext context) throws IOException { Query innerSpanQuery = matchBuilder.toQuery(context); assert innerSpanQuery instanceof SpanQuery; return new SpanFirstQuery((SpanQuery) innerSpanQuery, end); }
protected void collectSpanQueryFields(SpanQuery spanQuery, Set<String> fieldNames) { if (spanQuery instanceof FieldMaskingSpanQuery) { collectSpanQueryFields(((FieldMaskingSpanQuery)spanQuery).getMaskedQuery(), fieldNames); } else if (spanQuery instanceof SpanFirstQuery) { collectSpanQueryFields(((SpanFirstQuery)spanQuery).getMatch(), fieldNames); } else if (spanQuery instanceof SpanNearQuery) { for (final SpanQuery clause : ((SpanNearQuery)spanQuery).getClauses()) { collectSpanQueryFields(clause, fieldNames); } } else if (spanQuery instanceof SpanNotQuery) { collectSpanQueryFields(((SpanNotQuery)spanQuery).getInclude(), fieldNames); } else if (spanQuery instanceof SpanOrQuery) { for (final SpanQuery clause : ((SpanOrQuery)spanQuery).getClauses()) { collectSpanQueryFields(clause, fieldNames); } } else { fieldNames.add(spanQuery.getField()); } }
public String toString() { return "spans(" + SpanFirstQuery.this.toString() + ")"; }
@Override protected Query doToQuery(QueryShardContext context) throws IOException { Query innerSpanQuery = matchBuilder.toQuery(context); assert innerSpanQuery instanceof SpanQuery; return new SpanFirstQuery((SpanQuery) innerSpanQuery, end); }
public int hashCode() { int h = match.hashCode(); h ^= (h << 8) | (h >>> 25); // reversible h ^= Float.floatToRawIntBits(getBoost()) ^ end; return h; }
return mustRewriteQuery(((FieldMaskingSpanQuery)spanQuery).getMaskedQuery()); } else if (spanQuery instanceof SpanFirstQuery) { return mustRewriteQuery(((SpanFirstQuery)spanQuery).getMatch()); } else if (spanQuery instanceof SpanNearQuery) { for (final SpanQuery clause : ((SpanNearQuery)spanQuery).getClauses()) {
public String toString() { return "spans(" + SpanFirstQuery.this.toString() + ")"; }
@Override protected Query doToQuery(QueryShardContext context) throws IOException { Query innerSpanQuery = matchBuilder.toQuery(context); assert innerSpanQuery instanceof SpanQuery; return new SpanFirstQuery((SpanQuery) innerSpanQuery, end); }
public int hashCode() { int h = match.hashCode(); h ^= (h << 8) | (h >>> 25); // reversible h ^= Float.floatToRawIntBits(getBoost()) ^ end; return h; }