diff --git a/src/main/java/mediathek/gui/tabs/tab_film/helpers/LuceneGuiFilmeModelHelper.java b/src/main/java/mediathek/gui/tabs/tab_film/helpers/LuceneGuiFilmeModelHelper.java index 0681e5cc8..905c09047 100644 --- a/src/main/java/mediathek/gui/tabs/tab_film/helpers/LuceneGuiFilmeModelHelper.java +++ b/src/main/java/mediathek/gui/tabs/tab_film/helpers/LuceneGuiFilmeModelHelper.java @@ -111,7 +111,7 @@ private TModelFilm performTableFiltering() { } final ObservableList selectedSenders = filterActionPanel.getViewSettingsPane().senderCheckList.getCheckModel().getCheckedItems(); if (!selectedSenders.isEmpty()) { - addSenderFilterQuery(qb, analyzer, selectedSenders); + addSenderFilterQuery(qb, selectedSenders); } //the complete lucene query... @@ -170,18 +170,15 @@ private TModelFilm performTableFiltering() { } } - private void addSenderFilterQuery(@NotNull BooleanQuery.Builder qb, @NotNull StandardAnalyzer analyzer, @NotNull List 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 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) {