You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by rm...@apache.org on 2012/02/05 17:24:31 UTC

svn commit: r1240764 - in /lucene/dev/branches/branch_3x: ./ lucene/contrib/analyzers/kuromoji/src/test/org/apache/lucene/analysis/kuromoji/ solr/ solr/core/ solr/core/src/test/org/apache/solr/analysis/

Author: rmuir
Date: Sun Feb  5 16:24:31 2012
New Revision: 1240764

URL: http://svn.apache.org/viewvc?rev=1240764&view=rev
Log:
LUCENE-3726: additional tests

Modified:
    lucene/dev/branches/branch_3x/   (props changed)
    lucene/dev/branches/branch_3x/lucene/contrib/analyzers/kuromoji/src/test/org/apache/lucene/analysis/kuromoji/TestKuromojiAnalyzer.java
    lucene/dev/branches/branch_3x/solr/   (props changed)
    lucene/dev/branches/branch_3x/solr/core/   (props changed)
    lucene/dev/branches/branch_3x/solr/core/src/test/org/apache/solr/analysis/TestKuromojiTokenizerFactory.java

Modified: lucene/dev/branches/branch_3x/lucene/contrib/analyzers/kuromoji/src/test/org/apache/lucene/analysis/kuromoji/TestKuromojiAnalyzer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/contrib/analyzers/kuromoji/src/test/org/apache/lucene/analysis/kuromoji/TestKuromojiAnalyzer.java?rev=1240764&r1=1240763&r2=1240764&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/contrib/analyzers/kuromoji/src/test/org/apache/lucene/analysis/kuromoji/TestKuromojiAnalyzer.java (original)
+++ lucene/dev/branches/branch_3x/lucene/contrib/analyzers/kuromoji/src/test/org/apache/lucene/analysis/kuromoji/TestKuromojiAnalyzer.java Sun Feb  5 16:24:31 2012
@@ -43,6 +43,15 @@ public class TestKuromojiAnalyzer extend
   }
   
   /**
+   * Test that search mode is enabled and working by default
+   */
+  public void testDecomposition() throws IOException {
+    assertAnalyzesTo(new KuromojiAnalyzer(TEST_VERSION_CURRENT), "シニアソフトウェアエンジニア",
+        new String[] { "シニア", "ソフトウェア", "エンジニア" }
+    );
+  }
+  
+  /**
    * blast random strings against the analyzer
    */
   public void testRandom() throws IOException {

Modified: lucene/dev/branches/branch_3x/solr/core/src/test/org/apache/solr/analysis/TestKuromojiTokenizerFactory.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/core/src/test/org/apache/solr/analysis/TestKuromojiTokenizerFactory.java?rev=1240764&r1=1240763&r2=1240764&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/core/src/test/org/apache/solr/analysis/TestKuromojiTokenizerFactory.java (original)
+++ lucene/dev/branches/branch_3x/solr/core/src/test/org/apache/solr/analysis/TestKuromojiTokenizerFactory.java Sun Feb  5 16:24:31 2012
@@ -41,6 +41,34 @@ public class TestKuromojiTokenizerFactor
     );
   }
   
+  /**
+   * Test that search mode is enabled and working by default
+   */
+  public void testDefaults() throws IOException {
+    KuromojiTokenizerFactory factory = new KuromojiTokenizerFactory();
+    factory.init(DEFAULT_VERSION_PARAM);
+    factory.inform(new SolrResourceLoader(null, null));
+    TokenStream ts = factory.create(new StringReader("シニアソフトウェアエンジニア"));
+    assertTokenStreamContents(ts,
+        new String[] { "シニア", "ソフトウェア", "エンジニア" }
+    );
+  }
+  
+  /**
+   * Test mode parameter: specifying normal mode
+   */
+  public void testMode() throws IOException {
+    KuromojiTokenizerFactory factory = new KuromojiTokenizerFactory();
+    Map<String,String> args = new HashMap<String,String>();
+    args.put("mode", "normal");
+    factory.init(args);
+    factory.inform(new SolrResourceLoader(null, null));
+    TokenStream ts = factory.create(new StringReader("シニアソフトウェアエンジニア"));
+    assertTokenStreamContents(ts,
+        new String[] { "シニアソフトウェアエンジニア" }
+    );
+  }
+  
   public void testUserDict() throws IOException {
     String userDict = 
         "# Custom segmentation for long entries\n" +