當前位置: 首頁>>代碼示例>>Java>>正文


Java HdfsFileFieldNames類代碼示例

本文整理匯總了Java中org.apache.solr.hadoop.HdfsFileFieldNames的典型用法代碼示例。如果您正苦於以下問題:Java HdfsFileFieldNames類的具體用法?Java HdfsFileFieldNames怎麽用?Java HdfsFileFieldNames使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


HdfsFileFieldNames類屬於org.apache.solr.hadoop包,在下文中一共展示了HdfsFileFieldNames類的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getRecord

import org.apache.solr.hadoop.HdfsFileFieldNames; //導入依賴的package包/類
protected Record getRecord(PathParts parts) {
  FileStatus stats;
  try {
    stats = parts.getFileStatus();
  } catch (IOException e) {
    stats = null;
  }
  if (stats == null) {
    LOG.warn("Ignoring file that somehow has become unavailable since the job was submitted: {}",
        parts.getUploadURL());
    return null;
  }
  
  Record headers = new Record();
  //headers.put(getSchema().getUniqueKeyField().getName(), parts.getId()); // use HDFS file path as docId if no docId is specified
  headers.put(Fields.BASE_ID, parts.getId()); // with sanitizeUniqueKey command, use HDFS file path as docId if no docId is specified
  headers.put(Fields.ATTACHMENT_NAME, parts.getName()); // Tika can use the file name in guessing the right MIME type
  
  // enable indexing and storing of file meta data in Solr
  headers.put(HdfsFileFieldNames.FILE_UPLOAD_URL, parts.getUploadURL());
  headers.put(HdfsFileFieldNames.FILE_DOWNLOAD_URL, parts.getDownloadURL());
  headers.put(HdfsFileFieldNames.FILE_SCHEME, parts.getScheme()); 
  headers.put(HdfsFileFieldNames.FILE_HOST, parts.getHost()); 
  headers.put(HdfsFileFieldNames.FILE_PORT, String.valueOf(parts.getPort())); 
  headers.put(HdfsFileFieldNames.FILE_PATH, parts.getURIPath()); 
  headers.put(HdfsFileFieldNames.FILE_NAME, parts.getName());     
  headers.put(HdfsFileFieldNames.FILE_LAST_MODIFIED, String.valueOf(stats.getModificationTime())); // FIXME also add in SpoolDirectorySource
  headers.put(HdfsFileFieldNames.FILE_LENGTH, String.valueOf(stats.getLen())); // FIXME also add in SpoolDirectorySource
  headers.put(HdfsFileFieldNames.FILE_OWNER, stats.getOwner());
  headers.put(HdfsFileFieldNames.FILE_GROUP, stats.getGroup());
  headers.put(HdfsFileFieldNames.FILE_PERMISSIONS_USER, stats.getPermission().getUserAction().SYMBOL);
  headers.put(HdfsFileFieldNames.FILE_PERMISSIONS_GROUP, stats.getPermission().getGroupAction().SYMBOL);
  headers.put(HdfsFileFieldNames.FILE_PERMISSIONS_OTHER, stats.getPermission().getOtherAction().SYMBOL);
  headers.put(HdfsFileFieldNames.FILE_PERMISSIONS_STICKYBIT, String.valueOf(stats.getPermission().getStickyBit()));
  // TODO: consider to add stats.getAccessTime(), stats.getReplication(), stats.isSymlink(), stats.getBlockSize()
  
  return headers;
}
 
開發者ID:europeana,項目名稱:search,代碼行數:39,代碼來源:MorphlineMapRunner.java


注:本文中的org.apache.solr.hadoop.HdfsFileFieldNames類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。