public class MoreLikeThisQueryBuilder extends QueryBuilder implements BoostableQueryBuilder<MoreLikeThisQueryBuilder>
MoreLikeThisQueryBuilder.Item
.Modifier and Type | Class and Description |
---|---|
static class |
MoreLikeThisQueryBuilder.Item
A single item to be used for a
MoreLikeThisQueryBuilder . |
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... likeItems)
Deprecated.
|
MoreLikeThisQueryBuilder |
addLikeItem(MoreLikeThisQueryBuilder.Item... likeItems)
Adds a document to use in order to find documents that are "like" this.
|
MoreLikeThisQueryBuilder |
addLikeText(String... likeTexts)
Adds some text to use in order to find documents that are "like" this.
|
MoreLikeThisQueryBuilder |
addUnlikeItem(MoreLikeThisQueryBuilder.Item... unlikeItems)
Adds a document to use in order to find documents that are "unlike" this.
|
MoreLikeThisQueryBuilder |
addUnlikeText(String... unlikeTexts)
Adds some text to use in order to find documents that are "unlike" this.
|
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)
Deprecated.
|
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)
Deprecated.
|
MoreLikeThisQueryBuilder |
ignoreLike(MoreLikeThisQueryBuilder.Item... docs)
Deprecated.
Use
unlike(Item...) instead |
MoreLikeThisQueryBuilder |
ignoreLike(String... likeText)
Deprecated.
Use
unlike(String...) instead. |
MoreLikeThisQueryBuilder |
include(boolean include)
Whether to include the input documents.
|
MoreLikeThisQueryBuilder |
like(MoreLikeThisQueryBuilder.Item... likeItems)
Sets the documents to use in order to find documents that are "like" this.
|
MoreLikeThisQueryBuilder |
like(String... likeTexts)
Sets the text to use in order to find documents that are "like" this.
|
MoreLikeThisQueryBuilder |
likeText(String likeText)
Deprecated.
|
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 |
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.
|
MoreLikeThisQueryBuilder |
unlike(MoreLikeThisQueryBuilder.Item... unlikeItems)
Sets the documents from which the terms should not be selected from.
|
MoreLikeThisQueryBuilder |
unlike(String... unlikeTexts)
Sets the text from which the terms should not be selected from.
|
toXContent
buildAsBytes, buildAsBytes, toString
public MoreLikeThisQueryBuilder()
public MoreLikeThisQueryBuilder(String... fields)
fields
- the field names that will be used when generating the 'More Like This' query.public MoreLikeThisQueryBuilder like(String... likeTexts)
likeTexts
- the text to use when generating the 'More Like This' query.public MoreLikeThisQueryBuilder like(MoreLikeThisQueryBuilder.Item... likeItems)
likeItems
- the documents to use when generating the 'More Like This' query.public MoreLikeThisQueryBuilder addLikeText(String... likeTexts)
public MoreLikeThisQueryBuilder addLikeItem(MoreLikeThisQueryBuilder.Item... likeItems)
public MoreLikeThisQueryBuilder unlike(String... unlikeTexts)
public MoreLikeThisQueryBuilder unlike(MoreLikeThisQueryBuilder.Item... unlikeItems)
public MoreLikeThisQueryBuilder addUnlikeText(String... unlikeTexts)
public MoreLikeThisQueryBuilder addUnlikeItem(MoreLikeThisQueryBuilder.Item... unlikeItems)
public MoreLikeThisQueryBuilder maxQueryTerms(int maxQueryTerms)
public MoreLikeThisQueryBuilder minTermFreq(int minTermFreq)
public MoreLikeThisQueryBuilder minDocFreq(int minDocFreq)
public MoreLikeThisQueryBuilder maxDocFreq(int maxDocFreq)
public MoreLikeThisQueryBuilder minWordLength(int minWordLength)
public MoreLikeThisQueryBuilder maxWordLength(int maxWordLength)
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 analyzer(String analyzer)
public MoreLikeThisQueryBuilder minimumShouldMatch(String minimumShouldMatch)
public MoreLikeThisQueryBuilder boostTerms(float boostTerms)
public MoreLikeThisQueryBuilder include(boolean include)
public MoreLikeThisQueryBuilder failOnUnsupportedField(boolean fail)
public MoreLikeThisQueryBuilder boost(float boost)
BoostableQueryBuilder
boost
in interface BoostableQueryBuilder<MoreLikeThisQueryBuilder>
public MoreLikeThisQueryBuilder queryName(String queryName)
@Deprecated public MoreLikeThisQueryBuilder likeText(String likeText)
@Deprecated public MoreLikeThisQueryBuilder ids(String... ids)
@Deprecated public MoreLikeThisQueryBuilder docs(MoreLikeThisQueryBuilder.Item... docs)
@Deprecated public MoreLikeThisQueryBuilder ignoreLike(MoreLikeThisQueryBuilder.Item... docs)
unlike(Item...)
instead@Deprecated public MoreLikeThisQueryBuilder ignoreLike(String... likeText)
unlike(String...)
instead.@Deprecated public MoreLikeThisQueryBuilder addItem(MoreLikeThisQueryBuilder.Item... likeItems)
protected void doXContent(XContentBuilder builder, ToXContent.Params params) throws IOException
doXContent
in class QueryBuilder
IOException
Copyright © 2009–2016. All rights reserved.