MLT using the Java API

Hello.

I've tried to use MoreLikeThisRequestBuilder with Java API and there was
always no hit, the code as follows:

    MoreLikeThisRequestBuilder mlt = new 

MoreLikeThisRequestBuilder(client, "aaa", "bbb", "1");
mlt.setField("title");
SearchResponse response =
client.moreLikeThis(mlt.request()).actionGet();

and I searches your solution, that is using MoreLikeThisQueryBuilder. but
It doesn't work, either. My codes are:

    MoreLikeThisQueryBuilder query = QueryBuilders.moreLikeThisQuery(); 
    query.boost(1.0f).likeText("title").minTermFreq(10);

   SearchResponse searchResponse = 

client.prepareSearch("aaa").setTypes("bbb")
.setQuery(query)
.execute()
.actionGet();

is there something wrong with the searchResponse part? could you give me
some suggestions?
Thanks in advance!

Am Dienstag, 4. Juni 2013 10:34:15 UTC+2 schrieb es newbie:

Thanks Vineeth.

I got it working in the end. I changed the implementation to use a
MoreLikeThisQueryBuilder instead.

On Tuesday, June 4, 2013 2:37:35 AM UTC+1, Vineeth Mohan wrote:

How many documents are there in the index ?

Try
.minTermFreq(0)
.minDocFreq(0))

On Tue, Jun 4, 2013 at 1:58 AM, es newbie dan.t...@gmail.com wrote:

I'm trying to get the MLT feature working via the Java API, here is my
request:

SearchResponse searchResponse =
client.moreLikeThis(moreLikeThisRequest(index).type(type)
.id(1)
.fields("text")
.minTermFreq(1)
.minDocFreq(1))
.actionGet();

I've made sure that document 1 and other documents in the index contain
the word "chicago" in the text field, but it is always returning zero hits.

The 'text' field is indexed and has "term_vectors:true"

Am I missing something here?

--
You received this message because you are subscribed to the Google
Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to elasticsearc...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.