Skip to content

Commit 229c372

Browse files
author
Christoph Büscher
committed
Adapted new SpanWithinQueryBuilder/Parser and SpanContainingQueryBuilder/Parser merged in from master to query refactoring base clases.
1 parent 1a8ab9a commit 229c372

File tree

5 files changed

+21
-12
lines changed

5 files changed

+21
-12
lines changed

src/main/java/org/elasticsearch/index/query/QueryParseContext.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,13 +252,12 @@ public QueryBuilder parseInnerQueryBuilder() throws IOException {
252252
}
253253

254254
/**
255-
* @deprecated replaced by calls to parseInnerQueryBuilder() and checkCachable() for the resulting queries
255+
* @deprecated replaced by calls to parseInnerQueryBuilder() for the resulting queries
256256
*/
257257
@Nullable
258258
@Deprecated
259259
public Query parseInnerQuery() throws IOException, QueryParsingException {
260260
QueryBuilder builder = parseInnerQueryBuilder();
261-
262261
Query result = builder.toQuery(this);
263262
return result;
264263
}

src/main/java/org/elasticsearch/index/query/SpanContainingQueryBuilder.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@ public class SpanContainingQueryBuilder extends BaseQueryBuilder implements Span
3333
private float boost = -1;
3434
private String queryName;
3535

36-
/**
36+
/**
3737
* Sets the little clause, it must be contained within {@code big} for a match.
3838
*/
3939
public SpanContainingQueryBuilder little(SpanQueryBuilder clause) {
4040
this.little = clause;
4141
return this;
4242
}
4343

44-
/**
44+
/**
4545
* Sets the big clause, it must enclose {@code little} for a match.
4646
*/
4747
public SpanContainingQueryBuilder big(SpanQueryBuilder clause) {
@@ -89,4 +89,9 @@ protected void doXContent(XContentBuilder builder, Params params) throws IOExcep
8989

9090
builder.endObject();
9191
}
92+
93+
@Override
94+
protected String parserName() {
95+
return SpanContainingQueryParser.NAME;
96+
}
9297
}

src/main/java/org/elasticsearch/index/query/SpanContainingQueryParser.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
/**
3232
* Parser for {@link SpanContainingQuery}
3333
*/
34-
public class SpanContainingQueryParser implements QueryParser {
34+
public class SpanContainingQueryParser extends BaseQueryParserTemp {
3535

3636
public static final String NAME = "span_containing";
3737

@@ -81,8 +81,8 @@ public Query parse(QueryParseContext parseContext) throws IOException, QueryPars
8181
} else {
8282
throw new QueryParsingException(parseContext, "[span_containing] query does not support [" + currentFieldName + "]");
8383
}
84-
}
85-
84+
}
85+
8686
if (big == null) {
8787
throw new QueryParsingException(parseContext, "span_containing must include [big]");
8888
}

src/main/java/org/elasticsearch/index/query/SpanWithinQueryBuilder.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@ public class SpanWithinQueryBuilder extends BaseQueryBuilder implements SpanQuer
3333
private float boost = -1;
3434
private String queryName;
3535

36-
/**
36+
/**
3737
* Sets the little clause, it must be contained within {@code big} for a match.
3838
*/
3939
public SpanWithinQueryBuilder little(SpanQueryBuilder clause) {
4040
this.little = clause;
4141
return this;
4242
}
4343

44-
/**
44+
/**
4545
* Sets the big clause, it must enclose {@code little} for a match.
4646
*/
4747
public SpanWithinQueryBuilder big(SpanQueryBuilder clause) {
@@ -89,4 +89,9 @@ protected void doXContent(XContentBuilder builder, Params params) throws IOExcep
8989

9090
builder.endObject();
9191
}
92+
93+
@Override
94+
protected String parserName() {
95+
return SpanWithinQueryParser.NAME;
96+
}
9297
}

src/main/java/org/elasticsearch/index/query/SpanWithinQueryParser.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
/**
3232
* Parser for {@link SpanWithinQuery}
3333
*/
34-
public class SpanWithinQueryParser implements QueryParser {
34+
public class SpanWithinQueryParser extends BaseQueryParserTemp {
3535

3636
public static final String NAME = "span_within";
3737

@@ -81,8 +81,8 @@ public Query parse(QueryParseContext parseContext) throws IOException, QueryPars
8181
} else {
8282
throw new QueryParsingException(parseContext, "[span_within] query does not support [" + currentFieldName + "]");
8383
}
84-
}
85-
84+
}
85+
8686
if (big == null) {
8787
throw new QueryParsingException(parseContext, "span_within must include [big]");
8888
}

0 commit comments

Comments
 (0)