Skip to content

Commit

Permalink
fix previous commits
Browse files Browse the repository at this point in the history
  • Loading branch information
aberenguel committed Oct 9, 2024
1 parent 4a059aa commit bb591ab
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
3 changes: 3 additions & 0 deletions iped-app/src/main/java/iped/app/ui/ParentTableModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@
import org.apache.lucene.search.Query;
import org.apache.lucene.search.TermQuery;

import iped.data.IItem;
import iped.engine.task.index.IndexItem;
import iped.properties.BasicProps;
import iped.properties.ExtraProperties;


public class ParentTableModel extends BaseTableModel {
Expand Down
14 changes: 4 additions & 10 deletions iped-app/src/main/java/iped/app/ui/ReferencingTableModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,12 @@

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;
import org.apache.lucene.search.BooleanQuery;
import org.apache.lucene.search.Query;
import org.apache.lucene.search.TermInSetQuery;
import org.apache.lucene.search.TermQuery;
import org.apache.lucene.util.BytesRef;

import iped.engine.search.QueryBuilder;
Expand All @@ -40,6 +43,7 @@
import iped.parsers.shareaza.ShareazaLibraryDatParser;
import iped.properties.BasicProps;
import iped.properties.ExtraProperties;
import scala.annotation.meta.field;

public class ReferencingTableModel extends BaseTableModel {

Expand All @@ -61,7 +65,6 @@ public void valueChanged(ListSelectionModel lsm) {
public Query createQuery(Document doc) {
BooleanQuery.Builder queryBuilder = new BooleanQuery.Builder();

BooleanQuery.Builder queryBuilder = new BooleanQuery.Builder();
// linkedItems queries
String[] linkedItems = doc.getValues(ExtraProperties.LINKED_ITEMS);
if (linkedItems.length > 0) {
Expand Down Expand Up @@ -109,15 +112,6 @@ public Query createQuery(Document doc) {
queryBuilder.add(new TermQuery(new Term(ExtraProperties.UFED_ID, ufedFileId)), Occur.SHOULD);
}

BooleanQuery query = queryBuilder.build();

if (!query.clauses().isEmpty()) {

Set<BytesRef> hashes = Arrays.asList(sharedHashes).stream().filter(StringUtils::isNotBlank)
.map(h -> new BytesRef(h)).collect(Collectors.toSet());
queryBuilder.add(new TermInSetQuery(field, hashes), Occur.SHOULD);
}

return queryBuilder.build();
}

Expand Down

0 comments on commit bb591ab

Please sign in to comment.