当前位置: 首页>>代码示例>>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;未经允许,请勿转载。