public class MoreLikeThisQueryBuilder extends BaseQueryBuilder implements BoostableQueryBuilder<MoreLikeThisQueryBuilder>
likeText(String)
which is checked against the fields the query is constructed with.Modifier and Type | Class and Description |
---|---|
static class |
MoreLikeThisQueryBuilder.Item
A single get item.
|
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params
EMPTY_PARAMS
Constructor and Description |
---|
MoreLikeThisQueryBuilder()
Constructs a new more like this query which uses the "_all" field.
|
MoreLikeThisQueryBuilder(String... fields)
Sets the field names that will be used when generating the 'More Like This' query.
|
Modifier and Type | Method and Description |
---|---|
MoreLikeThisQueryBuilder |
addItem(MoreLikeThisQueryBuilder.Item item) |
MoreLikeThisQueryBuilder |
analyzer(String analyzer)
The analyzer that will be used to analyze the text.
|
MoreLikeThisQueryBuilder |
boost(float boost)
Sets the boost for this query.
|
MoreLikeThisQueryBuilder |
boostTerms(float boostTerms)
Sets the boost factor to use when boosting terms.
|
MoreLikeThisQueryBuilder |
docs(MoreLikeThisQueryBuilder.Item... docs) |
protected void |
doXContent(XContentBuilder builder,
ToXContent.Params params) |
MoreLikeThisQueryBuilder |
failOnUnsupportedField(boolean fail)
Whether to fail or return no result when this query is run against a field which is not supported such as binary/numeric fields.
|
MoreLikeThisQueryBuilder |
ids(String... ids) |
MoreLikeThisQueryBuilder |
include(boolean include) |
MoreLikeThisQueryBuilder |
likeText(String likeText)
The text to use in order to find documents that are "like" this.
|
MoreLikeThisQueryBuilder |
maxDocFreq(int maxDocFreq)
Set the maximum frequency in which words may still appear.
|
MoreLikeThisQueryBuilder |
maxQueryTerms(int maxQueryTerms)
Sets the maximum number of query terms that will be included in any generated query.
|
MoreLikeThisQueryBuilder |
maxWordLength(int maxWordLength)
Sets the maximum word length above which words will be ignored.
|
MoreLikeThisQueryBuilder |
minDocFreq(int minDocFreq)
Sets the frequency at which words will be ignored which do not occur in at least this
many docs.
|
MoreLikeThisQueryBuilder |
minimumShouldMatch(String minimumShouldMatch)
Number of terms that must match the generated query expressed in the
common syntax for minimum should match.
|
MoreLikeThisQueryBuilder |
minTermFreq(int minTermFreq)
The frequency below which terms will be ignored in the source doc.
|
MoreLikeThisQueryBuilder |
minWordLength(int minWordLength)
Sets the minimum word length below which words will be ignored.
|
MoreLikeThisQueryBuilder |
percentTermsToMatch(float percentTermsToMatch)
Deprecated.
|
MoreLikeThisQueryBuilder |
queryName(String queryName)
Sets the query name for the filter that can be used when searching for matched_filters per hit.
|
MoreLikeThisQueryBuilder |
stopWords(String... stopWords)
Set the set of stopwords.
|
buildAsBytes, buildAsBytes, toString, toXContent
public MoreLikeThisQueryBuilder()
public MoreLikeThisQueryBuilder(String... fields)
fields
- the field names that will be used when generating the 'More Like This' query.public MoreLikeThisQueryBuilder likeText(String likeText)
public MoreLikeThisQueryBuilder ids(String... ids)
public MoreLikeThisQueryBuilder docs(MoreLikeThisQueryBuilder.Item... docs)
public MoreLikeThisQueryBuilder addItem(MoreLikeThisQueryBuilder.Item item)
public MoreLikeThisQueryBuilder include(boolean include)
public MoreLikeThisQueryBuilder minimumShouldMatch(String minimumShouldMatch)
@Deprecated public MoreLikeThisQueryBuilder percentTermsToMatch(float percentTermsToMatch)
public MoreLikeThisQueryBuilder minTermFreq(int minTermFreq)
public MoreLikeThisQueryBuilder maxQueryTerms(int maxQueryTerms)
public MoreLikeThisQueryBuilder stopWords(String... stopWords)
Any word in this set is considered "uninteresting" and ignored. Even if your Analyzer allows stopwords, you might want to tell the MoreLikeThis code to ignore them, as for the purposes of document similarity it seems reasonable to assume that "a stop word is never interesting".
public MoreLikeThisQueryBuilder minDocFreq(int minDocFreq)
public MoreLikeThisQueryBuilder maxDocFreq(int maxDocFreq)
public MoreLikeThisQueryBuilder minWordLength(int minWordLength)
public MoreLikeThisQueryBuilder maxWordLength(int maxWordLength)
public MoreLikeThisQueryBuilder boostTerms(float boostTerms)
public MoreLikeThisQueryBuilder analyzer(String analyzer)
public MoreLikeThisQueryBuilder boost(float boost)
BoostableQueryBuilder
boost
in interface BoostableQueryBuilder<MoreLikeThisQueryBuilder>
public MoreLikeThisQueryBuilder failOnUnsupportedField(boolean fail)
public MoreLikeThisQueryBuilder queryName(String queryName)
protected void doXContent(XContentBuilder builder, ToXContent.Params params) throws IOException
doXContent
in class BaseQueryBuilder
IOException
Copyright © 2009–2015. All rights reserved.