You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-commits@lucene.apache.org by yo...@apache.org on 2009/11/23 06:07:39 UTC

svn commit: r883246 - /lucene/solr/trunk/src/test/org/apache/solr/handler/MoreLikeThisHandlerTest.java

Author: yonik
Date: Mon Nov 23 05:07:39 2009
New Revision: 883246

URL: http://svn.apache.org/viewvc?rev=883246&view=rev
Log:
add some additional non-text fields to MTL handler test

Modified:
    lucene/solr/trunk/src/test/org/apache/solr/handler/MoreLikeThisHandlerTest.java

Modified: lucene/solr/trunk/src/test/org/apache/solr/handler/MoreLikeThisHandlerTest.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/test/org/apache/solr/handler/MoreLikeThisHandlerTest.java?rev=883246&r1=883245&r2=883246&view=diff
==============================================================================
--- lucene/solr/trunk/src/test/org/apache/solr/handler/MoreLikeThisHandlerTest.java (original)
+++ lucene/solr/trunk/src/test/org/apache/solr/handler/MoreLikeThisHandlerTest.java Mon Nov 23 05:07:39 2009
@@ -48,7 +48,7 @@
   }
   
   
-  public void testInterface()
+  public void testInterface() throws Exception
   {
     SolrCore core = h.getCore();
     MoreLikeThisHandler mlt = new MoreLikeThisHandler();
@@ -73,20 +73,21 @@
     }
     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 @@
     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);
+
   }
 }