Erik,

I just got this to work myself and the documentation was only partially helpful 
in figuring it out. Two main points on making this work via sor1j:

#1 - Define the mlt handles in solrconfig.xml (it's not defined in the example 
solrconfig.xml I was using):

<requestHandler name="/mlt" class="solr.MoreLikeThisHandler" />

#2 - with Solrj, access the mlt handler via something similar to the following:

query.setQueryType("/" + MoreLikeThisParams.MLT);
query.set(MoreLikeThisParams.MATCH_INCLUDE, false);
query.set(MoreLikeThisParams.MIN_DOC_FREQ, 1);
query.set(MoreLikeThisParams.MIN_TERM_FREQ, 1);
query.set(MoreLikeThisParams.SIMILARITY_FIELDS, "subject,body");
query.setQuery("Your query here or in my case the unique key field:value");

Note that the two lines:

query.set(MoreLikeThisParams.MIN_DOC_FREQ, 1);
query.set(MoreLikeThisParams.MIN_TERM_FREQ, 1);

seem to be required for mlt to work - not sure why. Also, the fields that you 
use to determine similarity should be stored with termVectors=true and 
stored=true.


All the best,

Bruce Ritchie


-----Original Message-----
From: Erik Holstad [mailto:[EMAIL PROTECTED]
Sent: Wednesday, October 08, 2008 9:46 PM
To: solr-user@lucene.apache.org
Subject: Using the more like this feature in solrj.

Hi!
Have been going though the documentation for the more like this/these feature 
but haven't found anything about how to use it in Solrj.

Regards Erik

No virus found in this incoming message.
Checked by AVG - http://www.avg.com
Version: 8.0.173 / Virus Database: 270.7.6/1715 - Release Date: 10/8/2008 7:19 
PM

Reply via email to