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 9f1451549..ebee464c2 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 @@ -17,14 +17,12 @@ import org.apache.logging.log4j.Logger; import org.apache.lucene.analysis.standard.StandardAnalyzer; import org.apache.lucene.document.DateTools; +import org.apache.lucene.index.Term; import org.apache.lucene.queryparser.classic.ParseException; import org.apache.lucene.queryparser.classic.QueryParser; import org.apache.lucene.queryparser.flexible.standard.StandardQueryParser; import org.apache.lucene.queryparser.flexible.standard.config.PointsConfig; -import org.apache.lucene.search.BooleanClause; -import org.apache.lucene.search.BooleanQuery; -import org.apache.lucene.search.IndexSearcher; -import org.apache.lucene.search.Query; +import org.apache.lucene.search.*; import org.jetbrains.annotations.NotNull; import javax.swing.*; @@ -110,10 +108,10 @@ private TModelFilm performTableFiltering() { } } if (filterActionPanel.isShowLivestreamsOnly()) { - addLivestreamQuery(qb, analyzer); + addLivestreamQuery(qb); } if (filterActionPanel.isShowOnlyHighQuality()) { - addHighQualityOnlyQuery(qb, analyzer); + addHighQualityOnlyQuery(qb); } if (filterActionPanel.isDontShowTrailers()) { addNoTrailerTeaserQuery(qb, analyzer); @@ -144,10 +142,9 @@ private TModelFilm performTableFiltering() { logger.info("Executing Lucene query: {}", finalQuery.toString()); //SEARCH - final var searcher = new IndexSearcher(listeFilme.getReader(), vexec); + final var searcher = new IndexSearcher(listeFilme.getReader()); final var docs = searcher.search(finalQuery, listeFilme.size()); - final var hits = docs.scoreDocs; - final var hit_length = hits.length; + final var hit_length = docs.scoreDocs.length; var watch2 = Stopwatch.createStarted(); Set filmNrSet = new HashSet<>(hit_length); @@ -155,7 +152,7 @@ private TModelFilm performTableFiltering() { logger.trace("Populating film list"); logger.trace("Hit size: {}", hit_length); var storedFields = searcher.storedFields(); - for (final var hit : hits) { + for (final var hit : docs.scoreDocs) { var docId = hit.doc; //storedFields.prefetch(docId); var d = storedFields.document(docId, INTEREST_SET); @@ -241,13 +238,13 @@ private void addNewOnlyQuery(@NotNull BooleanQuery.Builder qb, @NotNull Standard qb.add(q, BooleanClause.Occur.FILTER); } - private void addLivestreamQuery(@NotNull BooleanQuery.Builder qb, @NotNull StandardAnalyzer analyzer) throws ParseException { - var q = new QueryParser(LuceneIndexKeys.LIVESTREAM, analyzer).parse("\"true\""); + private void addLivestreamQuery(@NotNull BooleanQuery.Builder qb) { + var q = new TermQuery(new Term(LuceneIndexKeys.LIVESTREAM, "true")); qb.add(q, BooleanClause.Occur.FILTER); } - private void addHighQualityOnlyQuery(@NotNull BooleanQuery.Builder qb, @NotNull StandardAnalyzer analyzer) throws ParseException { - var q = new QueryParser(LuceneIndexKeys.HIGH_QUALITY, analyzer).parse("\"true\""); + private void addHighQualityOnlyQuery(@NotNull BooleanQuery.Builder qb) { + var q = new TermQuery(new Term(LuceneIndexKeys.HIGH_QUALITY, "true")); qb.add(q, BooleanClause.Occur.FILTER); }