Skip to content

Commit

Permalink
java: QueryBuilders cleanup: remove deprecated
Browse files Browse the repository at this point in the history
Related to elastic#8667:

Some QueryBuilders have been deprecated in 1.x branches. We removed them in 2.0.

Removed
-------

* `textPhrase(...)`
* `textPhrasePrefix(...)`
* `textPhrasePrefixQuery(...)`
* `filtered(...)`
* `inQuery(...)`
* `commonTerms(...)`
* `queryString(...)`
* `simpleQueryString(...)`

Closes elastic#8721.
  • Loading branch information
dadoonet committed Dec 3, 2014
1 parent f37355a commit d2a2d1b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 168 deletions.
15 changes: 15 additions & 0 deletions docs/reference/migration/migrate_2_0.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,18 @@ with values in a single array.
]
}
---------------

=== Java API

Some query builders have been removed or renamed:

* `commonTerms(...)` renamed with `commonTermsQuery(...)`
* `queryString(...)` renamed with `queryStringQuery(...)`
* `simpleQueryString(...)` renamed with `simpleQueryStringQuery(...)`
* `textPhrase(...)` removed
* `textPhrasePrefix(...)` removed
* `textPhrasePrefixQuery(...)` removed
* `filtered(...)` removed. Use `filteredQuery(...)` instead.
* `inQuery(...)` removed.


168 changes: 0 additions & 168 deletions src/main/java/org/elasticsearch/index/query/QueryBuilders.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,6 @@ public static MatchQueryBuilder matchQuery(String name, Object text) {
return new MatchQueryBuilder(name, text).type(MatchQueryBuilder.Type.BOOLEAN);
}

/**
* @deprecated by commonTermsQuery(String, Object)
* Will be removed in elasticsearch 2.0.0
*/
@Deprecated
public static CommonTermsQueryBuilder commonTerms(String name, Object text) {
return commonTermsQuery(name, text);
}

/**
* Creates a common query for the provided field name and text.
*
Expand All @@ -79,29 +70,6 @@ public static MultiMatchQueryBuilder multiMatchQuery(Object text, String... fiel
return new MultiMatchQueryBuilder(text, fieldNames); // BOOLEAN is the default
}

/**
* Creates a text query with type "PHRASE" for the provided field name and text.
*
* @param name The field name.
* @param text The query text (to be analyzed).
* @deprecated use {@link #textPhraseQuery(String, Object)} instead
* Will be removed in elasticsearch 2.0.0
*/
public static MatchQueryBuilder textPhrase(String name, Object text) {
return textPhraseQuery(name, text);
}

/**
* Creates a text query with type "PHRASE" for the provided field name and text.
*
* @param name The field name.
* @param text The query text (to be analyzed).
* @deprecated Use {@link #matchPhraseQuery(String, Object)}
*/
public static MatchQueryBuilder textPhraseQuery(String name, Object text) {
return new MatchQueryBuilder(name, text).type(MatchQueryBuilder.Type.PHRASE);
}

/**
* Creates a text query with type "PHRASE" for the provided field name and text.
*
Expand All @@ -112,30 +80,6 @@ public static MatchQueryBuilder matchPhraseQuery(String name, Object text) {
return new MatchQueryBuilder(name, text).type(MatchQueryBuilder.Type.PHRASE);
}

/**
* Creates a text query with type "PHRASE_PREFIX" for the provided field name and text.
*
* @param name The field name.
* @param text The query text (to be analyzed).
* @deprecated use {@link #textPhrasePrefixQuery(String, Object)} instead
* Will be removed in elasticsearch 2.0.0
*/
public static MatchQueryBuilder textPhrasePrefix(String name, Object text) {
return textPhrasePrefixQuery(name, text);
}

/**
* Creates a text query with type "PHRASE_PREFIX" for the provided field name and text.
*
* @param name The field name.
* @param text The query text (to be analyzed).
* @deprecated Use {@link #matchPhrasePrefixQuery(String, Object)}
* Will be removed in elasticsearch 2.0.0
*/
public static MatchQueryBuilder textPhrasePrefixQuery(String name, Object text) {
return new MatchQueryBuilder(name, text).type(MatchQueryBuilder.Type.PHRASE_PREFIX);
}

/**
* Creates a match query with type "PHRASE_PREFIX" for the provided field name and text.
*
Expand Down Expand Up @@ -299,14 +243,6 @@ public static RegexpQueryBuilder regexpQuery(String name, String regexp) {
return new RegexpQueryBuilder(name, regexp);
}

/**
* @deprecated by queryStringQuery(String)
*/
@Deprecated
public static QueryStringQueryBuilder queryString(String queryString) {
return queryStringQuery(queryString);
}

/**
* A query that parses a query string and runs it. There are two modes that this operates. The first,
* when no field is added (using {@link QueryStringQueryBuilder#field(String)}, will run the query once and non prefixed fields
Expand All @@ -320,14 +256,6 @@ public static QueryStringQueryBuilder queryStringQuery(String queryString) {
return new QueryStringQueryBuilder(queryString);
}

/**
* @deprecated by simpleQueryStringQuery(String)
*/
@Deprecated
public static SimpleQueryStringBuilder simpleQueryString(String queryString) {
return simpleQueryStringQuery(queryString);
}

/**
* A query that acts similar to a query_string query, but won't throw
* exceptions for any weird string syntax. See
Expand Down Expand Up @@ -408,18 +336,6 @@ public static FieldMaskingSpanQueryBuilder fieldMaskingSpanQuery(SpanQueryBuilde
return new FieldMaskingSpanQueryBuilder(query, field);
}

/**
* A query that applies a filter to the results of another query.
*
* @param queryBuilder The query to apply the filter to
* @param filterBuilder The filter to apply on the query
* @deprecated Use filteredQuery instead (rename)
* Will be removed in elasticsearch 2.0.0
*/
public static FilteredQueryBuilder filtered(QueryBuilder queryBuilder, @Nullable FilterBuilder filterBuilder) {
return new FilteredQueryBuilder(queryBuilder, filterBuilder);
}

/**
* A query that applies a filter to the results of another query.
*
Expand Down Expand Up @@ -658,90 +574,6 @@ public static TermsQueryBuilder termsQuery(String name, Collection<?> values) {
return new TermsQueryBuilder(name, values);
}

/**
* A filer for a field based on several terms matching on any of them.
*
* @param name The field name
* @param values The terms
* @deprecated not used
* Will be removed in elasticsearch 2.0.0
*/
public static TermsQueryBuilder inQuery(String name, String... values) {
return new TermsQueryBuilder(name, values);
}

/**
* A filer for a field based on several terms matching on any of them.
*
* @param name The field name
* @param values The terms
* @deprecated not used
* Will be removed in elasticsearch 2.0.0
*/
public static TermsQueryBuilder inQuery(String name, int... values) {
return new TermsQueryBuilder(name, values);
}

/**
* A filer for a field based on several terms matching on any of them.
*
* @param name The field name
* @param values The terms
* @deprecated not used
* Will be removed in elasticsearch 2.0.0
*/
public static TermsQueryBuilder inQuery(String name, long... values) {
return new TermsQueryBuilder(name, values);
}

/**
* A filer for a field based on several terms matching on any of them.
*
* @param name The field name
* @param values The terms
* @deprecated not used
* Will be removed in elasticsearch 2.0.0
*/
public static TermsQueryBuilder inQuery(String name, float... values) {
return new TermsQueryBuilder(name, values);
}

/**
* A filer for a field based on several terms matching on any of them.
*
* @param name The field name
* @param values The terms
* @deprecated not used
* Will be removed in elasticsearch 2.0.0
*/
public static TermsQueryBuilder inQuery(String name, double... values) {
return new TermsQueryBuilder(name, values);
}

/**
* A filer for a field based on several terms matching on any of them.
*
* @param name The field name
* @param values The terms
* @deprecated not used
* Will be removed in elasticsearch 2.0.0
*/
public static TermsQueryBuilder inQuery(String name, Object... values) {
return new TermsQueryBuilder(name, values);
}

/**
* A filer for a field based on several terms matching on any of them.
*
* @param name The field name
* @param values The terms
* @deprecated not used
* Will be removed in elasticsearch 2.0.0
*/
public static TermsQueryBuilder inQuery(String name, Collection<?> values) {
return new TermsQueryBuilder(name, values);
}

/**
* A query that will execute the wrapped query only for the specified indices, and "match_all" when
* it does not match those indices.
Expand Down

0 comments on commit d2a2d1b

Please sign in to comment.