Author: mattmann
Date: Tue Jun 29 05:38:49 2010
New Revision: 958828

URL: http://svn.apache.org/viewvc?rev=958828&view=rev
Log:
fix for NUTCH-831 Allow configuration of how fields crawled by Nutch are stored 
/ indexed / tokenized

Modified:
    
nutch/branches/branch-1.2/src/java/org/apache/nutch/indexer/lucene/LuceneWriter.java

Modified: 
nutch/branches/branch-1.2/src/java/org/apache/nutch/indexer/lucene/LuceneWriter.java
URL: 
http://svn.apache.org/viewvc/nutch/branches/branch-1.2/src/java/org/apache/nutch/indexer/lucene/LuceneWriter.java?rev=958828&r1=958827&r2=958828&view=diff
==============================================================================
--- 
nutch/branches/branch-1.2/src/java/org/apache/nutch/indexer/lucene/LuceneWriter.java
 (original)
+++ 
nutch/branches/branch-1.2/src/java/org/apache/nutch/indexer/lucene/LuceneWriter.java
 Tue Jun 29 05:38:49 2010
@@ -300,9 +300,16 @@ public class LuceneWriter implements Nut
   public static void addFieldOptions(String field, LuceneWriter.STORE store,
       LuceneWriter.INDEX index, LuceneWriter.VECTOR vector, Configuration 
conf) {
 
-    conf.set(LuceneConstants.FIELD_STORE_PREFIX + field, store.toString());
-    conf.set(LuceneConstants.FIELD_INDEX_PREFIX + field, index.toString());
-    conf.set(LuceneConstants.FIELD_VECTOR_PREFIX + field, vector.toString());
+    /* Only set the field options if none have been configured already */
+    if (conf.get(LuceneConstants.FIELD_STORE_PREFIX + field) == null) {
+       conf.set(LuceneConstants.FIELD_STORE_PREFIX + field, store.toString());
+    }
+    if (conf.get(LuceneConstants.FIELD_INDEX_PREFIX + field) == null) {
+           conf.set(LuceneConstants.FIELD_INDEX_PREFIX + field, 
index.toString());
+    }
+    if (conf.get(LuceneConstants.FIELD_VECTOR_PREFIX + field) == null) {
+           conf.set(LuceneConstants.FIELD_VECTOR_PREFIX + field, 
vector.toString());
+    }
   }
 
   public static void addFieldOptions(String field, LuceneWriter.STORE store,


Reply via email to