Package org.apache.nutch.crawl
Class CrawlDatum
java.lang.Object
org.apache.nutch.crawl.CrawlDatum
- All Implemented Interfaces:
Cloneable,Comparable<CrawlDatum>,Writable,WritableComparable<CrawlDatum>
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA Comparator optimized for CrawlDatum. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final bytePage was marked as being a duplicate of another pagestatic final bytePage was successfully fetched.static final bytePage no longer exists.static final byteMaximum value of DB-related status.static final bytePage was successfully fetched and found not modified.static final bytePage was marked as orphan, e.g.static final bytePage parsing failedstatic final bytePage permanently redirects to other page.static final bytePage temporarily redirects to other page.static final bytePage was not fetched yet.static final byteFetching unsuccessful - page is gone.static final byteMaximum value of fetch-related status.static final byteFetching successful - page is not modified.static final byteFetching permanently redirected to other page.static final byteFetching temporarily redirected to other page.static final byteFetching unsuccessful, needs to be retried (transient errors).static final byteFetching was successful.static final bytePage was newly injected.static final bytePage discovered through a link.static final bytePage parse failedstatic final bytePage got metadata from a parserstatic final bytePage signature. -
Constructor Summary
ConstructorsConstructorDescriptionCrawlDatum(int status, int fetchInterval) CrawlDatum(int status, int fetchInterval, float score) -
Method Summary
Modifier and TypeMethodDescriptionclone()intcompareTo(CrawlDatum that) Sort twoCrawlDatumobjects by decreasing score.booleanbooleanintlongGet the fetch time.Get CrawlDatum metadatalongbytefloatgetScore()byte[]bytestatic bytegetStatusByName(String name) static StringgetStatusName(byte value) static booleanhasDbStatus(CrawlDatum datum) Validate DB Status (ref.: CrawlDbReducer, IndexerReducer)static booleanhasFetchStatus(CrawlDatum datum) Validate Fetch Status (ref.: CrawlDbReducer, IndexerReducer, SegmentMergerReducer)inthashCode()voidputAllMetaData(CrawlDatum other) Add all metadata from other CrawlDatum to this CrawlDatum.static CrawlDatumvoidreadFields(DataInput in) voidset(CrawlDatum that) Copy the contents of another instance into this instance.voidsetFetchInterval(float fetchInterval) voidsetFetchInterval(int fetchInterval) voidsetFetchTime(long fetchTime) Sets either the time of the last fetch or the next fetch time, depending on whether Fetcher or CrawlDbReducer set the time.voidsetMetaData(MapWritable mapWritable) voidsetModifiedTime(long modifiedTime) voidsetRetriesSinceFetch(int retries) voidsetScore(float score) voidsetSignature(byte[] signature) voidsetStatus(int status) toString()voidwrite(DataOutput out)
-
Field Details
-
GENERATE_DIR_NAME
- See Also:
-
FETCH_DIR_NAME
- See Also:
-
PARSE_DIR_NAME
- See Also:
-
STATUS_DB_UNFETCHED
public static final byte STATUS_DB_UNFETCHEDPage was not fetched yet.- See Also:
-
STATUS_DB_FETCHED
public static final byte STATUS_DB_FETCHEDPage was successfully fetched.- See Also:
-
STATUS_DB_GONE
public static final byte STATUS_DB_GONEPage no longer exists.- See Also:
-
STATUS_DB_REDIR_TEMP
public static final byte STATUS_DB_REDIR_TEMPPage temporarily redirects to other page.- See Also:
-
STATUS_DB_REDIR_PERM
public static final byte STATUS_DB_REDIR_PERMPage permanently redirects to other page.- See Also:
-
STATUS_DB_NOTMODIFIED
public static final byte STATUS_DB_NOTMODIFIEDPage was successfully fetched and found not modified.- See Also:
-
STATUS_DB_DUPLICATE
public static final byte STATUS_DB_DUPLICATEPage was marked as being a duplicate of another page- See Also:
-
STATUS_DB_ORPHAN
public static final byte STATUS_DB_ORPHANPage was marked as orphan, e.g. has no inlinks anymore- See Also:
-
STATUS_DB_PARSE_FAILED
public static final byte STATUS_DB_PARSE_FAILEDPage parsing failed- See Also:
-
STATUS_DB_MAX
public static final byte STATUS_DB_MAXMaximum value of DB-related status.- See Also:
-
STATUS_FETCH_SUCCESS
public static final byte STATUS_FETCH_SUCCESSFetching was successful.- See Also:
-
STATUS_FETCH_RETRY
public static final byte STATUS_FETCH_RETRYFetching unsuccessful, needs to be retried (transient errors).- See Also:
-
STATUS_FETCH_REDIR_TEMP
public static final byte STATUS_FETCH_REDIR_TEMPFetching temporarily redirected to other page.- See Also:
-
STATUS_FETCH_REDIR_PERM
public static final byte STATUS_FETCH_REDIR_PERMFetching permanently redirected to other page.- See Also:
-
STATUS_FETCH_GONE
public static final byte STATUS_FETCH_GONEFetching unsuccessful - page is gone.- See Also:
-
STATUS_FETCH_NOTMODIFIED
public static final byte STATUS_FETCH_NOTMODIFIEDFetching successful - page is not modified.- See Also:
-
STATUS_FETCH_MAX
public static final byte STATUS_FETCH_MAXMaximum value of fetch-related status.- See Also:
-
STATUS_SIGNATURE
public static final byte STATUS_SIGNATUREPage signature.- See Also:
-
STATUS_INJECTED
public static final byte STATUS_INJECTEDPage was newly injected.- See Also:
-
STATUS_LINKED
public static final byte STATUS_LINKEDPage discovered through a link.- See Also:
-
STATUS_PARSE_META
public static final byte STATUS_PARSE_METAPage got metadata from a parser- See Also:
-
STATUS_PARSE_FAILED
public static final byte STATUS_PARSE_FAILEDPage parse failed- See Also:
-
statNames
-
-
Constructor Details
-
CrawlDatum
public CrawlDatum() -
CrawlDatum
public CrawlDatum(int status, int fetchInterval) -
CrawlDatum
public CrawlDatum(int status, int fetchInterval, float score)
-
-
Method Details
-
hasDbStatus
Validate DB Status (ref.: CrawlDbReducer, IndexerReducer) -
hasFetchStatus
Validate Fetch Status (ref.: CrawlDbReducer, IndexerReducer, SegmentMergerReducer) -
getStatus
public byte getStatus() -
getStatusName
-
getStatusByName
-
setStatus
public void setStatus(int status) -
getFetchTime
public long getFetchTime()Get the fetch time.- Returns:
- long value indicating either the time of the last fetch, or the next fetch time, depending on whether Fetcher or CrawlDbReducer set the time.
-
setFetchTime
public void setFetchTime(long fetchTime) Sets either the time of the last fetch or the next fetch time, depending on whether Fetcher or CrawlDbReducer set the time.- Parameters:
fetchTime- the fetch time to set.
-
getModifiedTime
public long getModifiedTime() -
setModifiedTime
public void setModifiedTime(long modifiedTime) -
getRetriesSinceFetch
public byte getRetriesSinceFetch() -
setRetriesSinceFetch
public void setRetriesSinceFetch(int retries) -
getFetchInterval
public int getFetchInterval() -
setFetchInterval
public void setFetchInterval(int fetchInterval) -
setFetchInterval
public void setFetchInterval(float fetchInterval) -
getScore
public float getScore() -
setScore
public void setScore(float score) -
getSignature
public byte[] getSignature() -
setSignature
public void setSignature(byte[] signature) -
setMetaData
-
putAllMetaData
Add all metadata from other CrawlDatum to this CrawlDatum.- Parameters:
other- CrawlDatum
-
getMetaData
Get CrawlDatum metadata- Returns:
- a MapWritable if it was set or read in #readFields(DataInput), returns empty map in case CrawlDatum was freshly created (lazily instantiated).
- See Also:
-
read
- Throws:
IOException
-
readFields
- Specified by:
readFieldsin interfaceWritable- Throws:
IOException
-
write
- Specified by:
writein interfaceWritable- Throws:
IOException
-
set
Copy the contents of another instance into this instance.- Parameters:
that- an existingCrawlDatum
-
compareTo
Sort twoCrawlDatumobjects by decreasing score.- Specified by:
compareToin interfaceComparable<CrawlDatum>- Parameters:
that- an existingCrawlDatum- Returns:
- 1 if any one field (score, status, fetchTime, retries,
fetchInterval or modifiedTime) of the new
CrawlDatumminus the correspoinding field of the existingCrawlDatumis greater than 0, otherwise return -1.
-
toString
-
equals
-
hashCode
public int hashCode() -
clone
-
execute
-