Revision: 2835 http://archive-access.svn.sourceforge.net/archive-access/?rev=2835&view=rev Author: binzino Date: 2009-10-27 21:14:24 +0000 (Tue, 27 Oct 2009) Log Message: ----------- Updated to Nutch 1.0 API. Modified Paths: -------------- trunk/archive-access/projects/nutchwax/archive/src/plugin/index-nutchwax/src/java/org/archive/nutchwax/index/FieldSetter.java Modified: trunk/archive-access/projects/nutchwax/archive/src/plugin/index-nutchwax/src/java/org/archive/nutchwax/index/FieldSetter.java =================================================================== --- trunk/archive-access/projects/nutchwax/archive/src/plugin/index-nutchwax/src/java/org/archive/nutchwax/index/FieldSetter.java 2009-10-26 23:02:50 UTC (rev 2834) +++ trunk/archive-access/projects/nutchwax/archive/src/plugin/index-nutchwax/src/java/org/archive/nutchwax/index/FieldSetter.java 2009-10-27 21:14:24 UTC (rev 2835) @@ -26,14 +26,14 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.apache.lucene.document.Document; -import org.apache.lucene.document.Field; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.io.Text; import org.apache.nutch.crawl.CrawlDatum; import org.apache.nutch.crawl.Inlinks; import org.apache.nutch.indexer.IndexingException; import org.apache.nutch.indexer.IndexingFilter; +import org.apache.nutch.indexer.NutchDocument; +import org.apache.nutch.indexer.lucene.LuceneWriter; import org.apache.nutch.metadata.Metadata; import org.apache.nutch.parse.Parse; @@ -152,7 +152,7 @@ * Remove field if specified value is <code>null</code>. * </p> */ - public Document filter( Document doc, Parse parse, Text url, CrawlDatum datum, Inlinks inlinks ) + public NutchDocument filter( NutchDocument doc, Parse parse, Text url, CrawlDatum datum, Inlinks inlinks ) throws IndexingException { Metadata meta = parse.getData().getContentMeta(); @@ -160,20 +160,29 @@ for ( FieldSetting setting : this.settings ) { // First, remove the existing field. - doc.removeFields( setting.key ); + doc.removeField( setting.key ); // Add the value if it is given. if ( setting.value != null ) { - doc.add( new Field( setting.key, - setting.value, - setting.store ? Field.Store.YES : Field.Store.NO, - setting.tokenize ? Field.Index.TOKENIZED : Field.Index.UN_TOKENIZED ) ); + doc.add( setting.key, setting.value ); } } return doc; } + public void addIndexBackendOptions( Configuration conf ) + { + + for ( FieldSetting setting : this.settings ) + { + LuceneWriter.addFieldOptions( setting.key, + setting.store ? LuceneWriter.STORE.YES : LuceneWriter.STORE.NO, + setting.tokenize ? LuceneWriter.INDEX.TOKENIZED : LuceneWriter.INDEX.UNTOKENIZED, + conf ); + } + + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |