Program: 189404
Project: 189404
Buggy source:
/** 
 * Write a the provided submission and all associated action logs to the index writer. This method expects that the submission and action logs have been removed from the index, either through a specific delete, or a delete all in the case of rebuilding the index. This method is used to share code between the various index job implementations so that submissions are written the same no matter who indexes them first.
 * @param writer The index writer.
 * @param sub The submission to index.
 */
public void indexSubmission(IndexWriter writer,Submission sub) throws CorruptIndexException, IOException {
  StringBuilder searchText=new StringBuilder();
  long subId=sub.getId();
  String state=sub.getState().getDisplayName();
  searchText.append(state).append("String_Node_Str");
  long searchAssigned=0;
  String sortAssigned="String_Node_Str";
  if (sub.getAssignee() != null) {
    searchAssigned=sub.getAssignee().getId();
    sortAssigned=sub.getAssignee().getFormattedName(NameFormat.LAST_FIRST_MIDDLE_BIRTH);
    searchText.append(sortAssigned).append("String_Node_Str");
  }
  Date graduationSemester=null;
  if (sub.getGraduationYear() != null) {
    Calendar cal=Calendar.getInstance();
    cal.clear();
    cal.set(Calendar.YEAR,sub.getGraduationYear());
    if (sub.getGraduationMonth() != null)     cal.set(Calendar.MONTH,sub.getGraduationMonth());
    graduationSemester=cal.getTime();
  }
  String department=sub.getDepartment();
  String college=sub.getCollege();
  String major=sub.getMajor();
  searchText.append(department).append("String_Node_Str").append(college).append("String_Node_Str").append(major).append("String_Node_Str");
  String embargo=null;
  if (sub.getEmbargoType() != null) {
    embargo=sub.getEmbargoType().getName();
    searchText.append(embargo).append("String_Node_Str");
  }
  String degree=sub.getDegree();
  String documentType=sub.getDocumentType();
  searchText.append(degree).append("String_Node_Str").append(documentType).append("String_Node_Str");
  Date submissionDate=sub.getSubmissionDate();
  String studentName="String_Node_Str";
  if (sub.getStudentLastName() != null)   studentName+=sub.getStudentLastName();
  if (sub.getStudentFirstName() != null)   studentName+=sub.getStudentFirstName();
  if (sub.getStudentMiddleName() != null)   studentName+=sub.getStudentMiddleName();
  searchText.append(studentName).append("String_Node_Str");
  String studentEmail=sub.getSubmitter().getEmail();
  searchText.append(studentEmail).append("String_Node_Str");
  String institutionalIdentifier=sub.getSubmitter().getInstitutionalIdentifier();
  searchText.append(institutionalIdentifier).append("String_Node_Str");
  String documentTitle=sub.getDocumentTitle();
  String documentAbstract=sub.getDocumentAbstract();
  String documentKeywords=sub.getDocumentKeywords();
  searchText.append(documentTitle).append("String_Node_Str").append(documentAbstract).append("String_Node_Str").append(documentKeywords).append("String_Node_Str");
  String primaryDocument=null;
  if (sub.getPrimaryDocument() != null) {
    primaryDocument=sub.getPrimaryDocument().getName();
    searchText.append(primaryDocument).append("String_Node_Str");
  }
  Date licenseAgreementDate=sub.getLicenseAgreementDate();
  Date approvalDate=sub.getApprovalDate();
  Date committeeApprovalDate=sub.getCommitteeApprovalDate();
  Date committeeEmbargoApprovalDate=sub.getCommitteeEmbargoApprovalDate();
  String committeeMembers="String_Node_Str";
  for (  CommitteeMember member : sub.getCommitteeMembers()) {
    committeeMembers+=member.getLastName() + "String_Node_Str" + member.getFirstName()+ "String_Node_Str"+ member.getLastName();
  }
  searchText.append(committeeMembers).append("String_Node_Str");
  String committeeContactEmail=sub.getCommitteeContactEmail();
  searchText.append(committeeContactEmail).append("String_Node_Str");
  String umiRelease;
  if (sub.getUMIRelease() == null) {
    umiRelease="String_Node_Str";
  }
 else   if (sub.getUMIRelease()) {
    umiRelease="String_Node_Str";
  }
 else {
    umiRelease="String_Node_Str";
  }
  int customActions=0;
  for (  CustomActionValue action : sub.getCustomActions()) {
    if (action.getValue())     customActions++;
  }
  String degreeLevel=null;
  if (sub.getDegreeLevel() != null)   degreeLevel=sub.getDegreeLevel().name();
  searchText.append(degreeLevel).append("String_Node_Str");
  String depositId=sub.getDepositId();
  searchText.append(depositId).append("String_Node_Str");
  String lastEventEntry=null;
  Date lastEventTime=null;
  List<ActionLog> logs=indexer.subRepo.findActionLog(sub);
  if (logs.size() > 0) {
    lastEventEntry=logs.get(0).getEntry();
    lastEventTime=logs.get(0).getActionDate();
    searchText.append(lastEventEntry);
  }
  Document doc=new Document();
  doc.add(new NumericField("String_Node_Str",Field.Store.YES,true).setLongValue(subId));
  doc.add(new Field("String_Node_Str","String_Node_Str",Field.Store.YES,Index.NOT_ANALYZED));
  doc.add(new Field("String_Node_Str",searchText.toString(),Field.Store.NO,Index.ANALYZED_NO_NORMS));
  if (state != null)   doc.add(new Field("String_Node_Str",state,Field.Store.NO,Index.NOT_ANALYZED));
  doc.add(new NumericField("String_Node_Str",Field.Store.NO,true).setLongValue(searchAssigned));
  if (sortAssigned != null)   doc.add(new Field("String_Node_Str",sortAssigned,Field.Store.NO,Index.NOT_ANALYZED));
  if (graduationSemester != null)   doc.add(new NumericField("String_Node_Str",Field.Store.NO,true).setLongValue(graduationSemester.getTime()));
  if (department != null)   doc.add(new Field("String_Node_Str",department,Field.Store.NO,Index.NOT_ANALYZED));
  if (college != null)   doc.add(new Field("String_Node_Str",college,Field.Store.NO,Index.NOT_ANALYZED));
  if (major != null)   doc.add(new Field("String_Node_Str",major,Field.Store.NO,Index.NOT_ANALYZED));
  if (embargo != null)   doc.add(new Field("String_Node_Str",embargo,Field.Store.NO,Index.NOT_ANALYZED));
  if (degree != null)   doc.add(new Field("String_Node_Str",degree,Field.Store.NO,Index.NOT_ANALYZED));
  if (documentType != null)   doc.add(new Field("String_Node_Str",documentType,Field.Store.NO,Index.NOT_ANALYZED));
  if (submissionDate != null)   doc.add(new NumericField("String_Node_Str",Field.Store.NO,true).setLongValue(submissionDate.getTime()));
  if (studentName != null)   doc.add(new Field("String_Node_Str",studentName,Field.Store.NO,Index.NOT_ANALYZED));
  if (studentEmail != null)   doc.add(new Field("String_Node_Str",studentEmail,Field.Store.NO,Index.NOT_ANALYZED));
  if (institutionalIdentifier != null)   doc.add(new Field("String_Node_Str",institutionalIdentifier,Field.Store.NO,Index.NOT_ANALYZED));
  if (documentTitle != null)   doc.add(new Field("String_Node_Str",documentTitle,Field.Store.NO,Index.NOT_ANALYZED));
  if (documentAbstract != null)   doc.add(new Field("String_Node_Str",documentAbstract,Field.Store.NO,Index.NOT_ANALYZED));
  if (documentKeywords != null)   doc.add(new Field("String_Node_Str",documentKeywords,Field.Store.NO,Index.NOT_ANALYZED));
  if (primaryDocument != null)   doc.add(new Field("String_Node_Str",primaryDocument,Field.Store.NO,Index.NOT_ANALYZED));
  if (licenseAgreementDate != null)   doc.add(new NumericField("String_Node_Str",Field.Store.NO,true).setLongValue(licenseAgreementDate.getTime()));
  if (approvalDate != null)   doc.add(new NumericField("String_Node_Str",Field.Store.NO,true).setLongValue(approvalDate.getTime()));
  if (committeeApprovalDate != null)   doc.add(new NumericField("String_Node_Str",Field.Store.NO,true).setLongValue(committeeApprovalDate.getTime()));
  if (committeeEmbargoApprovalDate != null)   doc.add(new NumericField("String_Node_Str",Field.Store.NO,true).setLongValue(committeeEmbargoApprovalDate.getTime()));
  if (committeeMembers != null)   doc.add(new Field("String_Node_Str",committeeMembers,Field.Store.NO,Index.NOT_ANALYZED));
  if (committeeContactEmail != null)   doc.add(new Field("String_Node_Str",committeeContactEmail,Field.Store.NO,Index.NOT_ANALYZED));
  if (umiRelease != null)   doc.add(new Field("String_Node_Str",umiRelease,Field.Store.NO,Index.NOT_ANALYZED));
  doc.add(new NumericField("String_Node_Str",Field.Store.NO,true).setIntValue(customActions));
  if (degreeLevel != null)   doc.add(new Field("String_Node_Str",degreeLevel,Field.Store.NO,Index.NOT_ANALYZED));
  if (depositId != null)   doc.add(new Field("String_Node_Str",depositId,Field.Store.NO,Index.NOT_ANALYZED));
  if (lastEventEntry != null)   doc.add(new Field("String_Node_Str",lastEventEntry,Field.Store.NO,Index.NOT_ANALYZED));
  if (lastEventTime != null)   doc.add(new NumericField("String_Node_Str",Field.Store.NO,true).setLongValue(lastEventTime.getTime()));
  writer.addDocument(doc);
  for (  ActionLog log : logs) {
    Long logId=log.getId();
    String logEntry=log.getEntry();
    String logState=log.getSubmissionState().getDisplayName();
    long logSearchAssigned=0;
    String logSortAssigned=null;
    if (log.getPerson() != null) {
      logSearchAssigned=log.getPerson().getId();
      logSortAssigned=log.getPerson().getFormattedName(NameFormat.FIRST_LAST);
    }
    Date logTime=log.getActionDate();
    doc=new Document();
    doc.add(new NumericField("String_Node_Str",Field.Store.YES,true).setLongValue(subId));
    doc.add(new NumericField("String_Node_Str",Field.Store.YES,true).setLongValue(logId));
    doc.add(new Field("String_Node_Str","String_Node_Str",Field.Store.YES,Index.NOT_ANALYZED));
    if (logEntry != null)     doc.add(new Field("String_Node_Str",logEntry,Field.Store.NO,Index.ANALYZED_NO_NORMS));
    if (logState != null)     doc.add(new Field("String_Node_Str",logState,Field.Store.NO,Index.NOT_ANALYZED));
    doc.add(new NumericField("String_Node_Str",Field.Store.NO,true).setLongValue(logSearchAssigned));
    if (logSortAssigned != null)     doc.add(new Field("String_Node_Str",logSortAssigned,Field.Store.NO,Index.NOT_ANALYZED));
    if (logEntry != null)     doc.add(new Field("String_Node_Str",logEntry,Field.Store.NO,Index.NOT_ANALYZED));
    if (logTime != null)     doc.add(new NumericField("String_Node_Str",Field.Store.NO,true).setLongValue(logTime.getTime()));
    if (graduationSemester != null)     doc.add(new NumericField("String_Node_Str",Field.Store.NO,true).setLongValue(graduationSemester.getTime()));
    if (department != null)     doc.add(new Field("String_Node_Str",department,Field.Store.NO,Index.NOT_ANALYZED));
    if (college != null)     doc.add(new Field("String_Node_Str",college,Field.Store.NO,Index.NOT_ANALYZED));
    if (major != null)     doc.add(new Field("String_Node_Str",major,Field.Store.NO,Index.NOT_ANALYZED));
    if (embargo != null)     doc.add(new Field("String_Node_Str",embargo,Field.Store.NO,Index.NOT_ANALYZED));
    if (degree != null)     doc.add(new Field("String_Node_Str",degree,Field.Store.NO,Index.NOT_ANALYZED));
    if (documentType != null)     doc.add(new Field("String_Node_Str",documentType,Field.Store.NO,Index.NOT_ANALYZED));
    if (submissionDate != null)     doc.add(new NumericField("String_Node_Str",Field.Store.NO,true).setLongValue(submissionDate.getTime()));
    if (studentName != null)     doc.add(new Field("String_Node_Str",studentName,Field.Store.NO,Index.NOT_ANALYZED));
    if (studentEmail != null)     doc.add(new Field("String_Node_Str",studentEmail,Field.Store.NO,Index.NOT_ANALYZED));
    if (institutionalIdentifier != null)     doc.add(new Field("String_Node_Str",institutionalIdentifier,Field.Store.NO,Index.NOT_ANALYZED));
    if (documentAbstract != null)     doc.add(new Field("String_Node_Str",documentAbstract,Field.Store.NO,Index.NOT_ANALYZED));
    if (documentKeywords != null)     doc.add(new Field("String_Node_Str",documentKeywords,Field.Store.NO,Index.NOT_ANALYZED));
    if (primaryDocument != null)     doc.add(new Field("String_Node_Str",primaryDocument,Field.Store.NO,Index.NOT_ANALYZED));
    if (licenseAgreementDate != null)     doc.add(new NumericField("String_Node_Str",Field.Store.NO,true).setLongValue(licenseAgreementDate.getTime()));
    if (approvalDate != null)     doc.add(new NumericField("String_Node_Str",Field.Store.NO,true).setLongValue(approvalDate.getTime()));
    if (committeeApprovalDate != null)     doc.add(new NumericField("String_Node_Str",Field.Store.NO,true).setLongValue(committeeApprovalDate.getTime()));
    if (committeeEmbargoApprovalDate != null)     doc.add(new NumericField("String_Node_Str",Field.Store.NO,true).setLongValue(committeeEmbargoApprovalDate.getTime()));
    if (committeeMembers != null)     doc.add(new Field("String_Node_Str",committeeMembers,Field.Store.NO,Index.NOT_ANALYZED));
    if (committeeContactEmail != null)     doc.add(new Field("String_Node_Str",committeeContactEmail,Field.Store.NO,Index.NOT_ANALYZED));
    if (umiRelease != null)     doc.add(new Field("String_Node_Str",umiRelease,Field.Store.NO,Index.NOT_ANALYZED));
    doc.add(new NumericField("String_Node_Str",Field.Store.NO,true).setIntValue(customActions));
    if (degreeLevel != null)     doc.add(new Field("String_Node_Str",degreeLevel,Field.Store.NO,Index.NOT_ANALYZED));
    if (depositId != null)     doc.add(new Field("String_Node_Str",depositId,Field.Store.NO,Index.NOT_ANALYZED));
    writer.addDocument(doc);
    log.detach();
  }
}

Fixed version (ground truth):
/** 
 * Write a the provided submission and all associated action logs to the index writer. This method expects that the submission and action logs have been removed from the index, either through a specific delete, or a delete all in the case of rebuilding the index. This method is used to share code between the various index job implementations so that submissions are written the same no matter who indexes them first.
 * @param writer The index writer.
 * @param sub The submission to index.
 */
public void indexSubmission(IndexWriter writer,Submission sub) throws CorruptIndexException, IOException {
  StringBuilder searchText=new StringBuilder();
  long subId=sub.getId();
  String state=sub.getState().getDisplayName();
  searchText.append(state).append("String_Node_Str");
  long searchAssigned=0;
  String sortAssigned="String_Node_Str";
  if (sub.getAssignee() != null) {
    searchAssigned=sub.getAssignee().getId();
    sortAssigned=sub.getAssignee().getFormattedName(NameFormat.LAST_FIRST_MIDDLE_BIRTH);
    searchText.append(sortAssigned).append("String_Node_Str");
  }
  Date graduationSemester=null;
  if (sub.getGraduationYear() != null) {
    Calendar cal=Calendar.getInstance();
    cal.clear();
    cal.set(Calendar.YEAR,sub.getGraduationYear());
    if (sub.getGraduationMonth() != null)     cal.set(Calendar.MONTH,sub.getGraduationMonth());
    graduationSemester=cal.getTime();
  }
  String department=sub.getDepartment();
  String college=sub.getCollege();
  String major=sub.getMajor();
  searchText.append(department).append("String_Node_Str").append(college).append("String_Node_Str").append(major).append("String_Node_Str");
  String embargo=null;
  if (sub.getEmbargoType() != null) {
    embargo=sub.getEmbargoType().getName();
    searchText.append(embargo).append("String_Node_Str");
  }
  String degree=sub.getDegree();
  String documentType=sub.getDocumentType();
  searchText.append(degree).append("String_Node_Str").append(documentType).append("String_Node_Str");
  Date submissionDate=sub.getSubmissionDate();
  String studentName="String_Node_Str";
  if (sub.getStudentLastName() != null)   studentName+=sub.getStudentLastName() + "String_Node_Str";
  if (sub.getStudentFirstName() != null)   studentName+=sub.getStudentFirstName() + "String_Node_Str";
  if (sub.getStudentMiddleName() != null)   studentName+=sub.getStudentMiddleName() + "String_Node_Str";
  searchText.append(studentName).append("String_Node_Str");
  searchText.append(sub.getStudentFormattedName(NameFormat.LAST_FIRST_BIRTH)).append("String_Node_Str");
  searchText.append(sub.getStudentFormattedName(NameFormat.FIRST_LAST_BIRTH)).append("String_Node_Str");
  String studentEmail=sub.getSubmitter().getEmail();
  searchText.append(studentEmail).append("String_Node_Str");
  String institutionalIdentifier=sub.getSubmitter().getInstitutionalIdentifier();
  searchText.append(institutionalIdentifier).append("String_Node_Str");
  String documentTitle=sub.getDocumentTitle();
  String documentAbstract=sub.getDocumentAbstract();
  String documentKeywords=sub.getDocumentKeywords();
  searchText.append(documentTitle).append("String_Node_Str").append(documentAbstract).append("String_Node_Str").append(documentKeywords).append("String_Node_Str");
  String primaryDocument=null;
  if (sub.getPrimaryDocument() != null) {
    primaryDocument=sub.getPrimaryDocument().getName();
    searchText.append(primaryDocument).append("String_Node_Str");
  }
  Date licenseAgreementDate=sub.getLicenseAgreementDate();
  Date approvalDate=sub.getApprovalDate();
  Date committeeApprovalDate=sub.getCommitteeApprovalDate();
  Date committeeEmbargoApprovalDate=sub.getCommitteeEmbargoApprovalDate();
  String committeeMembers="String_Node_Str";
  for (  CommitteeMember member : sub.getCommitteeMembers()) {
    committeeMembers+=member.getLastName() + "String_Node_Str" + member.getFirstName()+ "String_Node_Str"+ member.getLastName();
  }
  searchText.append(committeeMembers).append("String_Node_Str");
  String committeeContactEmail=sub.getCommitteeContactEmail();
  searchText.append(committeeContactEmail).append("String_Node_Str");
  String umiRelease;
  if (sub.getUMIRelease() == null) {
    umiRelease="String_Node_Str";
  }
 else   if (sub.getUMIRelease()) {
    umiRelease="String_Node_Str";
  }
 else {
    umiRelease="String_Node_Str";
  }
  int customActions=0;
  for (  CustomActionValue action : sub.getCustomActions()) {
    if (action.getValue())     customActions++;
  }
  String degreeLevel=null;
  if (sub.getDegreeLevel() != null)   degreeLevel=sub.getDegreeLevel().name();
  searchText.append(degreeLevel).append("String_Node_Str");
  String depositId=sub.getDepositId();
  searchText.append(depositId).append("String_Node_Str");
  String lastEventEntry=null;
  Date lastEventTime=null;
  List<ActionLog> logs=indexer.subRepo.findActionLog(sub);
  if (logs.size() > 0) {
    lastEventEntry=logs.get(0).getEntry();
    lastEventTime=logs.get(0).getActionDate();
    searchText.append(lastEventEntry);
  }
  Document doc=new Document();
  doc.add(new NumericField("String_Node_Str",Field.Store.YES,true).setLongValue(subId));
  doc.add(new Field("String_Node_Str","String_Node_Str",Field.Store.YES,Index.NOT_ANALYZED));
  doc.add(new Field("String_Node_Str",searchText.toString(),Field.Store.NO,Index.ANALYZED_NO_NORMS));
  if (state != null)   doc.add(new Field("String_Node_Str",state,Field.Store.NO,Index.NOT_ANALYZED));
  doc.add(new NumericField("String_Node_Str",Field.Store.NO,true).setLongValue(searchAssigned));
  if (sortAssigned != null)   doc.add(new Field("String_Node_Str",sortAssigned,Field.Store.NO,Index.NOT_ANALYZED));
  if (graduationSemester != null)   doc.add(new NumericField("String_Node_Str",Field.Store.NO,true).setLongValue(graduationSemester.getTime()));
  if (department != null)   doc.add(new Field("String_Node_Str",department,Field.Store.NO,Index.NOT_ANALYZED));
  if (college != null)   doc.add(new Field("String_Node_Str",college,Field.Store.NO,Index.NOT_ANALYZED));
  if (major != null)   doc.add(new Field("String_Node_Str",major,Field.Store.NO,Index.NOT_ANALYZED));
  if (embargo != null)   doc.add(new Field("String_Node_Str",embargo,Field.Store.NO,Index.NOT_ANALYZED));
  if (degree != null)   doc.add(new Field("String_Node_Str",degree,Field.Store.NO,Index.NOT_ANALYZED));
  if (documentType != null)   doc.add(new Field("String_Node_Str",documentType,Field.Store.NO,Index.NOT_ANALYZED));
  if (submissionDate != null)   doc.add(new NumericField("String_Node_Str",Field.Store.NO,true).setLongValue(submissionDate.getTime()));
  if (studentName != null)   doc.add(new Field("String_Node_Str",studentName,Field.Store.NO,Index.NOT_ANALYZED));
  if (studentEmail != null)   doc.add(new Field("String_Node_Str",studentEmail,Field.Store.NO,Index.NOT_ANALYZED));
  if (institutionalIdentifier != null)   doc.add(new Field("String_Node_Str",institutionalIdentifier,Field.Store.NO,Index.NOT_ANALYZED));
  if (documentTitle != null)   doc.add(new Field("String_Node_Str",documentTitle,Field.Store.NO,Index.NOT_ANALYZED));
  if (documentAbstract != null)   doc.add(new Field("String_Node_Str",documentAbstract,Field.Store.NO,Index.NOT_ANALYZED));
  if (documentKeywords != null)   doc.add(new Field("String_Node_Str",documentKeywords,Field.Store.NO,Index.NOT_ANALYZED));
  if (primaryDocument != null)   doc.add(new Field("String_Node_Str",primaryDocument,Field.Store.NO,Index.NOT_ANALYZED));
  if (licenseAgreementDate != null)   doc.add(new NumericField("String_Node_Str",Field.Store.NO,true).setLongValue(licenseAgreementDate.getTime()));
  if (approvalDate != null)   doc.add(new NumericField("String_Node_Str",Field.Store.NO,true).setLongValue(approvalDate.getTime()));
  if (committeeApprovalDate != null)   doc.add(new NumericField("String_Node_Str",Field.Store.NO,true).setLongValue(committeeApprovalDate.getTime()));
  if (committeeEmbargoApprovalDate != null)   doc.add(new NumericField("String_Node_Str",Field.Store.NO,true).setLongValue(committeeEmbargoApprovalDate.getTime()));
  if (committeeMembers != null)   doc.add(new Field("String_Node_Str",committeeMembers,Field.Store.NO,Index.NOT_ANALYZED));
  if (committeeContactEmail != null)   doc.add(new Field("String_Node_Str",committeeContactEmail,Field.Store.NO,Index.NOT_ANALYZED));
  if (umiRelease != null)   doc.add(new Field("String_Node_Str",umiRelease,Field.Store.NO,Index.NOT_ANALYZED));
  doc.add(new NumericField("String_Node_Str",Field.Store.NO,true).setIntValue(customActions));
  if (degreeLevel != null)   doc.add(new Field("String_Node_Str",degreeLevel,Field.Store.NO,Index.NOT_ANALYZED));
  if (depositId != null)   doc.add(new Field("String_Node_Str",depositId,Field.Store.NO,Index.NOT_ANALYZED));
  if (lastEventEntry != null)   doc.add(new Field("String_Node_Str",lastEventEntry,Field.Store.NO,Index.NOT_ANALYZED));
  if (lastEventTime != null)   doc.add(new NumericField("String_Node_Str",Field.Store.NO,true).setLongValue(lastEventTime.getTime()));
  writer.addDocument(doc);
  for (  ActionLog log : logs) {
    Long logId=log.getId();
    String logEntry=log.getEntry();
    String logState=log.getSubmissionState().getDisplayName();
    long logSearchAssigned=0;
    String logSortAssigned=null;
    if (log.getPerson() != null) {
      logSearchAssigned=log.getPerson().getId();
      logSortAssigned=log.getPerson().getFormattedName(NameFormat.FIRST_LAST);
    }
    Date logTime=log.getActionDate();
    doc=new Document();
    doc.add(new NumericField("String_Node_Str",Field.Store.YES,true).setLongValue(subId));
    doc.add(new NumericField("String_Node_Str",Field.Store.YES,true).setLongValue(logId));
    doc.add(new Field("String_Node_Str","String_Node_Str",Field.Store.YES,Index.NOT_ANALYZED));
    if (logEntry != null)     doc.add(new Field("String_Node_Str",logEntry,Field.Store.NO,Index.ANALYZED_NO_NORMS));
    if (logState != null)     doc.add(new Field("String_Node_Str",logState,Field.Store.NO,Index.NOT_ANALYZED));
    doc.add(new NumericField("String_Node_Str",Field.Store.NO,true).setLongValue(logSearchAssigned));
    if (logSortAssigned != null)     doc.add(new Field("String_Node_Str",logSortAssigned,Field.Store.NO,Index.NOT_ANALYZED));
    if (logEntry != null)     doc.add(new Field("String_Node_Str",logEntry,Field.Store.NO,Index.NOT_ANALYZED));
    if (logTime != null)     doc.add(new NumericField("String_Node_Str",Field.Store.NO,true).setLongValue(logTime.getTime()));
    if (graduationSemester != null)     doc.add(new NumericField("String_Node_Str",Field.Store.NO,true).setLongValue(graduationSemester.getTime()));
    if (department != null)     doc.add(new Field("String_Node_Str",department,Field.Store.NO,Index.NOT_ANALYZED));
    if (college != null)     doc.add(new Field("String_Node_Str",college,Field.Store.NO,Index.NOT_ANALYZED));
    if (major != null)     doc.add(new Field("String_Node_Str",major,Field.Store.NO,Index.NOT_ANALYZED));
    if (embargo != null)     doc.add(new Field("String_Node_Str",embargo,Field.Store.NO,Index.NOT_ANALYZED));
    if (degree != null)     doc.add(new Field("String_Node_Str",degree,Field.Store.NO,Index.NOT_ANALYZED));
    if (documentType != null)     doc.add(new Field("String_Node_Str",documentType,Field.Store.NO,Index.NOT_ANALYZED));
    if (submissionDate != null)     doc.add(new NumericField("String_Node_Str",Field.Store.NO,true).setLongValue(submissionDate.getTime()));
    if (studentName != null)     doc.add(new Field("String_Node_Str",studentName,Field.Store.NO,Index.NOT_ANALYZED));
    if (studentEmail != null)     doc.add(new Field("String_Node_Str",studentEmail,Field.Store.NO,Index.NOT_ANALYZED));
    if (institutionalIdentifier != null)     doc.add(new Field("String_Node_Str",institutionalIdentifier,Field.Store.NO,Index.NOT_ANALYZED));
    if (documentAbstract != null)     doc.add(new Field("String_Node_Str",documentAbstract,Field.Store.NO,Index.NOT_ANALYZED));
    if (documentKeywords != null)     doc.add(new Field("String_Node_Str",documentKeywords,Field.Store.NO,Index.NOT_ANALYZED));
    if (primaryDocument != null)     doc.add(new Field("String_Node_Str",primaryDocument,Field.Store.NO,Index.NOT_ANALYZED));
    if (licenseAgreementDate != null)     doc.add(new NumericField("String_Node_Str",Field.Store.NO,true).setLongValue(licenseAgreementDate.getTime()));
    if (approvalDate != null)     doc.add(new NumericField("String_Node_Str",Field.Store.NO,true).setLongValue(approvalDate.getTime()));
    if (committeeApprovalDate != null)     doc.add(new NumericField("String_Node_Str",Field.Store.NO,true).setLongValue(committeeApprovalDate.getTime()));
    if (committeeEmbargoApprovalDate != null)     doc.add(new NumericField("String_Node_Str",Field.Store.NO,true).setLongValue(committeeEmbargoApprovalDate.getTime()));
    if (committeeMembers != null)     doc.add(new Field("String_Node_Str",committeeMembers,Field.Store.NO,Index.NOT_ANALYZED));
    if (committeeContactEmail != null)     doc.add(new Field("String_Node_Str",committeeContactEmail,Field.Store.NO,Index.NOT_ANALYZED));
    if (umiRelease != null)     doc.add(new Field("String_Node_Str",umiRelease,Field.Store.NO,Index.NOT_ANALYZED));
    doc.add(new NumericField("String_Node_Str",Field.Store.NO,true).setIntValue(customActions));
    if (degreeLevel != null)     doc.add(new Field("String_Node_Str",degreeLevel,Field.Store.NO,Index.NOT_ANALYZED));
    if (depositId != null)     doc.add(new Field("String_Node_Str",depositId,Field.Store.NO,Index.NOT_ANALYZED));
    writer.addDocument(doc);
    log.detach();
  }
}