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

made changes to count an mbox as one file #428

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
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 @@ -33,6 +33,7 @@ public class DiscoveryFile {
private boolean hasAttachments;
private boolean hasParent;
private String custodian;
private boolean isPartOfMbox;

/**
* Constructor with two parameters and the rest defaults: no attachments or parents.
Expand Down Expand Up @@ -175,4 +176,12 @@ public String getCustodian() {
public void setCustodian(String custodian) {
this.custodian = custodian;
}

public boolean isPartOfMbox() {
return isPartOfMbox;
}

public void setPartOfMbox(boolean partOfMbox) {
isPartOfMbox = partOfMbox;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,9 @@ private void writeMetadata(DiscoveryFile discoveryFile, DocumentMetadata metadat
throws IOException, InterruptedException {
Map<String, String> mapWritable = createMapWritable(metadata, discoveryFile);
metadataWriter.processMap(mapWritable,discoveryFile);
Stats.getInstance().increaseItemCount();
if(!discoveryFile.isPartOfMbox()) {
Stats.getInstance().increaseItemCount();
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,20 +210,22 @@ private void processZipEntry(ZipInputStream zipInputStream, ZipEntry zipEntry) t
// this file can be mbox file and the file can be extracted and processed separately
if(tempFile.endsWith(".mbox")){
List<String> emailFiles = MboxToEmlConverter.convertMboxToEml(tempFile, "/tmp/mboxfiles");
for (String eml : emailFiles) {
processSingleFile(eml, eml);
for (int i = 0; i < emailFiles.size(); i++) {
processSingleFile(emailFiles.get(i), emailFiles.get(i), i>0);
}
Util.deleteDirectory(new File("/tmp/mboxfiles")); // keep it clean for next processing
}else {
processSingleFile(tempFile, zipEntry.getName());
processSingleFile(tempFile, zipEntry.getName(), false);
}
}

private void processSingleFile(String tempFile, String fileName) throws Exception {
private void processSingleFile(String tempFile, String fileName, boolean isMboxFile) throws Exception {
if (PstProcessor.isPST(tempFile)) {
new PstProcessor(tempFile, metadataWriter, getLuceneIndex()).process();
} else {
processFileEntry(new DiscoveryFile(tempFile, fileName));
DiscoveryFile file = new DiscoveryFile(tempFile, fileName);
file.setPartOfMbox(isMboxFile);
processFileEntry(file);
}
}

Expand Down