Skip to content

Commit

Permalink
MLT Field Query: deprecate it
Browse files Browse the repository at this point in the history
The MLT field query is simply replaced by a MLT query set to specific field.
To simplify code maintenance we should deprecate it in 1.4 and remove it in
2.0.

Closes elastic#8253
  • Loading branch information
alexksikes committed Oct 29, 2014
1 parent cf5cecc commit 483ae89
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 4 deletions.
8 changes: 7 additions & 1 deletion docs/reference/migration/migrate_1_4.asciidoc
Expand Up @@ -76,4 +76,10 @@ node it will reject some or all operations.
On versions before `1.4.0.Beta1` all operations are rejected when a node loses its elected master. From `1.4.0.Beta1`
only write operations will be rejected by default. Read operations will still be served based on the information available
to the node, which may result in being partial and possibly also stale. If the default is undesired then the
pre `1.4.0.Beta1` behaviour can be enabled, see: <<modules-discovery-zen,no-master-block>>
pre `1.4.0.Beta1` behaviour can be enabled, see: <<modules-discovery-zen,no-master-block>>

[float]
==== More Like This Field

The More Like This Field query has been deprecated in favor of the <<query-dsl-mlt-query, More Like This Query>>
restrained set to a specific `field`. It will be removed in 2.0.
2 changes: 2 additions & 0 deletions docs/reference/query-dsl/queries/mlt-field-query.asciidoc
@@ -1,6 +1,8 @@
[[query-dsl-mlt-field-query]]
=== More Like This Field Query

deprecated[1.4.0,Replaced by <<query-dsl-mlt-query>> set to a specific `field`]

The `more_like_this_field` query is the same as the `more_like_this`
query, except it runs against a single field. It provides nicer query
DSL over the generic `more_like_this` query, and support typed fields
Expand Down
Expand Up @@ -46,7 +46,7 @@
import org.elasticsearch.index.mapper.*;
import org.elasticsearch.index.mapper.internal.SourceFieldMapper;
import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.MoreLikeThisFieldQueryBuilder;
import org.elasticsearch.index.query.MoreLikeThisQueryBuilder;
import org.elasticsearch.indices.IndicesService;
import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.elasticsearch.threadpool.ThreadPool;
Expand Down Expand Up @@ -321,14 +321,14 @@ private void addMoreLikeThis(MoreLikeThisRequest request, BoolQueryBuilder boolB
}

private void addMoreLikeThis(MoreLikeThisRequest request, BoolQueryBuilder boolBuilder, String fieldName, String likeText, boolean failOnUnsupportedField) {
MoreLikeThisFieldQueryBuilder mlt = moreLikeThisFieldQuery(fieldName)
MoreLikeThisQueryBuilder mlt = moreLikeThisQuery(fieldName)
.likeText(likeText)
.percentTermsToMatch(request.percentTermsToMatch())
.boostTerms(request.boostTerms())
.minDocFreq(request.minDocFreq())
.maxDocFreq(request.maxDocFreq())
.minWordLength(request.minWordLength())
.maxWordLen(request.maxWordLength())
.maxWordLength(request.maxWordLength())
.minTermFreq(request.minTermFreq())
.maxQueryTerms(request.maxQueryTerms())
.stopWords(request.stopWords())
Expand Down
Expand Up @@ -27,6 +27,7 @@
/**
* A more like this query that runs against a specific field.
*/
@Deprecated
public class MoreLikeThisFieldQueryBuilder extends BaseQueryBuilder implements BoostableQueryBuilder<MoreLikeThisFieldQueryBuilder> {

private final String name;
Expand Down
Expand Up @@ -38,6 +38,7 @@
/**
*
*/
@Deprecated
public class MoreLikeThisFieldQueryParser implements QueryParser {

public static final String NAME = "mlt_field";
Expand Down

0 comments on commit 483ae89

Please sign in to comment.