示例#1
0
 private void setCrawlDate(String d) {
   if (d == null) return;
   try {
     crawlDate = dateFormat.parse(d).getTime();
   } catch (ParseException e) {
     Logging.warn(e.getMessage());
   }
 }
示例#2
0
  @Override
  public void populate(IndexDocument indexDocument) {
    super.populate(indexDocument);

    if (repository != null)
      indexDocument.setString(FileItemFieldEnum.INSTANCE.repository.getName(), repository);

    indexDocument.setString(FileItemFieldEnum.INSTANCE.uri.getName(), getUri());

    if (directory != null)
      indexDocument.setString(FileItemFieldEnum.INSTANCE.directory.getName(), directory);

    if (host != null) indexDocument.setString(FileItemFieldEnum.INSTANCE.host.getName(), host);

    indexDocument.setStringList(
        FileItemFieldEnum.INSTANCE.subDirectory.getName(), getSubDirectory());

    if (crawlDate != null)
      indexDocument.setString(
          FileItemFieldEnum.INSTANCE.crawlDate.getName(), dateFormat.format(crawlDate));

    if (lang != null) indexDocument.setString(FileItemFieldEnum.INSTANCE.lang.getName(), lang);
    if (langMethod != null)
      indexDocument.setString(FileItemFieldEnum.INSTANCE.langMethod.getName(), langMethod);

    if (parser != null)
      indexDocument.setString(FileItemFieldEnum.INSTANCE.parser.getName(), parser);
    if (time != null)
      indexDocument.setString(
          FileItemFieldEnum.INSTANCE.time.getName(), contentLengthFormat.format(time));

    indexDocument.setStringList(FileItemFieldEnum.INSTANCE.userAllow.getName(), getUserAllow());
    indexDocument.setStringList(FileItemFieldEnum.INSTANCE.userDeny.getName(), getUserDeny());
    indexDocument.setStringList(FileItemFieldEnum.INSTANCE.groupAllow.getName(), getGroupAllow());
    indexDocument.setStringList(FileItemFieldEnum.INSTANCE.groupDeny.getName(), getGroupDeny());
  }