mirror of https://github.com/apache/lucene.git
add some additional non-text fields to MTL handler test
git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@883246 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
8e00a81064
commit
e5843b4e71
|
@ -48,7 +48,7 @@ public class MoreLikeThisHandlerTest extends AbstractSolrTestCase {
|
|||
}
|
||||
|
||||
|
||||
public void testInterface()
|
||||
public void testInterface() throws Exception
|
||||
{
|
||||
SolrCore core = h.getCore();
|
||||
MoreLikeThisHandler mlt = new MoreLikeThisHandler();
|
||||
|
@ -73,20 +73,21 @@ public class MoreLikeThisHandlerTest extends AbstractSolrTestCase {
|
|||
}
|
||||
catch( Exception ex ) {} // expected
|
||||
|
||||
assertU(adoc(new String[]{"id","42","name","Tom Cruise","subword","Top Gun","subword","Risky Business","subword","The Color of Money","subword","Minority Report","subword", "Days of Thunder","subword", "Eyes Wide Shut","subword", "Far and Away"}));
|
||||
assertU(adoc(new String[]{"id","43","name","Tom Hanks","subword","The Green Mile","subword","Forest Gump","subword","Philadelphia Story","subword","Big","subword","Cast Away"}));
|
||||
assertU(adoc(new String[]{"id","44","name","Harrison Ford","subword","Star Wars","subword","Indiana Jones","subword","Patriot Games","subword","Regarding Henry"}));
|
||||
assertU(adoc(new String[]{"id","45","name","George Harrison","subword","Yellow Submarine","subword","Help","subword","Magical Mystery Tour","subword","Sgt. Peppers Lonley Hearts Club Band"}));
|
||||
assertU(adoc(new String[]{"id","46","name","Nicole Kidman","subword","Batman","subword","Days of Thunder","subword","Eyes Wide Shut","subword","Far and Away"}));
|
||||
assertU(adoc("id","42","name","Tom Cruise","subword","Top Gun","subword","Risky Business","subword","The Color of Money","subword","Minority Report","subword", "Days of Thunder","subword", "Eyes Wide Shut","subword", "Far and Away", "foo_ti","10"));
|
||||
assertU(adoc("id","43","name","Tom Hanks","subword","The Green Mile","subword","Forest Gump","subword","Philadelphia Story","subword","Big","subword","Cast Away", "foo_ti","10"));
|
||||
assertU(adoc("id","44","name","Harrison Ford","subword","Star Wars","subword","Indiana Jones","subword","Patriot Games","subword","Regarding Henry"));
|
||||
assertU(adoc("id","45","name","George Harrison","subword","Yellow Submarine","subword","Help","subword","Magical Mystery Tour","subword","Sgt. Peppers Lonley Hearts Club Band"));
|
||||
assertU(adoc("id","46","name","Nicole Kidman","subword","Batman","subword","Days of Thunder","subword","Eyes Wide Shut","subword","Far and Away"));
|
||||
assertU(commit());
|
||||
|
||||
params.put(CommonParams.Q, new String[]{"id:42"});
|
||||
params.put(MoreLikeThisParams.MLT, new String[]{"true"});
|
||||
params.put(MoreLikeThisParams.SIMILARITY_FIELDS, new String[]{"name,subword"});
|
||||
params.put(MoreLikeThisParams.SIMILARITY_FIELDS, new String[]{"name,subword,foo_ti"});
|
||||
params.put(MoreLikeThisParams.INTERESTING_TERMS,new String[]{"details"});
|
||||
params.put(MoreLikeThisParams.MIN_TERM_FREQ,new String[]{"1"});
|
||||
params.put(MoreLikeThisParams.MIN_DOC_FREQ,new String[]{"1"});
|
||||
|
||||
params.put("indent",new String[]{"true"});
|
||||
|
||||
SolrQueryRequest mltreq = new LocalSolrQueryRequest( core, (SolrParams)mmparams);
|
||||
assertQ("morelikethis - tom cruise",mltreq
|
||||
,"//result/doc[1]/int[@name='id'][.='46']"
|
||||
|
@ -101,6 +102,10 @@ public class MoreLikeThisHandlerTest extends AbstractSolrTestCase {
|
|||
assertQ("morelikethis with weights",mltreq
|
||||
,"//result/doc[1]/int[@name='id'][.='43']"
|
||||
,"//result/doc[2]/int[@name='id'][.='46']");
|
||||
|
||||
|
||||
// params.put(MoreLikeThisParams.QF,new String[]{"foo_ti"});
|
||||
// String response = h.query(mltreq);
|
||||
// System.out.println(response);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue