org.elasticsearch.action.mlt
Class MoreLikeThisRequestBuilder

java.lang.Object
  extended by org.elasticsearch.action.support.BaseRequestBuilder<MoreLikeThisRequest,SearchResponse>
      extended by org.elasticsearch.action.mlt.MoreLikeThisRequestBuilder
All Implemented Interfaces:
ActionRequestBuilder<MoreLikeThisRequest,SearchResponse>

public class MoreLikeThisRequestBuilder
extends BaseRequestBuilder<MoreLikeThisRequest,SearchResponse>


Field Summary
 
Fields inherited from class org.elasticsearch.action.support.BaseRequestBuilder
client, request
 
Constructor Summary
MoreLikeThisRequestBuilder(Client client)
           
MoreLikeThisRequestBuilder(Client client, String index, String type, String id)
           
 
Method Summary
protected  void doExecute(ActionListener<SearchResponse> listener)
           
 MoreLikeThisRequestBuilder maxQueryTerms(int maxQueryTerms)
          The maximum number of query terms that will be included in any generated query.
 MoreLikeThisRequestBuilder setBoostTerms(float boostTerms)
          The boost factor to use when boosting terms.
 MoreLikeThisRequestBuilder setField(String... fields)
          The fields of the document to use in order to find documents "like" this one.
 MoreLikeThisRequestBuilder setMaxDocFreq(int maxDocFreq)
          The maximum frequency in which words may still appear.
 MoreLikeThisRequestBuilder setMaxWordLen(int maxWordLen)
          The maximum word length above which words will be ignored.
 MoreLikeThisRequestBuilder setMinDocFreq(int minDocFreq)
          The frequency at which words will be ignored which do not occur in at least this many docs.
 MoreLikeThisRequestBuilder setMinTermFreq(int minTermFreq)
          The frequency below which terms will be ignored in the source doc.
 MoreLikeThisRequestBuilder setMinWordLen(int minWordLen)
          The minimum word length below which words will be ignored.
 MoreLikeThisRequestBuilder setPercentTermsToMatch(float percentTermsToMatch)
          The percent of the terms to match for each field.
 MoreLikeThisRequestBuilder setSearchFrom(int from)
          From which search result set to return.
 MoreLikeThisRequestBuilder setSearchIndices(String... searchIndices)
          The indices the resulting mlt query will run against.
 MoreLikeThisRequestBuilder setSearchScroll(Scroll searchScroll)
          An optional search scroll request to be able to continue and scroll the search operation.
 MoreLikeThisRequestBuilder setSearchSize(int size)
          The number of documents to return, defaults to 10.
 MoreLikeThisRequestBuilder setSearchSource(byte[] searchSource)
          An optional search source request allowing to control the search request for the more like this documents.
 MoreLikeThisRequestBuilder setSearchSource(Map searchSource)
          An optional search source request allowing to control the search request for the more like this documents.
 MoreLikeThisRequestBuilder setSearchSource(SearchSourceBuilder sourceBuilder)
          An optional search source request allowing to control the search request for the more like this documents.
 MoreLikeThisRequestBuilder setSearchSource(String searchSource)
          An optional search source request allowing to control the search request for the more like this documents.
 MoreLikeThisRequestBuilder setSearchSource(XContentBuilder builder)
          An optional search source request allowing to control the search request for the more like this documents.
 MoreLikeThisRequestBuilder setSearchType(SearchType searchType)
          The search type of the mlt search query.
 MoreLikeThisRequestBuilder setSearchType(String searchType)
          The search type of the mlt search query.
 MoreLikeThisRequestBuilder setSearchTypes(String... searchTypes)
          The types the resulting mlt query will run against.
 MoreLikeThisRequestBuilder setStopWords(String... stopWords)
          Any word in this set is considered "uninteresting" and ignored.
 
Methods inherited from class org.elasticsearch.action.support.BaseRequestBuilder
execute, execute, request
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MoreLikeThisRequestBuilder

public MoreLikeThisRequestBuilder(Client client)

MoreLikeThisRequestBuilder

public MoreLikeThisRequestBuilder(Client client,
                                  String index,
                                  String type,
                                  String id)
Method Detail

setField

public MoreLikeThisRequestBuilder setField(String... fields)
The fields of the document to use in order to find documents "like" this one. Defaults to run against all the document fields.


setPercentTermsToMatch

public MoreLikeThisRequestBuilder setPercentTermsToMatch(float percentTermsToMatch)
The percent of the terms to match for each field. Defaults to 0.3f.


setMinTermFreq

public MoreLikeThisRequestBuilder setMinTermFreq(int minTermFreq)
The frequency below which terms will be ignored in the source doc. Defaults to 2.


maxQueryTerms

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


setStopWords

public MoreLikeThisRequestBuilder setStopWords(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".

Defaults to no stop words.


setMinDocFreq

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


setMaxDocFreq

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


setMinWordLen

public MoreLikeThisRequestBuilder setMinWordLen(int minWordLen)
The minimum word length below which words will be ignored. Defaults to 0.


setMaxWordLen

public MoreLikeThisRequestBuilder setMaxWordLen(int maxWordLen)
The maximum word length above which words will be ignored. Defaults to unbounded.


setBoostTerms

public MoreLikeThisRequestBuilder setBoostTerms(float boostTerms)
The boost factor to use when boosting terms. Defaults to 1.


setSearchSource

public MoreLikeThisRequestBuilder setSearchSource(SearchSourceBuilder sourceBuilder)
An optional search source request allowing to control the search request for the more like this documents.


setSearchSource

public MoreLikeThisRequestBuilder setSearchSource(String searchSource)
An optional search source request allowing to control the search request for the more like this documents.


setSearchSource

public MoreLikeThisRequestBuilder setSearchSource(Map searchSource)
An optional search source request allowing to control the search request for the more like this documents.


setSearchSource

public MoreLikeThisRequestBuilder setSearchSource(XContentBuilder builder)
An optional search source request allowing to control the search request for the more like this documents.


setSearchSource

public MoreLikeThisRequestBuilder setSearchSource(byte[] searchSource)
An optional search source request allowing to control the search request for the more like this documents.


setSearchType

public MoreLikeThisRequestBuilder setSearchType(SearchType searchType)
The search type of the mlt search query.


setSearchType

public MoreLikeThisRequestBuilder setSearchType(String searchType)
                                         throws ElasticSearchIllegalArgumentException
The search type of the mlt search query.

Throws:
ElasticSearchIllegalArgumentException

setSearchIndices

public MoreLikeThisRequestBuilder setSearchIndices(String... searchIndices)
The indices the resulting mlt query will run against. If not set, will run against the index the document was fetched from.


setSearchTypes

public MoreLikeThisRequestBuilder setSearchTypes(String... searchTypes)
The types the resulting mlt query will run against. If not set, will run against the type of the document fetched.


setSearchScroll

public MoreLikeThisRequestBuilder setSearchScroll(Scroll searchScroll)
An optional search scroll request to be able to continue and scroll the search operation.


setSearchSize

public MoreLikeThisRequestBuilder setSearchSize(int size)
The number of documents to return, defaults to 10.


setSearchFrom

public MoreLikeThisRequestBuilder setSearchFrom(int from)
From which search result set to return.


doExecute

protected void doExecute(ActionListener<SearchResponse> listener)
Specified by:
doExecute in class BaseRequestBuilder<MoreLikeThisRequest,SearchResponse>


Copyright © 2009-2012. All Rights Reserved.