|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.nutch.parse.ParseResult
public class ParseResult
A utility class that stores result of a parse. Internally
a ParseResult stores <Text
, Parse
> pairs.
Parsers may return multiple results, which correspond to parts or other associated documents related to the original URL.
There will be usually one parse result that corresponds directly to the original URL, and possibly many (or none) results that correspond to derived URLs (or sub-URLs).
Field Summary | |
---|---|
static org.apache.commons.logging.Log |
LOG
|
Constructor Summary | |
---|---|
ParseResult(String originalUrl)
Create a container for parse results. |
Method Summary | |
---|---|
static ParseResult |
createParseResult(String url,
Parse parse)
Convenience method for obtaining ParseResult from a single
Parse output. |
void |
filter()
Remove all results where status is not successful (as determined by ParseStatus.isSuccess() ). |
Parse |
get(String key)
Retrieve a single parse output. |
Parse |
get(Text key)
Retrieve a single parse output. |
boolean |
isEmpty()
Checks whether the result is empty. |
boolean |
isSuccess()
A convenience method which returns true only if all parses are successful. |
Iterator<Map.Entry<Text,Parse>> |
iterator()
Iterate over all entries in the <url, Parse> map. |
void |
put(String key,
ParseText text,
ParseData data)
Store a result of parsing. |
void |
put(Text key,
ParseText text,
ParseData data)
Store a result of parsing. |
int |
size()
Return the number of parse outputs (both successful and failed) |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final org.apache.commons.logging.Log LOG
Constructor Detail |
---|
public ParseResult(String originalUrl)
originalUrl
- the original url from which all parse results
have been obtained.Method Detail |
---|
public static ParseResult createParseResult(String url, Parse parse)
ParseResult
from a single
Parse
output.
url
- canonical urlparse
- single parse output
public boolean isEmpty()
public int size()
public Parse get(String key)
key
- sub-url under which the parse output is stored.
public Parse get(Text key)
key
- sub-url under which the parse output is stored.
public void put(Text key, ParseText text, ParseData data)
key
- URL or sub-url of this parse resulttext
- plain text resultdata
- corresponding parse metadata of this resultpublic void put(String key, ParseText text, ParseData data)
key
- URL or sub-url of this parse resulttext
- plain text resultdata
- corresponding parse metadata of this resultpublic Iterator<Map.Entry<Text,Parse>> iterator()
iterator
in interface Iterable<Map.Entry<Text,Parse>>
public void filter()
ParseStatus.isSuccess()
). Note that effects of this operation
cannot be reversed.
public boolean isSuccess()
ParseStatus.isSuccess()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |