Skip to content

Commit

Permalink
sepinf-inc#2286: support for counting the number of participants and …
Browse files Browse the repository at this point in the history
…admins
  • Loading branch information
aberenguel committed Aug 9, 2024
1 parent 106eb23 commit a5270b0
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions iped-engine/src/main/java/iped/engine/task/index/IndexItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ public class IndexItem extends BasicProps {

static HashSet<String> ignoredMetadata = new HashSet<String>();

static HashSet<String> countMetadata = new HashSet<String>();

private static Map<String, SeekableInputStreamFactory> inputStreamFactories = new HashMap<>();

private static Map<String, Class<?>> typesMap = MetadataUtil.getMetadataTypes();
Expand Down Expand Up @@ -154,6 +156,9 @@ public class IndexItem extends BasicProps {
// ocrCharCount is already copied to an extra attribute
ignoredMetadata.add(OCRParser.OCR_CHAR_COUNT);

countMetadata.add(ExtraProperties.PARTICIPANTS);
countMetadata.add(ExtraProperties.COMMUNICATION_ADMINS);

BasicProps.SET.add(ID_IN_SOURCE);
BasicProps.SET.add(SOURCE_PATH);
BasicProps.SET.add(SOURCE_DECODER);
Expand Down Expand Up @@ -676,6 +681,11 @@ private static void addMetadataToDoc(Document doc, Metadata metadata, Set<TimeSt
addMetadataKeyToDoc(doc, key, val, isMultiValued, mimetype, timeEventSet);
}

if (countMetadata.contains(key)) {
String newKey = key + ":count";
MetadataUtil.setMetadataType(newKey, Integer.class);
addExtraAttributeToDoc(doc, newKey, metadata.getValues(key).length, false, timeEventSet);
}
}
}

Expand Down

0 comments on commit a5270b0

Please sign in to comment.