org.elasticsearch.index.query.json
Class MoreLikeThisFieldJsonQueryBuilder

java.lang.Object
  extended by org.elasticsearch.index.query.json.BaseJsonQueryBuilder
      extended by org.elasticsearch.index.query.json.MoreLikeThisFieldJsonQueryBuilder
All Implemented Interfaces:
JsonQueryBuilder, QueryBuilder, ToJson

public class MoreLikeThisFieldJsonQueryBuilder
extends BaseJsonQueryBuilder

A more like this query that runs against a specific field.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.elasticsearch.util.json.ToJson
ToJson.MapParams, ToJson.Params
 
Field Summary
 
Fields inherited from interface org.elasticsearch.util.json.ToJson
EMPTY_PARAMS
 
Constructor Summary
MoreLikeThisFieldJsonQueryBuilder(java.lang.String name)
          A more like this query that runs against a specific field.
 
Method Summary
 MoreLikeThisFieldJsonQueryBuilder boost(float boost)
           
 MoreLikeThisFieldJsonQueryBuilder boostTerms(float boostTerms)
          Sets the boost factor to use when boosting terms.
protected  void doJson(JsonBuilder builder, ToJson.Params params)
           
 MoreLikeThisFieldJsonQueryBuilder likeText(java.lang.String likeText)
          The text to use in order to find documents that are "like" this.
 MoreLikeThisFieldJsonQueryBuilder maxDocFreq(int maxDocFreq)
          Set the maximum frequency in which words may still appear.
 MoreLikeThisFieldJsonQueryBuilder maxQueryTerms(int maxQueryTerms)
          Sets the maximum number of query terms that will be included in any generated query.
 MoreLikeThisFieldJsonQueryBuilder maxWordLen(int maxWordLen)
          Sets the maximum word length above which words will be ignored.
 MoreLikeThisFieldJsonQueryBuilder minDocFreq(int minDocFreq)
          Sets the frequency at which words will be ignored which do not occur in at least this many docs.
 MoreLikeThisFieldJsonQueryBuilder minTermFreq(int minTermFreqy)
          The frequency below which terms will be ignored in the source doc.
 MoreLikeThisFieldJsonQueryBuilder minWordLen(int minWordLen)
          Sets the minimum word length below which words will be ignored.
 MoreLikeThisFieldJsonQueryBuilder percentTermsToMatch(float percentTermsToMatch)
          The percentage of terms to match.
 MoreLikeThisFieldJsonQueryBuilder stopWords(java.lang.String... stopWords)
          Set the set of stopwords.
 
Methods inherited from class org.elasticsearch.index.query.json.BaseJsonQueryBuilder
buildAsBytes, buildAsString, buildAsUnsafeChars, toJson
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MoreLikeThisFieldJsonQueryBuilder

public MoreLikeThisFieldJsonQueryBuilder(java.lang.String name)
A more like this query that runs against a specific field.

Parameters:
name - The field name to run the query against
Method Detail

likeText

public MoreLikeThisFieldJsonQueryBuilder likeText(java.lang.String likeText)
The text to use in order to find documents that are "like" this.


percentTermsToMatch

public MoreLikeThisFieldJsonQueryBuilder percentTermsToMatch(float percentTermsToMatch)
The percentage of terms to match. Defaults to 0.3.


minTermFreq

public MoreLikeThisFieldJsonQueryBuilder minTermFreq(int minTermFreqy)
The frequency below which terms will be ignored in the source doc. The default frequency is 2.


maxQueryTerms

public MoreLikeThisFieldJsonQueryBuilder maxQueryTerms(int maxQueryTerms)
Sets the maximum number of query terms that will be included in any generated query. Defaults to 25.


stopWords

public MoreLikeThisFieldJsonQueryBuilder stopWords(java.lang.String... stopWords)
Set the set of 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".


minDocFreq

public MoreLikeThisFieldJsonQueryBuilder minDocFreq(int minDocFreq)
Sets the frequency at which words will be ignored which do not occur in at least this many docs. Defaults to 5.


maxDocFreq

public MoreLikeThisFieldJsonQueryBuilder maxDocFreq(int maxDocFreq)
Set the maximum frequency in which words may still appear. Words that appear in more than this many docs will be ignored. Defaults to unbounded.


minWordLen

public MoreLikeThisFieldJsonQueryBuilder minWordLen(int minWordLen)
Sets the minimum word length below which words will be ignored. Defaults to 0.


maxWordLen

public MoreLikeThisFieldJsonQueryBuilder maxWordLen(int maxWordLen)
Sets the maximum word length above which words will be ignored. Defaults to unbounded (0).


boostTerms

public MoreLikeThisFieldJsonQueryBuilder boostTerms(float boostTerms)
Sets the boost factor to use when boosting terms. Defaults to 1.


boost

public MoreLikeThisFieldJsonQueryBuilder boost(float boost)

doJson

protected void doJson(JsonBuilder builder,
                      ToJson.Params params)
               throws java.io.IOException
Specified by:
doJson in class BaseJsonQueryBuilder
Throws:
java.io.IOException