SolrCore core = h.getCore();
MoreLikeThisHandler mlt = new MoreLikeThisHandler();
Map<String,String[]> params = new HashMap<String,String[]>();
MultiMapSolrParams mmparams = new MultiMapSolrParams( params );
SolrQueryRequestBase req = new SolrQueryRequestBase( core, (SolrParams)mmparams ) {};
// requires 'q' or single content stream
try {
mlt.handleRequestBody( req, new SolrQueryResponse() );
}
catch( Exception ex ) {} // expected
// requires 'q' or single content stream
try {
ArrayList<ContentStream> streams = new ArrayList<ContentStream>( 2 );
streams.add( new ContentStreamBase.StringStream( "hello" ) );
streams.add( new ContentStreamBase.StringStream( "there" ) );
req.setContentStreams( streams );
mlt.handleRequestBody( req, new SolrQueryResponse() );
}
catch( Exception ex ) {} // expected
finally {
req.close();
}
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"));