Skip to content

Commit

Permalink
spotless fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
vigyasharma committed Feb 14, 2022
1 parent 36ae3ef commit 3d82ca1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,12 @@ public void visit(QueryVisitor visitor) {
@Override
public Query rewrite(IndexReader reader) throws IOException {
int rewritableReaders = 0;
for (LeafReaderContext context: reader.leaves()) {
for (LeafReaderContext context : reader.leaves()) {
LeafReader leaf = context.reader();
Terms terms = leaf.terms(field);
PointValues pointValues = leaf.getPointValues(field);
if ((terms != null && terms.getDocCount() == leaf.maxDoc()) ||
(pointValues != null && pointValues.getDocCount() == leaf.maxDoc())) {
if ((terms != null && terms.getDocCount() == leaf.maxDoc())
|| (pointValues != null && pointValues.getDocCount() == leaf.maxDoc())) {
rewritableReaders++;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package org.apache.lucene.search;

import java.io.IOException;

import org.apache.lucene.document.BinaryPoint;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field.Store;
Expand Down Expand Up @@ -102,8 +101,10 @@ public void testNoRewrite() throws IOException {
final IndexReader reader = iw.getReader();
iw.close();

assertFalse((new DocValuesFieldExistsQuery("dim")).rewrite(reader) instanceof MatchAllDocsQuery);
assertFalse((new DocValuesFieldExistsQuery("f")).rewrite(reader) instanceof MatchAllDocsQuery);
assertFalse(
(new DocValuesFieldExistsQuery("dim")).rewrite(reader) instanceof MatchAllDocsQuery);
assertFalse(
(new DocValuesFieldExistsQuery("f")).rewrite(reader) instanceof MatchAllDocsQuery);
reader.close();
dir.close();
}
Expand All @@ -123,9 +124,12 @@ public void testNoRewriteWithDocValues() throws IOException {
final IndexReader reader = iw.getReader();
iw.close();

assertFalse((new DocValuesFieldExistsQuery("dv1")).rewrite(reader) instanceof MatchAllDocsQuery);
assertFalse((new DocValuesFieldExistsQuery("dv2")).rewrite(reader) instanceof MatchAllDocsQuery);
assertFalse((new DocValuesFieldExistsQuery("dv3")).rewrite(reader) instanceof MatchAllDocsQuery);
assertFalse(
(new DocValuesFieldExistsQuery("dv1")).rewrite(reader) instanceof MatchAllDocsQuery);
assertFalse(
(new DocValuesFieldExistsQuery("dv2")).rewrite(reader) instanceof MatchAllDocsQuery);
assertFalse(
(new DocValuesFieldExistsQuery("dv3")).rewrite(reader) instanceof MatchAllDocsQuery);
reader.close();
dir.close();
}
Expand Down

0 comments on commit 3d82ca1

Please sign in to comment.