Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change field names to match new druid config #104

Merged
merged 1 commit into from
Oct 27, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,11 @@ protected byte[] buildMessage(CrawlURI curi) {
jo.put(entry.getKey(), entry.getValue());
}

jo.put("bytes_received", curi.isHttpTransaction() && curi.getContentLength() >= 0 ? curi.getContentLength() : JSONObject.NULL);
jo.put("stored_size", curi.getContentSize() > 0 ? curi.getContentSize() : JSONObject.NULL);
jo.put("content_length", curi.isHttpTransaction() && curi.getContentLength() >= 0 ? curi.getContentLength() : JSONObject.NULL);
jo.put("size", curi.getContentSize() > 0 ? curi.getContentSize() : JSONObject.NULL);

jo.put("response_code", checkForNull(curi.getFetchStatus()));
jo.put("document_url", checkForNull(curi.getUURI().toString()));
jo.put("status_code", checkForNull(curi.getFetchStatus()));
jo.put("url", checkForNull(curi.getUURI().toString()));
jo.put("hop_path", checkForNull(curi.getPathFromSeed()));
jo.put("via", checkForNull(curi.flattenVia()));
jo.put("mimetype", checkForNull(MimetypeUtils.truncate(curi.getContentType())));
Expand All @@ -129,7 +129,7 @@ protected byte[] buildMessage(CrawlURI curi) {
jo.put("start_time_plus_duration", JSONObject.NULL);
}

jo.put("payload_hash", checkForNull(curi.getContentDigestSchemeString()));
jo.put("content_digest", checkForNull(curi.getContentDigestSchemeString()));
jo.put("seed", checkForNull(curi.getSourceTag()));

CrawlHost host = getServerCache().getHostFor(curi.getUURI());
Expand All @@ -141,7 +141,13 @@ protected byte[] buildMessage(CrawlURI curi) {

jo.put("annotations", checkForNull(StringUtils.join(curi.getAnnotations(), ",")));

jo.put("extra_info", checkForNull(curi.getExtraInfo()));
JSONObject ei = curi.getExtraInfo();
if (ei == null) {
ei = new JSONObject();
}
jo.put("warc_filename", checkForNull(ei.get("warcFilename")));
jo.put("warc_offset", checkForNull(ei.get("warcOffset")));
jo.put("extra_info", ei);

String str = jo.toString();
try {
Expand Down