lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikemcc...@apache.org
Subject svn commit: r804133 - /lucene/java/trunk/src/java/org/apache/lucene/analysis/PerFieldAnalyzerWrapper.java
Date Fri, 14 Aug 2009 09:10:39 GMT
Author: mikemccand
Date: Fri Aug 14 09:10:38 2009
New Revision: 804133

URL: http://svn.apache.org/viewvc?rev=804133&view=rev
Log:
LUCENE-1807: allow passing the Map of field name -> analyzer to PerFieldAnalyzerWrapper

Modified:
    lucene/java/trunk/src/java/org/apache/lucene/analysis/PerFieldAnalyzerWrapper.java

Modified: lucene/java/trunk/src/java/org/apache/lucene/analysis/PerFieldAnalyzerWrapper.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/analysis/PerFieldAnalyzerWrapper.java?rev=804133&r1=804132&r2=804133&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/analysis/PerFieldAnalyzerWrapper.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/analysis/PerFieldAnalyzerWrapper.java Fri
Aug 14 09:10:38 2009
@@ -54,9 +54,27 @@
    * defined to use a different analyzer will use the one provided here.
    */
   public PerFieldAnalyzerWrapper(Analyzer defaultAnalyzer) {
+    this(defaultAnalyzer, null);
+  }
+  
+  /**
+   * Constructs with default analyzer and a map of analyzers to use for 
+   * specific fields.
+   *
+   * @param defaultAnalyzer Any fields not specifically
+   * defined to use a different analyzer will use the one provided here.
+   * @param fieldAnalyzers a Map (String field name to the Analyzer) to be 
+   * used for those fields 
+   */
+  public PerFieldAnalyzerWrapper(Analyzer defaultAnalyzer, 
+      Map /*<String, Analyzer>*/ fieldAnalyzers) {
     this.defaultAnalyzer = defaultAnalyzer;
+    if (fieldAnalyzers != null) {
+      analyzerMap.putAll(fieldAnalyzers);
+    }
     setOverridesTokenStreamMethod(PerFieldAnalyzerWrapper.class);
   }
+  
 
   /**
    * Defines an analyzer to use for the specified field.



Mime
View raw message