Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
derreisende77 committed Oct 26, 2024
1 parent 8e74ce7 commit ebf02a9
Showing 1 changed file with 8 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ private TModelFilm performTableFiltering() {
}
final ObservableList<String> selectedSenders = filterActionPanel.getViewSettingsPane().senderCheckList.getCheckModel().getCheckedItems();
if (!selectedSenders.isEmpty()) {
addSenderFilterQuery(qb, analyzer, selectedSenders);
addSenderFilterQuery(qb, selectedSenders);
}

//the complete lucene query...
Expand Down Expand Up @@ -170,18 +170,15 @@ private TModelFilm performTableFiltering() {
}
}

private void addSenderFilterQuery(@NotNull BooleanQuery.Builder qb, @NotNull StandardAnalyzer analyzer, @NotNull List<String> selectedSenders) throws ParseException {
//TODO use Query classes here
//#(+sender:(3sat ARTE.EN))
StringBuilder sb = new StringBuilder();
sb.append("+sender:(");
private void addSenderFilterQuery(@NotNull BooleanQuery.Builder qb, @NotNull List<String> selectedSenders) {
BooleanQuery.Builder booleanQuery = new BooleanQuery.Builder();
for (var sender : selectedSenders) {
sb.append(sender);
sb.append(" ");
// sender must be lowercase as StandardAnalyzer converts it to lower during indexing
TermQuery term = new TermQuery(new Term(LuceneIndexKeys.SENDER, sender.toLowerCase()));
booleanQuery.add(term, BooleanClause.Occur.SHOULD);
}
sb.append(")");
var q = new QueryParser(LuceneIndexKeys.SENDER, analyzer).parse(sb.toString());
qb.add(q, BooleanClause.Occur.FILTER);

qb.add(booleanQuery.build(), BooleanClause.Occur.FILTER);
}

private void addSubtitleOnlyQuery(@NotNull BooleanQuery.Builder qb) {
Expand Down

0 comments on commit ebf02a9

Please sign in to comment.