diff --git a/iped-app/src/main/java/iped/app/ui/ReferencedByTableModel.java b/iped-app/src/main/java/iped/app/ui/ReferencedByTableModel.java index 339f11d6e4..ddc1e5cc17 100644 --- a/iped-app/src/main/java/iped/app/ui/ReferencedByTableModel.java +++ b/iped-app/src/main/java/iped/app/ui/ReferencedByTableModel.java @@ -19,11 +19,13 @@ package iped.app.ui; import java.util.Arrays; +import java.util.Objects; import java.util.stream.Collectors; import javax.swing.ListSelectionModel; import javax.swing.SwingUtilities; +import org.apache.commons.lang3.StringUtils; import org.apache.lucene.document.Document; import iped.data.IItem; @@ -74,7 +76,12 @@ public void listItems(Document doc) { String sha1 = doc.get(HashTask.HASH.SHA1.toString()); String sha256 = doc.get(HashTask.HASH.SHA256.toString()); String edonkey = doc.get(HashTask.HASH.EDONKEY.toString()); - String hashes = Arrays.asList(md5, sha1, sha256, edonkey).stream().filter(a -> a != null).collect(Collectors.joining(" ")); + String ufedId = doc.get(ExtraProperties.UFED_META_PREFIX + "id"); + if (StringUtils.isNotBlank(ufedId)) { + ufedId = "\"" + ufedId + "\""; + } + + String hashes = Arrays.asList(md5, sha1, sha256, edonkey).stream().filter(Objects::nonNull).collect(Collectors.joining(" ")); if (hashes.isEmpty()) { results = new LuceneSearchResult(0); diff --git a/iped-app/src/main/java/iped/app/ui/ResultTableListener.java b/iped-app/src/main/java/iped/app/ui/ResultTableListener.java index 0e0812559b..5289a6dd89 100644 --- a/iped-app/src/main/java/iped/app/ui/ResultTableListener.java +++ b/iped-app/src/main/java/iped/app/ui/ResultTableListener.java @@ -32,6 +32,7 @@ import java.text.Collator; import java.util.Arrays; import java.util.List; +import java.util.Objects; import java.util.concurrent.Executor; import java.util.concurrent.Executors; import java.util.stream.Collectors; @@ -42,6 +43,7 @@ import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; +import org.apache.commons.lang3.StringUtils; import org.apache.lucene.document.Document; import org.apache.lucene.index.Term; import org.apache.lucene.search.BooleanClause.Occur; @@ -527,8 +529,11 @@ private void selectReferencedByItems(boolean state, IItemId rootId) { String sha1 = doc.get(HashTask.HASH.SHA1.toString()); String sha256 = doc.get(HashTask.HASH.SHA256.toString()); String edonkey = doc.get(HashTask.HASH.EDONKEY.toString()); - String hashes = Arrays.asList(md5, sha1, sha256, edonkey).stream().filter(a -> a != null) - .collect(Collectors.joining(" ")); + String ufedId = doc.get(ExtraProperties.UFED_META_PREFIX + "id"); + if (StringUtils.isNotBlank(ufedId)) { + ufedId = "\"" + ufedId + "\""; + } + String hashes = Arrays.asList(md5, sha1, sha256, edonkey).stream().filter(Objects::nonNull).collect(Collectors.joining(" ")); if (hashes.isEmpty()) { return;