MCPcopy Create free account
hub / github.com/apache/nutch / readContents

Method readContents

src/test/org/apache/nutch/util/CrawlTestUtil.java:100–129  ·  view source on GitHub ↗

Read entries from a data store @return list of matching URLWebPage objects @throws Exception

(
      DataStore<String, WebPage> store, Mark requiredMark, String... fields)

Source from the content-addressed store, hash-verified

98 * @throws Exception
99 */
100 public static ArrayList<URLWebPage> readContents(
101 DataStore<String, WebPage> store, Mark requiredMark, String... fields)
102 throws Exception {
103 ArrayList<URLWebPage> l = new ArrayList<URLWebPage>();
104
105 Query<String, WebPage> query = store.newQuery();
106 if (fields != null) {
107 query.setFields(fields);
108 }
109
110 Result<String, WebPage> results = store.execute(query);
111 while (results.next()) {
112 try {
113 WebPage page = results.get();
114 String url = results.getKey();
115
116 if (page == null)
117 continue;
118
119 if (requiredMark != null && requiredMark.checkMark(page) == null)
120 continue;
121
122 l.add(new URLWebPage(TableUtil.unreverseUrl(url), WebPage.newBuilder(
123 page).build()));
124 } catch (Exception e) {
125 e.printStackTrace();
126 }
127 }
128 return l;
129 }
130
131 /**
132 * Creates a new JettyServer with one static root context

Callers 12

testFetchMethod · 0.95
testReFetchMethod · 0.95
testSitemapFetchMethod · 0.95
testSitemapDetectMethod · 0.95
testSitemapInjectMethod · 0.95
readDbMethod · 0.95
testGenerateHighestMethod · 0.95
testGenerateHostLimitMethod · 0.95
testFilterMethod · 0.95
generateForSitemapMethod · 0.95

Calls 9

unreverseUrlMethod · 0.95
newBuilderMethod · 0.95
setFieldsMethod · 0.80
getKeyMethod · 0.80
checkMarkMethod · 0.80
getMethod · 0.65
nextMethod · 0.45
addMethod · 0.45
buildMethod · 0.45

Tested by

no test coverage detected