org.elasticsearch.index.query
Class MoreLikeThisFieldQueryBuilder

java.lang.Object
  extended by org.elasticsearch.index.query.BaseQueryBuilder
      extended by org.elasticsearch.index.query.MoreLikeThisFieldQueryBuilder
All Implemented Interfaces:
ToXContent, BoostableQueryBuilder<MoreLikeThisFieldQueryBuilder>, QueryBuilder

public class MoreLikeThisFieldQueryBuilder
extends BaseQueryBuilder
implements BoostableQueryBuilder<MoreLikeThisFieldQueryBuilder>

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


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

Constructor Detail

MoreLikeThisFieldQueryBuilder

public MoreLikeThisFieldQueryBuilder(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 MoreLikeThisFieldQueryBuilder likeText(String likeText)
The text to use in order to find documents that are "like" this.


percentTermsToMatch

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


minTermFreq

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


maxQueryTerms

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


stopWords

public MoreLikeThisFieldQueryBuilder stopWords(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 MoreLikeThisFieldQueryBuilder 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 MoreLikeThisFieldQueryBuilder 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 MoreLikeThisFieldQueryBuilder minWordLen(int minWordLen)
Sets the minimum word length below which words will be ignored. Defaults to 0.


maxWordLen

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


boostTerms

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


analyzer

public MoreLikeThisFieldQueryBuilder analyzer(String analyzer)
The analyzer that will be used to analyze the text. Defaults to the analyzer associated with the fied.


boost

public MoreLikeThisFieldQueryBuilder boost(float boost)
Description copied from interface: BoostableQueryBuilder
Sets the boost for this query. Documents matching this query will (in addition to the normal weightings) have their score multiplied by the boost provided.

Specified by:
boost in interface BoostableQueryBuilder<MoreLikeThisFieldQueryBuilder>

doXContent

protected void doXContent(XContentBuilder builder,
                          ToXContent.Params params)
                   throws IOException
Specified by:
doXContent in class BaseQueryBuilder
Throws:
IOException


Copyright © 2009-2012. All Rights Reserved.