rename RestActions.parseQuerySource() to RestActions.urlParamsToQueryBuilder()
This commit is contained in:
parent
81491843f1
commit
d59e959c80
|
@ -67,7 +67,7 @@ public class RestValidateQueryAction extends BaseRestHandler {
|
||||||
if (RestActions.hasBodyContent(request)) {
|
if (RestActions.hasBodyContent(request)) {
|
||||||
validateQueryRequest.source(RestActions.getRestContent(request));
|
validateQueryRequest.source(RestActions.getRestContent(request));
|
||||||
} else {
|
} else {
|
||||||
QueryBuilder<?> queryBuilder = RestActions.parseQuerySource(request);
|
QueryBuilder<?> queryBuilder = RestActions.urlParamsToQueryBuilder(request);
|
||||||
if (queryBuilder != null) {
|
if (queryBuilder != null) {
|
||||||
QuerySourceBuilder querySourceBuilder = new QuerySourceBuilder();
|
QuerySourceBuilder querySourceBuilder = new QuerySourceBuilder();
|
||||||
querySourceBuilder.setQuery(queryBuilder);
|
querySourceBuilder.setQuery(queryBuilder);
|
||||||
|
|
|
@ -81,7 +81,7 @@ public class RestCountAction extends AbstractCatAction {
|
||||||
throw new ElasticsearchException("failed to parse source", e);
|
throw new ElasticsearchException("failed to parse source", e);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
QueryBuilder<?> queryBuilder = RestActions.parseQuerySource(request);
|
QueryBuilder<?> queryBuilder = RestActions.urlParamsToQueryBuilder(request);
|
||||||
if (queryBuilder != null) {
|
if (queryBuilder != null) {
|
||||||
QuerySourceBuilder querySourceBuilder = new QuerySourceBuilder();
|
QuerySourceBuilder querySourceBuilder = new QuerySourceBuilder();
|
||||||
querySourceBuilder.setQuery(queryBuilder);
|
querySourceBuilder.setQuery(queryBuilder);
|
||||||
|
|
|
@ -85,7 +85,7 @@ public class RestCountAction extends BaseRestHandler {
|
||||||
throw new ElasticsearchException("failed to parse source", e);
|
throw new ElasticsearchException("failed to parse source", e);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
QueryBuilder<?> queryBuilder = RestActions.parseQuerySource(request);
|
QueryBuilder<?> queryBuilder = RestActions.urlParamsToQueryBuilder(request);
|
||||||
if (queryBuilder != null) {
|
if (queryBuilder != null) {
|
||||||
countRequest.query(queryBuilder);
|
countRequest.query(queryBuilder);
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,7 +58,7 @@ public class RestExistsAction extends BaseRestHandler {
|
||||||
if (RestActions.hasBodyContent(request)) {
|
if (RestActions.hasBodyContent(request)) {
|
||||||
existsRequest.source(RestActions.getRestContent(request));
|
existsRequest.source(RestActions.getRestContent(request));
|
||||||
} else {
|
} else {
|
||||||
QueryBuilder<?> queryBuilder = RestActions.parseQuerySource(request);
|
QueryBuilder<?> queryBuilder = RestActions.urlParamsToQueryBuilder(request);
|
||||||
if (queryBuilder != null) {
|
if (queryBuilder != null) {
|
||||||
QuerySourceBuilder querySourceBuilder = new QuerySourceBuilder();
|
QuerySourceBuilder querySourceBuilder = new QuerySourceBuilder();
|
||||||
querySourceBuilder.setQuery(queryBuilder);
|
querySourceBuilder.setQuery(queryBuilder);
|
||||||
|
|
|
@ -158,7 +158,7 @@ public class RestSearchAction extends BaseRestHandler {
|
||||||
public static boolean parseSearchSource(final SearchSourceBuilder searchSourceBuilder, RestRequest request) {
|
public static boolean parseSearchSource(final SearchSourceBuilder searchSourceBuilder, RestRequest request) {
|
||||||
|
|
||||||
boolean modified = false;
|
boolean modified = false;
|
||||||
QueryBuilder<?> queryBuilder = RestActions.parseQuerySource(request);
|
QueryBuilder<?> queryBuilder = RestActions.urlParamsToQueryBuilder(request);
|
||||||
if (queryBuilder != null) {
|
if (queryBuilder != null) {
|
||||||
searchSourceBuilder.query(queryBuilder);
|
searchSourceBuilder.query(queryBuilder);
|
||||||
modified = true;
|
modified = true;
|
||||||
|
|
|
@ -93,7 +93,7 @@ public class RestActions {
|
||||||
builder.endObject();
|
builder.endObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static QueryBuilder<?> parseQuerySource(RestRequest request) {
|
public static QueryBuilder<?> urlParamsToQueryBuilder(RestRequest request) {
|
||||||
String queryString = request.param("q");
|
String queryString = request.param("q");
|
||||||
if (queryString == null) {
|
if (queryString == null) {
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -82,7 +82,7 @@ public class RestDeleteByQueryAction extends BaseRestHandler {
|
||||||
final QueryBuilder<?> builder = context.parseInnerQueryBuilder();
|
final QueryBuilder<?> builder = context.parseInnerQueryBuilder();
|
||||||
delete.query(builder);
|
delete.query(builder);
|
||||||
} else {
|
} else {
|
||||||
QueryBuilder<?> queryBuilder = RestActions.parseQuerySource(request);
|
QueryBuilder<?> queryBuilder = RestActions.urlParamsToQueryBuilder(request);
|
||||||
if (queryBuilder != null) {
|
if (queryBuilder != null) {
|
||||||
delete.query(queryBuilder);
|
delete.query(queryBuilder);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue