Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
derreisende77 committed Oct 25, 2024
1 parent ba80ec9 commit a761593
Showing 1 changed file with 11 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.*;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -144,18 +142,17 @@ 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<Integer> filmNrSet = new HashSet<>(hit_length);

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);
Expand Down Expand Up @@ -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);
}

Expand Down

0 comments on commit a761593

Please sign in to comment.