Author: jnioche Date: Thu Oct 10 13:50:17 2013 New Revision: 1530979 URL: http://svn.apache.org/r1530979 Log: NUTCH-1653 AbstractScoringFilter
Added: nutch/trunk/src/java/org/apache/nutch/scoring/AbstractScoringFilter.java Modified: nutch/trunk/CHANGES.txt Modified: nutch/trunk/CHANGES.txt URL: http://svn.apache.org/viewvc/nutch/trunk/CHANGES.txt?rev=1530979&r1=1530978&r2=1530979&view=diff ============================================================================== --- nutch/trunk/CHANGES.txt (original) +++ nutch/trunk/CHANGES.txt Thu Oct 10 13:50:17 2013 @@ -2,6 +2,8 @@ Nutch Change Log Nutch Development Trunk +* NUTCH-1653 AbstractScoringFilter (jnioche) + * NUTCH-1562 Order of execution for scoring filters (jnioche, snagel) * NUTCH-1640 Reuse ParseUtil instance in ParseSegment (Mitesh Singh Jat via jnioche) Added: nutch/trunk/src/java/org/apache/nutch/scoring/AbstractScoringFilter.java URL: http://svn.apache.org/viewvc/nutch/trunk/src/java/org/apache/nutch/scoring/AbstractScoringFilter.java?rev=1530979&view=auto ============================================================================== --- nutch/trunk/src/java/org/apache/nutch/scoring/AbstractScoringFilter.java (added) +++ nutch/trunk/src/java/org/apache/nutch/scoring/AbstractScoringFilter.java Thu Oct 10 13:50:17 2013 @@ -0,0 +1,68 @@ +package org.apache.nutch.scoring; + +import java.util.Collection; +import java.util.List; +import java.util.Map.Entry; + +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.NutchDocument; +import org.apache.nutch.parse.Parse; +import org.apache.nutch.parse.ParseData; +import org.apache.nutch.protocol.Content; +import org.apache.nutch.scoring.ScoringFilter; +import org.apache.nutch.scoring.ScoringFilterException; + +public abstract class AbstractScoringFilter implements ScoringFilter { + + private Configuration conf; + + public Configuration getConf() { + return conf; + } + + public void setConf(Configuration conf) { + this.conf = conf; + } + + public void injectedScore(Text url, CrawlDatum datum) + throws ScoringFilterException { + } + + public void initialScore(Text url, CrawlDatum datum) + throws ScoringFilterException { + } + + public float generatorSortValue(Text url, CrawlDatum datum, float initSort) + throws ScoringFilterException { + return initSort; + } + + public void passScoreBeforeParsing(Text url, CrawlDatum datum, + Content content) throws ScoringFilterException { + } + + public void passScoreAfterParsing(Text url, Content content, Parse parse) + throws ScoringFilterException { + } + + public CrawlDatum distributeScoreToOutlinks(Text fromUrl, + ParseData parseData, Collection<Entry<Text, CrawlDatum>> targets, + CrawlDatum adjust, int allCount) throws ScoringFilterException { + return adjust; + } + + public void updateDbScore(Text url, CrawlDatum old, CrawlDatum datum, + List<CrawlDatum> inlinked) throws ScoringFilterException { + } + + @Override + public float indexerScore(Text url, NutchDocument doc, CrawlDatum dbDatum, + CrawlDatum fetchDatum, Parse parse, Inlinks inlinks, float initScore) + throws ScoringFilterException { + return initScore; + } + +}