Skip to content

Commit

Permalink
spotless + fix compilation issue
Browse files Browse the repository at this point in the history
  • Loading branch information
pmpailis committed Oct 3, 2024
1 parent 97afb5c commit 0ebe81d
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import org.apache.lucene.index.LeafReaderContext;
import org.apache.lucene.search.BooleanClause;
import org.apache.lucene.search.BooleanQuery;
import org.apache.lucene.search.BulkScorer;
import org.apache.lucene.search.DocIdSetIterator;
import org.apache.lucene.search.Explanation;
import org.apache.lucene.search.IndexSearcher;
Expand Down Expand Up @@ -180,7 +179,6 @@ private int currentDocId() {
return docs[upTo].doc - context.docBase;
}


};
return new DefaultScorerSupplier(scorer);
}
Expand Down Expand Up @@ -328,11 +326,6 @@ public Explanation explain(LeafReaderContext context, int doc) throws IOExceptio
return topWeight.explain(context, doc);
}

@Override
public Scorer scorer(LeafReaderContext context) throws IOException {
return combinedWeight.scorer(context);
}

@Override
public boolean isCacheable(LeafReaderContext ctx) {
return combinedWeight.isCacheable(ctx);
Expand All @@ -343,11 +336,6 @@ public Matches matches(LeafReaderContext context, int doc) throws IOException {
return combinedWeight.matches(context, doc);
}

@Override
public BulkScorer bulkScorer(LeafReaderContext context) throws IOException {
return combinedWeight.bulkScorer(context);
}

@Override
public ScorerSupplier scorerSupplier(LeafReaderContext context) throws IOException {
return combinedWeight.scorerSupplier(context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ public void testRankDocsQueryEarlyTerminate() throws IOException {
// so worst case is we could end up collecting up to 1 + max(topSize , totalHitsThreshold) + rankDocs.length documents
// as we could have already filled the priority queue with non-optimal docs
assertThat(
col.totalHits.value,
col.totalHits.value(),
lessThanOrEqualTo((long) (1 + Math.max(topSize, totalHitsThreshold) + rankDocs.length))
);
assertEqualTopDocs(col.scoreDocs, rankDocs);
Expand All @@ -177,7 +177,7 @@ public void testRankDocsQueryEarlyTerminate() throws IOException {
);
var topDocsManager = new TopScoreDocCollectorManager(topSize, null, Integer.MAX_VALUE);
var col = searcher.search(q, topDocsManager);
assertThat(col.totalHits.value, equalTo((long) reader.maxDoc()));
assertThat(col.totalHits.value(), equalTo((long) reader.maxDoc()));
assertEqualTopDocs(col.scoreDocs, rankDocs);
}

Expand All @@ -192,7 +192,7 @@ public void testRankDocsQueryEarlyTerminate() throws IOException {
);
var topDocsManager = new TopScoreDocCollectorManager(topSize, null, Integer.MAX_VALUE);
var col = searcher.search(q, topDocsManager);
assertThat(col.totalHits.value, equalTo((long) topSize));
assertThat(col.totalHits.value(), equalTo((long) topSize));
assertEqualTopDocs(col.scoreDocs, rankDocs);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,8 @@ public void testRRFPagination() {
ElasticsearchAssertions.assertResponse(req, resp -> {
assertNull(resp.pointInTimeId());
assertNotNull(resp.getHits().getTotalHits());
assertThat(resp.getHits().getTotalHits().value, equalTo(6L));
assertThat(resp.getHits().getTotalHits().relation, equalTo(TotalHits.Relation.EQUAL_TO));
assertThat(resp.getHits().getTotalHits().value(), equalTo(6L));
assertThat(resp.getHits().getTotalHits().relation(), equalTo(TotalHits.Relation.EQUAL_TO));
assertThat(resp.getHits().getHits().length, lessThanOrEqualTo(size));
for (int k = 0; k < Math.min(size, resp.getHits().getHits().length); k++) {
assertThat(resp.getHits().getAt(k).getId(), equalTo(expectedDocIds.get(k + fDocs_to_fetch)));
Expand Down Expand Up @@ -232,8 +232,8 @@ public void testRRFWithAggs() {
ElasticsearchAssertions.assertResponse(req, resp -> {
assertNull(resp.pointInTimeId());
assertNotNull(resp.getHits().getTotalHits());
assertThat(resp.getHits().getTotalHits().value, equalTo(6L));
assertThat(resp.getHits().getTotalHits().relation, equalTo(TotalHits.Relation.EQUAL_TO));
assertThat(resp.getHits().getTotalHits().value(), equalTo(6L));
assertThat(resp.getHits().getTotalHits().relation(), equalTo(TotalHits.Relation.EQUAL_TO));
assertThat(resp.getHits().getHits().length, equalTo(1));
assertThat(resp.getHits().getAt(0).getId(), equalTo("doc_2"));

Expand Down Expand Up @@ -288,8 +288,8 @@ public void testRRFWithCollapse() {
ElasticsearchAssertions.assertResponse(req, resp -> {
assertNull(resp.pointInTimeId());
assertNotNull(resp.getHits().getTotalHits());
assertThat(resp.getHits().getTotalHits().value, equalTo(6L));
assertThat(resp.getHits().getTotalHits().relation, equalTo(TotalHits.Relation.EQUAL_TO));
assertThat(resp.getHits().getTotalHits().value(), equalTo(6L));
assertThat(resp.getHits().getTotalHits().relation(), equalTo(TotalHits.Relation.EQUAL_TO));
assertThat(resp.getHits().getHits().length, equalTo(4));
assertThat(resp.getHits().getAt(0).getId(), equalTo("doc_2"));
assertThat(resp.getHits().getAt(1).getId(), equalTo("doc_6"));
Expand Down Expand Up @@ -343,8 +343,8 @@ public void testRankDocsRetrieverWithCollapseAndAggs() {
ElasticsearchAssertions.assertResponse(req, resp -> {
assertNull(resp.pointInTimeId());
assertNotNull(resp.getHits().getTotalHits());
assertThat(resp.getHits().getTotalHits().value, equalTo(6L));
assertThat(resp.getHits().getTotalHits().relation, equalTo(TotalHits.Relation.EQUAL_TO));
assertThat(resp.getHits().getTotalHits().value(), equalTo(6L));
assertThat(resp.getHits().getTotalHits().relation(), equalTo(TotalHits.Relation.EQUAL_TO));
assertThat(resp.getHits().getHits().length, equalTo(4));
assertThat(resp.getHits().getAt(0).getId(), equalTo("doc_2"));
assertThat(resp.getHits().getAt(1).getId(), equalTo("doc_6"));
Expand Down Expand Up @@ -415,8 +415,8 @@ public void testMultipleRRFRetrievers() {
ElasticsearchAssertions.assertResponse(req, resp -> {
assertNull(resp.pointInTimeId());
assertNotNull(resp.getHits().getTotalHits());
assertThat(resp.getHits().getTotalHits().value, equalTo(6L));
assertThat(resp.getHits().getTotalHits().relation, equalTo(TotalHits.Relation.EQUAL_TO));
assertThat(resp.getHits().getTotalHits().value(), equalTo(6L));
assertThat(resp.getHits().getTotalHits().relation(), equalTo(TotalHits.Relation.EQUAL_TO));
assertThat(resp.getHits().getAt(0).getId(), equalTo("doc_7"));
assertThat(resp.getHits().getAt(1).getId(), equalTo("doc_2"));
assertThat(resp.getHits().getAt(2).getId(), equalTo("doc_6"));
Expand Down Expand Up @@ -464,8 +464,8 @@ public void testRRFExplainWithNamedRetrievers() {
ElasticsearchAssertions.assertResponse(req, resp -> {
assertNull(resp.pointInTimeId());
assertNotNull(resp.getHits().getTotalHits());
assertThat(resp.getHits().getTotalHits().value, equalTo(6L));
assertThat(resp.getHits().getTotalHits().relation, equalTo(TotalHits.Relation.EQUAL_TO));
assertThat(resp.getHits().getTotalHits().value(), equalTo(6L));
assertThat(resp.getHits().getTotalHits().relation(), equalTo(TotalHits.Relation.EQUAL_TO));
assertThat(resp.getHits().getHits().length, equalTo(1));
assertThat(resp.getHits().getAt(0).getId(), equalTo("doc_2"));
assertThat(resp.getHits().getAt(0).getExplanation().isMatch(), equalTo(true));
Expand Down Expand Up @@ -533,8 +533,8 @@ public void testRRFExplainWithAnotherNestedRRF() {
ElasticsearchAssertions.assertResponse(req, resp -> {
assertNull(resp.pointInTimeId());
assertNotNull(resp.getHits().getTotalHits());
assertThat(resp.getHits().getTotalHits().value, equalTo(6L));
assertThat(resp.getHits().getTotalHits().relation, equalTo(TotalHits.Relation.EQUAL_TO));
assertThat(resp.getHits().getTotalHits().value(), equalTo(6L));
assertThat(resp.getHits().getTotalHits().relation(), equalTo(TotalHits.Relation.EQUAL_TO));
assertThat(resp.getHits().getHits().length, equalTo(1));
assertThat(resp.getHits().getAt(0).getId(), equalTo("doc_6"));
assertThat(resp.getHits().getAt(0).getExplanation().isMatch(), equalTo(true));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ public void testRRFRetrieverWithNestedQuery() {
ElasticsearchAssertions.assertResponse(req, resp -> {
assertNull(resp.pointInTimeId());
assertNotNull(resp.getHits().getTotalHits());
assertThat(resp.getHits().getTotalHits().value, equalTo(4L));
assertThat(resp.getHits().getTotalHits().relation, equalTo(TotalHits.Relation.EQUAL_TO));
assertThat(resp.getHits().getTotalHits().value(), equalTo(4L));
assertThat(resp.getHits().getTotalHits().relation(), equalTo(TotalHits.Relation.EQUAL_TO));
assertThat(resp.getHits().getAt(0).getId(), equalTo("doc_6"));
assertThat(resp.getHits().getAt(1).getId(), equalTo("doc_1"));
assertThat(resp.getHits().getAt(2).getId(), equalTo("doc_2"));
Expand Down

0 comments on commit 0ebe81d

Please sign in to comment.