You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by dw...@apache.org on 2020/12/23 11:44:29 UTC

[lucene-solr] branch jira/LUCENE-9570 created (now 6af9a8f)

This is an automated email from the ASF dual-hosted git repository.

dweiss pushed a change to branch jira/LUCENE-9570
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git.


      at 6af9a8f  Merge branch 'master' into jira/LUCENE-9570

This branch includes the following new commits:

     new ef62fba  Add remaining Lucene modules so that it's known how much work is left.
     new c405405  :lucene:core - src/**/org/apache/lucene/document/**
     new 7c771be  :lucene:core - src/**/org/apache/lucene/search/**
     new 5bbe1f0  :lucene:core - src/**
     new 8b76dd4  Simplify includes a bit.
     new 1674bb0  Workaround for an apparent javac bug.
     new 61146b3  End tag for dd is optional.
     new 36dd8b0  Merge remote-tracking branch 'origin/master' into jira/LUCENE-9570
     new f0e7225  Merge branch 'master' into jira/LUCENE-9570
     new b376b1b  Correct extra * in javadoc.
     new 6af9a8f  Merge branch 'master' into jira/LUCENE-9570

The 11 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[lucene-solr] 09/11: Merge branch 'master' into jira/LUCENE-9570

Posted by dw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

dweiss pushed a commit to branch jira/LUCENE-9570
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git

commit f0e722546c78a4891aaed2a843776eb2620acb9f
Merge: 36dd8b0 8c234b2
Author: Dawid Weiss <da...@carrotsearch.com>
AuthorDate: Wed Dec 23 12:42:26 2020 +0100

    Merge branch 'master' into jira/LUCENE-9570

 .git-blame-ignore-revs | 1 +
 1 file changed, 1 insertion(+)


[lucene-solr] 03/11: :lucene:core - src/**/org/apache/lucene/search/**

Posted by dw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

dweiss pushed a commit to branch jira/LUCENE-9570
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git

commit 7c771bece49eee9a6da00de47cf8e65a3c5c7f43
Author: Dawid Weiss <da...@carrotsearch.com>
AuthorDate: Wed Dec 23 11:02:18 2020 +0100

    :lucene:core - src/**/org/apache/lucene/search/**
---
 gradle/validation/spotless.gradle                  |   2 +-
 .../org/apache/lucene/search/AutomatonQuery.java   | 101 +--
 .../org/apache/lucene/search/BlendedTermQuery.java | 139 +--
 .../lucene/search/BlockMaxConjunctionScorer.java   |  20 +-
 .../org/apache/lucene/search/BlockMaxDISI.java     |  10 +-
 .../lucene/search/Boolean2ScorerSupplier.java      | 104 ++-
 .../org/apache/lucene/search/BooleanClause.java    |  75 +-
 .../org/apache/lucene/search/BooleanQuery.java     | 199 ++---
 .../org/apache/lucene/search/BooleanScorer.java    |  74 +-
 .../org/apache/lucene/search/BooleanWeight.java    | 102 ++-
 .../org/apache/lucene/search/BoostAttribute.java   |  22 +-
 .../apache/lucene/search/BoostAttributeImpl.java   |   9 +-
 .../java/org/apache/lucene/search/BoostQuery.java  |  39 +-
 .../java/org/apache/lucene/search/BulkScorer.java  |  71 +-
 .../org/apache/lucene/search/CachingCollector.java | 128 ++-
 .../apache/lucene/search/CollectionStatistics.java | 124 +--
 .../search/CollectionTerminatedException.java      |  16 +-
 .../java/org/apache/lucene/search/Collector.java   |  61 +-
 .../org/apache/lucene/search/CollectorManager.java |  35 +-
 .../org/apache/lucene/search/ConjunctionDISI.java  | 156 ++--
 .../apache/lucene/search/ConjunctionScorer.java    |   9 +-
 .../apache/lucene/search/ConstantScoreQuery.java   |  49 +-
 .../apache/lucene/search/ConstantScoreScorer.java  |  65 +-
 .../apache/lucene/search/ConstantScoreWeight.java  |  12 +-
 .../search/ControlledRealTimeReopenThread.java     | 113 ++-
 .../apache/lucene/search/DisiPriorityQueue.java    |  15 +-
 .../java/org/apache/lucene/search/DisiWrapper.java |   7 +-
 .../search/DisjunctionDISIApproximation.java       |   9 +-
 .../lucene/search/DisjunctionMatchesIterator.java  |  68 +-
 .../apache/lucene/search/DisjunctionMaxQuery.java  | 123 +--
 .../apache/lucene/search/DisjunctionMaxScorer.java |  26 +-
 .../DisjunctionScoreBlockBoundaryPropagator.java   |  40 +-
 .../apache/lucene/search/DisjunctionScorer.java    |  44 +-
 .../apache/lucene/search/DisjunctionSumScorer.java |  14 +-
 .../java/org/apache/lucene/search/DocIdSet.java    |  73 +-
 .../org/apache/lucene/search/DocIdSetIterator.java | 112 ++-
 .../lucene/search/DocValuesFieldExistsQuery.java   |  20 +-
 .../lucene/search/DocValuesRewriteMethod.java      | 160 ++--
 .../org/apache/lucene/search/DoubleValues.java     |  38 +-
 .../apache/lucene/search/DoubleValuesSource.java   | 237 +++--
 .../apache/lucene/search/ExactPhraseMatcher.java   |  68 +-
 .../java/org/apache/lucene/search/Explanation.java |  63 +-
 .../org/apache/lucene/search/FieldComparator.java  | 250 +++---
 .../lucene/search/FieldComparatorSource.java       |  11 +-
 .../java/org/apache/lucene/search/FieldDoc.java    |  35 +-
 .../apache/lucene/search/FieldValueHitQueue.java   |  81 +-
 .../org/apache/lucene/search/FilterCollector.java  |   2 -
 .../apache/lucene/search/FilterLeafCollector.java  |   2 -
 .../lucene/search/FilterMatchesIterator.java       |   9 +-
 .../org/apache/lucene/search/FilterScorable.java   |  11 +-
 .../org/apache/lucene/search/FilterScorer.java     |  22 +-
 .../org/apache/lucene/search/FilterWeight.java     |  25 +-
 .../lucene/search/FilteredDocIdSetIterator.java    |  12 +-
 .../lucene/search/FuzzyAutomatonBuilder.java       |  14 +-
 .../java/org/apache/lucene/search/FuzzyQuery.java  | 170 ++--
 .../org/apache/lucene/search/FuzzyTermsEnum.java   | 171 ++--
 .../java/org/apache/lucene/search/HitQueue.java    |  65 +-
 .../apache/lucene/search/HitsThresholdChecker.java |  23 +-
 .../java/org/apache/lucene/search/ImpactsDISI.java |  25 +-
 .../lucene/search/IndexOrDocValuesQuery.java       |  54 +-
 .../org/apache/lucene/search/IndexSearcher.java    | 688 ++++++++-------
 .../org/apache/lucene/search/LRUQueryCache.java    | 279 +++---
 .../org/apache/lucene/search/LeafCollector.java    |  74 +-
 .../apache/lucene/search/LeafFieldComparator.java  | 119 ++-
 .../org/apache/lucene/search/LeafSimScorer.java    |  31 +-
 .../org/apache/lucene/search/LiveFieldValues.java  |  50 +-
 .../java/org/apache/lucene/search/LongValues.java  |  10 +-
 .../org/apache/lucene/search/LongValuesSource.java |  65 +-
 .../apache/lucene/search/MatchAllDocsQuery.java    |  14 +-
 .../org/apache/lucene/search/MatchNoDocsQuery.java |  12 +-
 .../src/java/org/apache/lucene/search/Matches.java |  19 +-
 .../org/apache/lucene/search/MatchesIterator.java  |  36 +-
 .../org/apache/lucene/search/MatchesUtils.java     |  73 +-
 .../search/MaxNonCompetitiveBoostAttribute.java    |  34 +-
 .../MaxNonCompetitiveBoostAttributeImpl.java       |  17 +-
 .../apache/lucene/search/MaxScoreAccumulator.java  |  14 +-
 .../org/apache/lucene/search/MaxScoreCache.java    |  30 +-
 .../lucene/search/MaxScoreSumPropagator.java       |  22 +-
 .../lucene/search/MinShouldMatchSumScorer.java     | 182 ++--
 .../org/apache/lucene/search/MultiCollector.java   |  69 +-
 .../lucene/search/MultiCollectorManager.java       |  30 +-
 .../lucene/search/MultiLeafFieldComparator.java    |   7 +-
 .../org/apache/lucene/search/MultiPhraseQuery.java | 193 ++--
 .../org/apache/lucene/search/MultiTermQuery.java   | 317 ++++---
 .../search/MultiTermQueryConstantScoreWrapper.java |  66 +-
 .../java/org/apache/lucene/search/Multiset.java    |  10 +-
 .../org/apache/lucene/search/NGramPhraseQuery.java |  32 +-
 .../org/apache/lucene/search/NamedMatches.java     |  32 +-
 .../lucene/search/NormsFieldExistsQuery.java       |  16 +-
 .../org/apache/lucene/search/PhraseMatcher.java    |  47 +-
 .../org/apache/lucene/search/PhrasePositions.java  |  41 +-
 .../java/org/apache/lucene/search/PhraseQuery.java | 244 ++---
 .../java/org/apache/lucene/search/PhraseQueue.java |   5 +-
 .../org/apache/lucene/search/PhraseScorer.java     |   1 -
 .../org/apache/lucene/search/PhraseWeight.java     | 142 +--
 .../org/apache/lucene/search/PointInSetQuery.java  | 167 ++--
 .../org/apache/lucene/search/PointRangeQuery.java  | 184 ++--
 .../lucene/search/PositiveScoresOnlyCollector.java |  12 +-
 .../java/org/apache/lucene/search/PrefixQuery.java |  23 +-
 .../src/java/org/apache/lucene/search/Query.java   | 109 +--
 .../java/org/apache/lucene/search/QueryCache.java  |   9 +-
 .../apache/lucene/search/QueryCachingPolicy.java   |  23 +-
 .../org/apache/lucene/search/QueryRescorer.java    | 101 ++-
 .../org/apache/lucene/search/QueryVisitor.java     |  35 +-
 .../lucene/search/QueueSizeBasedExecutor.java      |  10 +-
 .../org/apache/lucene/search/ReferenceManager.java | 215 +++--
 .../java/org/apache/lucene/search/RegexpQuery.java | 117 ++-
 .../apache/lucene/search/ReqExclBulkScorer.java    |   3 -
 .../org/apache/lucene/search/ReqExclScorer.java    |  33 +-
 .../org/apache/lucene/search/ReqOptSumScorer.java  | 269 +++---
 .../java/org/apache/lucene/search/Rescorer.java    |  42 +-
 .../java/org/apache/lucene/search/Scorable.java    |  47 +-
 .../java/org/apache/lucene/search/ScoreAndDoc.java |   7 +-
 .../lucene/search/ScoreCachingWrappingScorer.java  |  17 +-
 .../java/org/apache/lucene/search/ScoreDoc.java    |  13 +-
 .../java/org/apache/lucene/search/ScoreMode.java   |  36 +-
 .../src/java/org/apache/lucene/search/Scorer.java  |  72 +-
 .../org/apache/lucene/search/ScorerSupplier.java   |  25 +-
 .../org/apache/lucene/search/ScoringRewrite.java   | 181 ++--
 .../org/apache/lucene/search/SearcherFactory.java  |  35 +-
 .../lucene/search/SearcherLifetimeManager.java     | 168 ++--
 .../org/apache/lucene/search/SearcherManager.java  | 153 ++--
 .../org/apache/lucene/search/SegmentCacheable.java |  19 +-
 .../org/apache/lucene/search/SimpleCollector.java  |   3 -
 .../lucene/search/SimpleFieldComparator.java       |   5 +-
 .../org/apache/lucene/search/SliceExecutor.java    |  11 +-
 .../apache/lucene/search/SloppyPhraseMatcher.java  | 332 +++----
 .../src/java/org/apache/lucene/search/Sort.java    | 146 ++-
 .../java/org/apache/lucene/search/SortField.java   | 365 ++++----
 .../org/apache/lucene/search/SortRescorer.java     |  29 +-
 .../lucene/search/SortedNumericSelector.java       |  65 +-
 .../lucene/search/SortedNumericSortField.java      | 134 +--
 .../apache/lucene/search/SortedSetSelector.java    |  98 ++-
 .../apache/lucene/search/SortedSetSortField.java   |  81 +-
 .../org/apache/lucene/search/SynonymQuery.java     | 161 ++--
 .../lucene/search/TermCollectingRewrite.java       |  37 +-
 .../org/apache/lucene/search/TermInSetQuery.java   |  68 +-
 .../apache/lucene/search/TermMatchesIterator.java  |   9 +-
 .../java/org/apache/lucene/search/TermQuery.java   |  94 +-
 .../org/apache/lucene/search/TermRangeQuery.java   | 130 +--
 .../java/org/apache/lucene/search/TermScorer.java  |  19 +-
 .../org/apache/lucene/search/TermStatistics.java   |  92 +-
 .../lucene/search/TimeLimitingCollector.java       | 176 ++--
 .../src/java/org/apache/lucene/search/TopDocs.java | 136 +--
 .../org/apache/lucene/search/TopDocsCollector.java | 123 ++-
 .../apache/lucene/search/TopFieldCollector.java    | 214 ++---
 .../org/apache/lucene/search/TopFieldDocs.java     |  24 +-
 .../apache/lucene/search/TopScoreDocCollector.java | 111 ++-
 .../org/apache/lucene/search/TopTermsRewrite.java  | 244 ++---
 .../lucene/search/TotalHitCountCollector.java      |   6 +-
 .../java/org/apache/lucene/search/TotalHits.java   |  32 +-
 .../org/apache/lucene/search/TwoPhaseIterator.java |  51 +-
 .../search/UsageTrackingQueryCachingPolicy.java    |  49 +-
 .../java/org/apache/lucene/search/WANDScorer.java  | 147 ++--
 .../src/java/org/apache/lucene/search/Weight.java  | 177 ++--
 .../org/apache/lucene/search/WildcardQuery.java    |  59 +-
 .../lucene/search/comparators/DocComparator.java   |  25 +-
 .../search/comparators/DoubleComparator.java       |  15 +-
 .../lucene/search/comparators/FloatComparator.java |  15 +-
 .../lucene/search/comparators/IntComparator.java   |  15 +-
 .../lucene/search/comparators/LongComparator.java  |  15 +-
 .../lucene/search/comparators/MinDocIterator.java  |   7 +-
 .../search/comparators/NumericComparator.java      | 171 ++--
 .../lucene/search/comparators/package-info.java    |   5 +-
 .../org/apache/lucene/search/package-info.java     | 840 +++++++++---------
 .../lucene/search/similarities/AfterEffect.java    |  31 +-
 .../lucene/search/similarities/AfterEffectB.java   |  17 +-
 .../lucene/search/similarities/AfterEffectL.java   |   8 +-
 .../lucene/search/similarities/Axiomatic.java      | 160 ++--
 .../lucene/search/similarities/AxiomaticF1EXP.java |  82 +-
 .../lucene/search/similarities/AxiomaticF1LOG.java |  76 +-
 .../lucene/search/similarities/AxiomaticF2EXP.java |  85 +-
 .../lucene/search/similarities/AxiomaticF2LOG.java |  80 +-
 .../lucene/search/similarities/AxiomaticF3EXP.java |  80 +-
 .../lucene/search/similarities/AxiomaticF3LOG.java |  73 +-
 .../lucene/search/similarities/BM25Similarity.java | 140 +--
 .../lucene/search/similarities/BasicModel.java     |  37 +-
 .../lucene/search/similarities/BasicModelG.java    |  34 +-
 .../lucene/search/similarities/BasicModelIF.java   |  23 +-
 .../lucene/search/similarities/BasicModelIn.java   |  18 +-
 .../lucene/search/similarities/BasicModelIne.java  |  27 +-
 .../lucene/search/similarities/BasicStats.java     |  32 +-
 .../search/similarities/BooleanSimilarity.java     |  18 +-
 .../search/similarities/ClassicSimilarity.java     |  23 +-
 .../lucene/search/similarities/DFISimilarity.java  |  85 +-
 .../lucene/search/similarities/DFRSimilarity.java  | 146 ++-
 .../lucene/search/similarities/Distribution.java   |  30 +-
 .../lucene/search/similarities/DistributionLL.java |  10 +-
 .../search/similarities/DistributionSPL.java       |  19 +-
 .../lucene/search/similarities/IBSimilarity.java   | 149 ++--
 .../lucene/search/similarities/Independence.java   |  21 +-
 .../similarities/IndependenceChiSquared.java       |  15 +-
 .../search/similarities/IndependenceSaturated.java |  13 +-
 .../similarities/IndependenceStandardized.java     |  16 +-
 .../search/similarities/LMDirichletSimilarity.java |  93 +-
 .../similarities/LMJelinekMercerSimilarity.java    |  70 +-
 .../lucene/search/similarities/LMSimilarity.java   | 101 +--
 .../apache/lucene/search/similarities/Lambda.java  |  21 +-
 .../lucene/search/similarities/LambdaDF.java       |  17 +-
 .../lucene/search/similarities/LambdaTTF.java      |  18 +-
 .../search/similarities/MultiSimilarity.java       |  25 +-
 .../lucene/search/similarities/Normalization.java  |  52 +-
 .../search/similarities/NormalizationH1.java       |  47 +-
 .../search/similarities/NormalizationH2.java       |  48 +-
 .../search/similarities/NormalizationH3.java       |  33 +-
 .../lucene/search/similarities/NormalizationZ.java |  28 +-
 .../similarities/PerFieldSimilarityWrapper.java    |  26 +-
 .../lucene/search/similarities/Similarity.java     | 205 +++--
 .../lucene/search/similarities/SimilarityBase.java | 151 ++--
 .../search/similarities/TFIDFSimilarity.java       | 485 +++++-----
 .../lucene/search/similarities/package-info.java   | 191 ++--
 .../lucene/search/spans/ConjunctionSpans.java      |  24 +-
 .../apache/lucene/search/spans/ContainSpans.java   |  18 +-
 .../lucene/search/spans/FieldMaskingSpanQuery.java |  68 +-
 .../apache/lucene/search/spans/FilterSpans.java    |  57 +-
 .../lucene/search/spans/NearSpansOrdered.java      |  46 +-
 .../lucene/search/spans/NearSpansUnordered.java    |  40 +-
 .../apache/lucene/search/spans/SpanBoostQuery.java |  33 +-
 .../apache/lucene/search/spans/SpanCollector.java  |  16 +-
 .../lucene/search/spans/SpanContainQuery.java      |  35 +-
 .../lucene/search/spans/SpanContainingQuery.java   |  35 +-
 .../apache/lucene/search/spans/SpanFirstQuery.java |  27 +-
 .../search/spans/SpanMultiTermQueryWrapper.java    | 200 +++--
 .../apache/lucene/search/spans/SpanNearQuery.java  | 131 ++-
 .../apache/lucene/search/spans/SpanNotQuery.java   | 107 ++-
 .../apache/lucene/search/spans/SpanOrQuery.java    |  59 +-
 .../search/spans/SpanPositionCheckQuery.java       |  63 +-
 .../lucene/search/spans/SpanPositionQueue.java     |   8 +-
 .../search/spans/SpanPositionRangeQuery.java       |  33 +-
 .../org/apache/lucene/search/spans/SpanQuery.java  |  11 +-
 .../org/apache/lucene/search/spans/SpanScorer.java |  39 +-
 .../apache/lucene/search/spans/SpanTermQuery.java  |  98 ++-
 .../org/apache/lucene/search/spans/SpanWeight.java | 242 ++---
 .../lucene/search/spans/SpanWithinQuery.java       |  36 +-
 .../java/org/apache/lucene/search/spans/Spans.java |  62 +-
 .../org/apache/lucene/search/spans/TermSpans.java  |  28 +-
 .../apache/lucene/search/spans/package-info.java   |  97 +-
 .../apache/lucene/search/BaseTestRangeFilter.java  |  70 +-
 .../lucene/search/FuzzyTermOnShortTermsTest.java   | 119 +--
 .../apache/lucene/search/JustCompileSearch.java    |  33 +-
 .../apache/lucene/search/TermInSetQueryTest.java   |  87 +-
 .../search/TestApproximationSearchEquivalence.java |  12 +-
 .../apache/lucene/search/TestAutomatonQuery.java   | 131 ++-
 .../lucene/search/TestAutomatonQueryUnicode.java   |  19 +-
 .../apache/lucene/search/TestBlendedTermQuery.java |  68 +-
 .../lucene/search/TestBlockMaxConjunction.java     |  29 +-
 .../org/apache/lucene/search/TestBoolean2.java     | 125 +--
 .../lucene/search/TestBoolean2ScorerSupplier.java  | 144 ++-
 .../lucene/search/TestBooleanMinShouldMatch.java   | 678 +++++++-------
 .../org/apache/lucene/search/TestBooleanOr.java    | 107 +--
 .../org/apache/lucene/search/TestBooleanQuery.java | 327 +++----
 .../search/TestBooleanQueryVisitSubscorers.java    | 100 ++-
 .../apache/lucene/search/TestBooleanRewrites.java  | 495 ++++++-----
 .../apache/lucene/search/TestBooleanScorer.java    | 172 ++--
 .../org/apache/lucene/search/TestBoostQuery.java   |  34 +-
 .../apache/lucene/search/TestCachingCollector.java |  83 +-
 .../lucene/search/TestComplexExplanations.java     | 238 ++---
 .../TestComplexExplanationsOfNonMatches.java       |  11 +-
 .../apache/lucene/search/TestConjunctionDISI.java  | 139 ++-
 .../org/apache/lucene/search/TestConjunctions.java |  74 +-
 .../lucene/search/TestConstantScoreQuery.java      | 141 +--
 .../lucene/search/TestConstantScoreScorer.java     |  69 +-
 .../search/TestControlledRealTimeReopenThread.java | 263 +++---
 .../lucene/search/TestCustomSearcherSort.java      | 105 +--
 .../org/apache/lucene/search/TestDateSort.java     |  11 +-
 .../lucene/search/TestDisjunctionMaxQuery.java     | 436 +++++----
 ...estDisjunctionScoreBlockBoundaryPropagator.java |   5 +-
 .../apache/lucene/search/TestDocIdSetIterator.java |  22 +-
 .../apache/lucene/search/TestDocValuesQueries.java | 117 ++-
 .../lucene/search/TestDocValuesRewriteMethod.java  |  48 +-
 .../lucene/search/TestDoubleRangeFieldQueries.java |  86 +-
 .../lucene/search/TestDoubleValuesSource.java      | 195 ++--
 .../apache/lucene/search/TestEarlyTermination.java |  56 +-
 .../lucene/search/TestElevationComparator.java     | 221 +++--
 .../lucene/search/TestFieldCacheRewriteMethod.java |  18 +-
 .../search/TestFieldSortOptimizationSkipping.java  | 137 +--
 .../apache/lucene/search/TestFieldValueQuery.java  |  21 +-
 .../org/apache/lucene/search/TestFilterWeight.java |  30 +-
 .../lucene/search/TestFloatRangeFieldQueries.java  |  89 +-
 .../org/apache/lucene/search/TestFuzzyQuery.java   | 340 ++++---
 .../lucene/search/TestIndexOrDocValuesQuery.java   |  89 +-
 .../apache/lucene/search/TestIndexSearcher.java    | 228 ++---
 .../lucene/search/TestInetAddressRangeQueries.java |  43 +-
 .../lucene/search/TestIntRangeFieldQueries.java    |  59 +-
 .../apache/lucene/search/TestLRUQueryCache.java    | 781 +++++++++-------
 .../lucene/search/TestLatLonDocValuesQueries.java  |   6 +-
 .../lucene/search/TestLatLonPointQueries.java      |   7 +-
 .../apache/lucene/search/TestLiveFieldValues.java  | 167 ++--
 .../lucene/search/TestLongRangeFieldQueries.java   |  63 +-
 .../apache/lucene/search/TestLongValuesSource.java |  28 +-
 .../lucene/search/TestMatchAllDocsQuery.java       |  36 +-
 .../apache/lucene/search/TestMatchNoDocsQuery.java |  16 +-
 .../apache/lucene/search/TestMatchesIterator.java  | 709 ++++++++-------
 .../apache/lucene/search/TestMaxClauseLimit.java   |  72 +-
 .../lucene/search/TestMaxScoreAccumulator.java     |   3 +-
 .../lucene/search/TestMaxScoreSumPropagator.java   |  31 +-
 .../apache/lucene/search/TestMinShouldMatch2.java  | 177 ++--
 .../apache/lucene/search/TestMultiCollector.java   | 218 ++---
 .../apache/lucene/search/TestMultiPhraseEnum.java  |  56 +-
 .../apache/lucene/search/TestMultiPhraseQuery.java | 288 +++---
 .../apache/lucene/search/TestMultiSliceMerge.java  |  25 +-
 .../lucene/search/TestMultiTermConstantScore.java  | 168 ++--
 .../lucene/search/TestMultiTermQueryRewrites.java  | 166 ++--
 .../lucene/search/TestMultiThreadTermVectors.java  |  25 +-
 .../org/apache/lucene/search/TestMultiset.java     |   3 -
 .../apache/lucene/search/TestNGramPhraseQuery.java |  27 +-
 .../org/apache/lucene/search/TestNeedsScores.java  |  36 +-
 .../lucene/search/TestNormsFieldExistsQuery.java   |  15 +-
 .../src/test/org/apache/lucene/search/TestNot.java |  12 +-
 .../lucene/search/TestPhrasePrefixQuery.java       |  26 +-
 .../org/apache/lucene/search/TestPhraseQuery.java  | 557 ++++++------
 .../org/apache/lucene/search/TestPointQueries.java | 980 +++++++++++++--------
 .../lucene/search/TestPositionIncrement.java       | 133 ++-
 .../search/TestPositiveScoresOnlyCollector.java    |  53 +-
 .../lucene/search/TestPrefixInBooleanQuery.java    |  54 +-
 .../org/apache/lucene/search/TestPrefixQuery.java  |  21 +-
 .../org/apache/lucene/search/TestPrefixRandom.java |  48 +-
 .../apache/lucene/search/TestQueryRescorer.java    | 162 ++--
 .../org/apache/lucene/search/TestQueryVisitor.java | 228 +++--
 .../search/TestRangeFieldsDocValuesQuery.java      |   8 +-
 .../org/apache/lucene/search/TestRegexpQuery.java  | 118 +--
 .../org/apache/lucene/search/TestRegexpRandom.java |  46 +-
 .../apache/lucene/search/TestRegexpRandom2.java    |  51 +-
 .../lucene/search/TestReqExclBulkScorer.java       |  88 +-
 .../apache/lucene/search/TestReqOptSumScorer.java  | 162 ++--
 .../lucene/search/TestSameScoresWithThreads.java   |  72 +-
 .../search/TestScoreCachingWrappingScorer.java     |  77 +-
 .../org/apache/lucene/search/TestScorerPerf.java   | 240 +++--
 .../org/apache/lucene/search/TestSearchAfter.java  |  97 +-
 .../lucene/search/TestSearchWithThreads.java       |  50 +-
 .../apache/lucene/search/TestSearcherManager.java  | 554 ++++++------
 .../lucene/search/TestSegmentCacheables.java       |   7 +-
 .../apache/lucene/search/TestShardSearching.java   | 101 ++-
 .../org/apache/lucene/search/TestSimilarity.java   | 208 +++--
 .../lucene/search/TestSimilarityProvider.java      |   8 +-
 .../lucene/search/TestSimpleExplanations.java      | 355 ++++----
 .../search/TestSimpleExplanationsOfNonMatches.java |  12 +-
 .../TestSimpleExplanationsWithFillerDocs.java      |  60 +-
 .../lucene/search/TestSimpleSearchEquivalence.java |  55 +-
 .../lucene/search/TestSloppyPhraseQuery.java       | 242 ++---
 .../lucene/search/TestSloppyPhraseQuery2.java      |  26 +-
 .../test/org/apache/lucene/search/TestSort.java    | 124 +--
 .../org/apache/lucene/search/TestSortRandom.java   | 114 ++-
 .../org/apache/lucene/search/TestSortRescorer.java |  91 +-
 .../lucene/search/TestSortedNumericSortField.java  |  53 +-
 .../lucene/search/TestSortedSetSelector.java       |  93 +-
 .../lucene/search/TestSortedSetSortField.java      |  37 +-
 .../apache/lucene/search/TestSubScorerFreqs.java   |  44 +-
 .../org/apache/lucene/search/TestSynonymQuery.java | 250 +++---
 .../org/apache/lucene/search/TestTermQuery.java    | 107 ++-
 .../apache/lucene/search/TestTermRangeQuery.java   |  84 +-
 .../org/apache/lucene/search/TestTermScorer.java   | 193 ++--
 .../lucene/search/TestTimeLimitingCollector.java   | 267 +++---
 .../apache/lucene/search/TestTopDocsCollector.java | 235 +++--
 .../org/apache/lucene/search/TestTopDocsMerge.java | 117 ++-
 .../lucene/search/TestTopFieldCollector.java       | 246 +++---
 .../TestTopFieldCollectorEarlyTermination.java     | 157 ++--
 .../lucene/search/TestTotalHitCountCollector.java  |   9 +-
 .../TestUsageTrackingFilterCachingPolicy.java      |  37 +-
 .../org/apache/lucene/search/TestWANDScorer.java   | 174 ++--
 .../org/apache/lucene/search/TestWildcard.java     | 279 +++---
 .../apache/lucene/search/TestWildcardRandom.java   |  49 +-
 .../lucene/search/TestXYPointDistanceSort.java     |  67 +-
 .../apache/lucene/search/TestXYPointQueries.java   |   2 +-
 .../search/similarities/AxiomaticTestCase.java     |   6 +-
 .../search/similarities/BasicModelTestCase.java    |  11 +-
 .../search/similarities/DistributionTestCase.java  |   5 +-
 .../search/similarities/TestAxiomaticF1EXP.java    |   1 -
 .../search/similarities/TestAxiomaticF1LOG.java    |   1 -
 .../search/similarities/TestAxiomaticF2EXP.java    |   1 -
 .../search/similarities/TestAxiomaticF2LOG.java    |   1 -
 .../search/similarities/TestAxiomaticF3EXP.java    |   1 -
 .../search/similarities/TestAxiomaticF3LOG.java    |   1 -
 .../similarities/TestAxiomaticSimilarity.java      |  81 +-
 .../search/similarities/TestBM25Similarity.java    |  80 +-
 .../search/similarities/TestBasicModelG.java       |   1 -
 .../search/similarities/TestBasicModelIF.java      |   1 -
 .../search/similarities/TestBasicModelIn.java      |   1 -
 .../search/similarities/TestBasicModelIne.java     |   1 -
 .../search/similarities/TestBooleanSimilarity.java |  26 +-
 .../search/similarities/TestClassicSimilarity.java |  77 +-
 .../search/similarities/TestDistributionLL.java    |   1 -
 .../search/similarities/TestDistributionSPL.java   |   1 -
 .../similarities/TestIndependenceChiSquared.java   |   1 -
 .../similarities/TestIndependenceSaturated.java    |   1 -
 .../similarities/TestIndependenceStandardized.java |   1 -
 .../similarities/TestLMDirichletSimilarity.java    |   1 -
 .../TestLMJelinekMercerSimilarity.java             |   1 -
 .../search/similarities/TestSimilarity2.java       |  62 +-
 .../search/similarities/TestSimilarityBase.java    | 397 ++++-----
 .../search/spans/JustCompileSearchSpans.java       |  18 +-
 .../org/apache/lucene/search/spans/TestBasics.java | 377 ++++----
 .../search/spans/TestFieldMaskingSpanQuery.java    | 348 ++++----
 .../lucene/search/spans/TestFilterSpans.java       |   2 -
 .../lucene/search/spans/TestNearSpansOrdered.java  | 275 +++---
 .../lucene/search/spans/TestSpanBoostQuery.java    |  14 +-
 .../lucene/search/spans/TestSpanCollection.java    |  51 +-
 .../lucene/search/spans/TestSpanContainQuery.java  |  34 +-
 .../lucene/search/spans/TestSpanExplanations.java  | 154 ++--
 .../spans/TestSpanExplanationsOfNonMatches.java    |  13 +-
 .../lucene/search/spans/TestSpanFirstQuery.java    |  15 +-
 .../spans/TestSpanMultiTermQueryWrapper.java       | 133 ++-
 .../lucene/search/spans/TestSpanNearQuery.java     |  54 +-
 .../lucene/search/spans/TestSpanNotQuery.java      |  32 +-
 .../lucene/search/spans/TestSpanOrQuery.java       |  18 +-
 .../search/spans/TestSpanSearchEquivalence.java    | 313 +++----
 .../lucene/search/spans/TestSpanTermQuery.java     |  19 +-
 .../org/apache/lucene/search/spans/TestSpans.java  | 248 +++---
 .../apache/lucene/search/spans/TestSpansEnum.java  |  56 +-
 409 files changed, 19986 insertions(+), 18225 deletions(-)

diff --git a/gradle/validation/spotless.gradle b/gradle/validation/spotless.gradle
index 6e35970..bc8e10f 100644
--- a/gradle/validation/spotless.gradle
+++ b/gradle/validation/spotless.gradle
@@ -50,7 +50,7 @@ allprojects { prj ->
                    "src/**/org/apache/lucene/document/**",
                    "src/**/org/apache/lucene/geo/**",
                    "src/**/org/apache/lucene/index/**",
-                   // "src/**/org/apache/lucene/search/**",
+                   "src/**/org/apache/lucene/search/**",
                    "src/**/org/apache/lucene/store/**",
                    "src/**/org/apache/lucene/util/**"
 
diff --git a/lucene/core/src/java/org/apache/lucene/search/AutomatonQuery.java b/lucene/core/src/java/org/apache/lucene/search/AutomatonQuery.java
index 08b9eef..69b7ed2 100644
--- a/lucene/core/src/java/org/apache/lucene/search/AutomatonQuery.java
+++ b/lucene/core/src/java/org/apache/lucene/search/AutomatonQuery.java
@@ -16,9 +16,7 @@
  */
 package org.apache.lucene.search;
 
-
 import java.io.IOException;
-
 import org.apache.lucene.index.Term;
 import org.apache.lucene.index.Terms;
 import org.apache.lucene.index.TermsEnum;
@@ -31,41 +29,40 @@ import org.apache.lucene.util.automaton.Operations;
 
 /**
  * A {@link Query} that will match terms against a finite-state machine.
- * <p>
- * This query will match documents that contain terms accepted by a given
- * finite-state machine. The automaton can be constructed with the
- * {@link org.apache.lucene.util.automaton} API. Alternatively, it can be
- * created from a regular expression with {@link RegexpQuery} or from
- * the standard Lucene wildcard syntax with {@link WildcardQuery}.
- * </p>
- * <p>
- * When the query is executed, it will create an equivalent DFA of the
- * finite-state machine, and will enumerate the term dictionary in an
- * intelligent way to reduce the number of comparisons. For example: the regular
- * expression of <code>[dl]og?</code> will make approximately four comparisons:
+ *
+ * <p>This query will match documents that contain terms accepted by a given finite-state machine.
+ * The automaton can be constructed with the {@link org.apache.lucene.util.automaton} API.
+ * Alternatively, it can be created from a regular expression with {@link RegexpQuery} or from the
+ * standard Lucene wildcard syntax with {@link WildcardQuery}.
+ *
+ * <p>When the query is executed, it will create an equivalent DFA of the finite-state machine, and
+ * will enumerate the term dictionary in an intelligent way to reduce the number of comparisons. For
+ * example: the regular expression of <code>[dl]og?</code> will make approximately four comparisons:
  * do, dog, lo, and log.
- * </p>
+ *
  * @lucene.experimental
  */
 public class AutomatonQuery extends MultiTermQuery implements Accountable {
-  private static final long BASE_RAM_BYTES = RamUsageEstimator.shallowSizeOfInstance(AutomatonQuery.class);
+  private static final long BASE_RAM_BYTES =
+      RamUsageEstimator.shallowSizeOfInstance(AutomatonQuery.class);
 
   /** the automaton to match index terms against */
   protected final Automaton automaton;
+
   protected final CompiledAutomaton compiled;
   /** term containing the field, and possibly some pattern structure */
   protected final Term term;
+
   protected final boolean automatonIsBinary;
 
   private final long ramBytesUsed; // cache
 
   /**
    * Create a new AutomatonQuery from an {@link Automaton}.
-   * 
-   * @param term Term containing field and possibly some pattern structure. The
-   *        term text is ignored.
-   * @param automaton Automaton to run, terms that are accepted are considered a
-   *        match.
+   *
+   * @param term Term containing field and possibly some pattern structure. The term text is
+   *     ignored.
+   * @param automaton Automaton to run, terms that are accepted are considered a match.
    */
   public AutomatonQuery(final Term term, Automaton automaton) {
     this(term, automaton, Operations.DEFAULT_MAX_DETERMINIZED_STATES);
@@ -73,15 +70,13 @@ public class AutomatonQuery extends MultiTermQuery implements Accountable {
 
   /**
    * Create a new AutomatonQuery from an {@link Automaton}.
-   * 
-   * @param term Term containing field and possibly some pattern structure. The
-   *        term text is ignored.
-   * @param automaton Automaton to run, terms that are accepted are considered a
-   *        match.
-   * @param maxDeterminizedStates maximum number of states in the resulting
-   *   automata.  If the automata would need more than this many states
-   *   TooComplextToDeterminizeException is thrown.  Higher number require more
-   *   space but can process more complex automata.
+   *
+   * @param term Term containing field and possibly some pattern structure. The term text is
+   *     ignored.
+   * @param automaton Automaton to run, terms that are accepted are considered a match.
+   * @param maxDeterminizedStates maximum number of states in the resulting automata. If the
+   *     automata would need more than this many states TooComplextToDeterminizeException is thrown.
+   *     Higher number require more space but can process more complex automata.
    */
   public AutomatonQuery(final Term term, Automaton automaton, int maxDeterminizedStates) {
     this(term, automaton, maxDeterminizedStates, false);
@@ -89,19 +84,18 @@ public class AutomatonQuery extends MultiTermQuery implements Accountable {
 
   /**
    * Create a new AutomatonQuery from an {@link Automaton}.
-   * 
-   * @param term Term containing field and possibly some pattern structure. The
-   *        term text is ignored.
-   * @param automaton Automaton to run, terms that are accepted are considered a
-   *        match.
-   * @param maxDeterminizedStates maximum number of states in the resulting
-   *   automata.  If the automata would need more than this many states
-   *   TooComplextToDeterminizeException is thrown.  Higher number require more
-   *   space but can process more complex automata.
-   * @param isBinary if true, this automaton is already binary and
-   *   will not go through the UTF32ToUTF8 conversion
+   *
+   * @param term Term containing field and possibly some pattern structure. The term text is
+   *     ignored.
+   * @param automaton Automaton to run, terms that are accepted are considered a match.
+   * @param maxDeterminizedStates maximum number of states in the resulting automata. If the
+   *     automata would need more than this many states TooComplextToDeterminizeException is thrown.
+   *     Higher number require more space but can process more complex automata.
+   * @param isBinary if true, this automaton is already binary and will not go through the
+   *     UTF32ToUTF8 conversion
    */
-  public AutomatonQuery(final Term term, Automaton automaton, int maxDeterminizedStates, boolean isBinary) {
+  public AutomatonQuery(
+      final Term term, Automaton automaton, int maxDeterminizedStates, boolean isBinary) {
     super(term.field());
     this.term = term;
     this.automaton = automaton;
@@ -109,7 +103,8 @@ public class AutomatonQuery extends MultiTermQuery implements Accountable {
     // TODO: we could take isFinite too, to save a bit of CPU in CompiledAutomaton ctor?:
     this.compiled = new CompiledAutomaton(automaton, null, true, maxDeterminizedStates, isBinary);
 
-    this.ramBytesUsed = BASE_RAM_BYTES + term.ramBytesUsed() + automaton.ramBytesUsed() + compiled.ramBytesUsed();
+    this.ramBytesUsed =
+        BASE_RAM_BYTES + term.ramBytesUsed() + automaton.ramBytesUsed() + compiled.ramBytesUsed();
   }
 
   @Override
@@ -128,20 +123,14 @@ public class AutomatonQuery extends MultiTermQuery implements Accountable {
 
   @Override
   public boolean equals(Object obj) {
-    if (this == obj)
-      return true;
-    if (!super.equals(obj))
-      return false;
-    if (getClass() != obj.getClass())
-      return false;
+    if (this == obj) return true;
+    if (!super.equals(obj)) return false;
+    if (getClass() != obj.getClass()) return false;
     AutomatonQuery other = (AutomatonQuery) obj;
-    if (!compiled.equals(other.compiled))
-      return false;
+    if (!compiled.equals(other.compiled)) return false;
     if (term == null) {
-      if (other.term != null)
-        return false;
-    } else if (!term.equals(other.term))
-      return false;
+      if (other.term != null) return false;
+    } else if (!term.equals(other.term)) return false;
     return true;
   }
 
@@ -172,7 +161,7 @@ public class AutomatonQuery extends MultiTermQuery implements Accountable {
     return automaton;
   }
 
-  /** Is this a binary (byte) oriented automaton. See the constructor.  */
+  /** Is this a binary (byte) oriented automaton. See the constructor. */
   public boolean isAutomatonBinary() {
     return automatonIsBinary;
   }
diff --git a/lucene/core/src/java/org/apache/lucene/search/BlendedTermQuery.java b/lucene/core/src/java/org/apache/lucene/search/BlendedTermQuery.java
index c307d78..e9a135f 100644
--- a/lucene/core/src/java/org/apache/lucene/search/BlendedTermQuery.java
+++ b/lucene/core/src/java/org/apache/lucene/search/BlendedTermQuery.java
@@ -16,11 +16,9 @@
  */
 package org.apache.lucene.search;
 
-
 import java.io.IOException;
 import java.util.Arrays;
 import java.util.List;
-
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.IndexReaderContext;
 import org.apache.lucene.index.LeafReaderContext;
@@ -32,17 +30,18 @@ import org.apache.lucene.util.ArrayUtil;
 import org.apache.lucene.util.InPlaceMergeSorter;
 
 /**
- * A {@link Query} that blends index statistics across multiple terms.
- * This is particularly useful when several terms should produce identical
- * scores, regardless of their index statistics.
- * <p>For instance imagine that you are resolving synonyms at search time,
- * all terms should produce identical scores instead of the default behavior,
- * which tends to give higher scores to rare terms.
- * <p>An other useful use-case is cross-field search: imagine that you would
- * like to search for {@code john} on two fields: {@code first_name} and
- * {@code last_name}. You might not want to give a higher weight to matches
- * on the field where {@code john} is rarer, in which case
- * {@link BlendedTermQuery} would help as well.
+ * A {@link Query} that blends index statistics across multiple terms. This is particularly useful
+ * when several terms should produce identical scores, regardless of their index statistics.
+ *
+ * <p>For instance imagine that you are resolving synonyms at search time, all terms should produce
+ * identical scores instead of the default behavior, which tends to give higher scores to rare
+ * terms.
+ *
+ * <p>An other useful use-case is cross-field search: imagine that you would like to search for
+ * {@code john} on two fields: {@code first_name} and {@code last_name}. You might not want to give
+ * a higher weight to matches on the field where {@code john} is rarer, in which case {@link
+ * BlendedTermQuery} would help as well.
+ *
  * @lucene.experimental
  */
 public final class BlendedTermQuery extends Query {
@@ -59,31 +58,37 @@ public final class BlendedTermQuery extends Query {
     /** Sole constructor. */
     public Builder() {}
 
-    /** Set the {@link RewriteMethod}. Default is to use
-     *  {@link BlendedTermQuery#DISJUNCTION_MAX_REWRITE}.
-     *  @see RewriteMethod */
+    /**
+     * Set the {@link RewriteMethod}. Default is to use {@link
+     * BlendedTermQuery#DISJUNCTION_MAX_REWRITE}.
+     *
+     * @see RewriteMethod
+     */
     public Builder setRewriteMethod(RewriteMethod rewiteMethod) {
       this.rewriteMethod = rewiteMethod;
       return this;
     }
 
-    /** Add a new {@link Term} to this builder, with a default boost of {@code 1}.
-     *  @see #add(Term, float) */
+    /**
+     * Add a new {@link Term} to this builder, with a default boost of {@code 1}.
+     *
+     * @see #add(Term, float)
+     */
     public Builder add(Term term) {
       return add(term, 1f);
     }
 
-    /** Add a {@link Term} with the provided boost. The higher the boost, the
-     *  more this term will contribute to the overall score of the
-     *  {@link BlendedTermQuery}. */
+    /**
+     * Add a {@link Term} with the provided boost. The higher the boost, the more this term will
+     * contribute to the overall score of the {@link BlendedTermQuery}.
+     */
     public Builder add(Term term, float boost) {
       return add(term, boost, null);
     }
 
     /**
-     * Expert: Add a {@link Term} with the provided boost and context.
-     * This method is useful if you already have a {@link TermStates}
-     * object constructed for the given term.
+     * Expert: Add a {@link Term} with the provided boost and context. This method is useful if you
+     * already have a {@link TermStates} object constructed for the given term.
      */
     public Builder add(Term term, float boost, TermStates context) {
       if (numTerms >= IndexSearcher.getMaxClauseCount()) {
@@ -107,53 +112,56 @@ public final class BlendedTermQuery extends Query {
           ArrayUtil.copyOfSubArray(contexts, 0, numTerms),
           rewriteMethod);
     }
-
   }
 
-  /** A {@link RewriteMethod} defines how queries for individual terms should
-   *  be merged.
-   *  @lucene.experimental
-   *  @see BlendedTermQuery#BOOLEAN_REWRITE
-   *  @see BlendedTermQuery.DisjunctionMaxRewrite */
-  public static abstract class RewriteMethod {
+  /**
+   * A {@link RewriteMethod} defines how queries for individual terms should be merged.
+   *
+   * @lucene.experimental
+   * @see BlendedTermQuery#BOOLEAN_REWRITE
+   * @see BlendedTermQuery.DisjunctionMaxRewrite
+   */
+  public abstract static class RewriteMethod {
 
     /** Sole constructor */
     protected RewriteMethod() {}
 
     /** Merge the provided sub queries into a single {@link Query} object. */
     public abstract Query rewrite(Query[] subQueries);
-
   }
 
   /**
-   * A {@link RewriteMethod} that adds all sub queries to a {@link BooleanQuery}.
-   * This {@link RewriteMethod} is useful when matching on several fields is
-   * considered better than having a good match on a single field.
+   * A {@link RewriteMethod} that adds all sub queries to a {@link BooleanQuery}. This {@link
+   * RewriteMethod} is useful when matching on several fields is considered better than having a
+   * good match on a single field.
    */
-  public static final RewriteMethod BOOLEAN_REWRITE = new RewriteMethod() {
-    @Override
-    public Query rewrite(Query[] subQueries) {
-      BooleanQuery.Builder merged = new BooleanQuery.Builder();
-      for (Query query : subQueries) {
-        merged.add(query, Occur.SHOULD);
-      }
-      return merged.build();
-    }
-  };
+  public static final RewriteMethod BOOLEAN_REWRITE =
+      new RewriteMethod() {
+        @Override
+        public Query rewrite(Query[] subQueries) {
+          BooleanQuery.Builder merged = new BooleanQuery.Builder();
+          for (Query query : subQueries) {
+            merged.add(query, Occur.SHOULD);
+          }
+          return merged.build();
+        }
+      };
 
   /**
-   * A {@link RewriteMethod} that creates a {@link DisjunctionMaxQuery} out
-   * of the sub queries. This {@link RewriteMethod} is useful when having a
-   * good match on a single field is considered better than having average
-   * matches on several fields.
+   * A {@link RewriteMethod} that creates a {@link DisjunctionMaxQuery} out of the sub queries. This
+   * {@link RewriteMethod} is useful when having a good match on a single field is considered better
+   * than having average matches on several fields.
    */
   public static class DisjunctionMaxRewrite extends RewriteMethod {
 
     private final float tieBreakerMultiplier;
 
-    /** This {@link RewriteMethod} will create {@link DisjunctionMaxQuery}
-     *  instances that have the provided tie breaker.
-     *  @see DisjunctionMaxQuery */
+    /**
+     * This {@link RewriteMethod} will create {@link DisjunctionMaxQuery} instances that have the
+     * provided tie breaker.
+     *
+     * @see DisjunctionMaxQuery
+     */
     public DisjunctionMaxRewrite(float tieBreakerMultiplier) {
       this.tieBreakerMultiplier = tieBreakerMultiplier;
     }
@@ -176,7 +184,6 @@ public final class BlendedTermQuery extends Query {
     public int hashCode() {
       return 31 * getClass().hashCode() + Float.floatToIntBits(tieBreakerMultiplier);
     }
-
   }
 
   /** {@link DisjunctionMaxRewrite} instance with a tie-breaker of {@code 0.01}. */
@@ -187,8 +194,8 @@ public final class BlendedTermQuery extends Query {
   private final TermStates[] contexts;
   private final RewriteMethod rewriteMethod;
 
-  private BlendedTermQuery(Term[] terms, float[] boosts, TermStates[] contexts,
-      RewriteMethod rewriteMethod) {
+  private BlendedTermQuery(
+      Term[] terms, float[] boosts, TermStates[] contexts, RewriteMethod rewriteMethod) {
     assert terms.length == boosts.length;
     assert terms.length == contexts.length;
     this.terms = terms;
@@ -223,15 +230,14 @@ public final class BlendedTermQuery extends Query {
 
   @Override
   public boolean equals(Object other) {
-    return sameClassAs(other) &&
-           equalsTo(getClass().cast(other));
+    return sameClassAs(other) && equalsTo(getClass().cast(other));
   }
-  
+
   private boolean equalsTo(BlendedTermQuery other) {
-    return Arrays.equals(terms, other.terms) && 
-           Arrays.equals(contexts, other.contexts) && 
-           Arrays.equals(boosts, other.boosts) && 
-           rewriteMethod.equals(other.rewriteMethod);
+    return Arrays.equals(terms, other.terms)
+        && Arrays.equals(contexts, other.contexts)
+        && Arrays.equals(boosts, other.boosts)
+        && rewriteMethod.equals(other.rewriteMethod);
   }
 
   @Override
@@ -296,15 +302,17 @@ public final class BlendedTermQuery extends Query {
 
   @Override
   public void visit(QueryVisitor visitor) {
-    Term[] termsToVisit = Arrays.stream(terms).filter(t -> visitor.acceptField(t.field())).toArray(Term[]::new);
+    Term[] termsToVisit =
+        Arrays.stream(terms).filter(t -> visitor.acceptField(t.field())).toArray(Term[]::new);
     if (termsToVisit.length > 0) {
       QueryVisitor v = visitor.getSubVisitor(Occur.SHOULD, this);
       v.consumeTerms(this, termsToVisit);
     }
   }
 
-  private static TermStates adjustFrequencies(IndexReaderContext readerContext,
-                                              TermStates ctx, int artificialDf, long artificialTtf) throws IOException {
+  private static TermStates adjustFrequencies(
+      IndexReaderContext readerContext, TermStates ctx, int artificialDf, long artificialTtf)
+      throws IOException {
     List<LeafReaderContext> leaves = readerContext.leaves();
     final int len;
     if (leaves == null) {
@@ -323,5 +331,4 @@ public final class BlendedTermQuery extends Query {
     newCtx.accumulateStatistics(artificialDf, artificialTtf);
     return newCtx;
   }
-
 }
diff --git a/lucene/core/src/java/org/apache/lucene/search/BlockMaxConjunctionScorer.java b/lucene/core/src/java/org/apache/lucene/search/BlockMaxConjunctionScorer.java
index 898a07d..7810726 100644
--- a/lucene/core/src/java/org/apache/lucene/search/BlockMaxConjunctionScorer.java
+++ b/lucene/core/src/java/org/apache/lucene/search/BlockMaxConjunctionScorer.java
@@ -24,8 +24,8 @@ import java.util.Comparator;
 import java.util.List;
 
 /**
- * Scorer for conjunctions that checks the maximum scores of each clause in
- * order to potentially skip over blocks that can't have competitive matches.
+ * Scorer for conjunctions that checks the maximum scores of each clause in order to potentially
+ * skip over blocks that can't have competitive matches.
  */
 final class BlockMaxConjunctionScorer extends Scorer {
   final Scorer[] scorers;
@@ -64,9 +64,8 @@ final class BlockMaxConjunctionScorer extends Scorer {
     if (twoPhases.length == 0) {
       return null;
     }
-    float matchCost = (float) Arrays.stream(twoPhases)
-        .mapToDouble(TwoPhaseIterator::matchCost)
-        .sum();
+    float matchCost =
+        (float) Arrays.stream(twoPhases).mapToDouble(TwoPhaseIterator::matchCost).sum();
     final DocIdSetIterator approx = approximation();
     return new TwoPhaseIterator(approx) {
       @Override
@@ -89,8 +88,9 @@ final class BlockMaxConjunctionScorer extends Scorer {
 
   @Override
   public DocIdSetIterator iterator() {
-    return twoPhases.length == 0 ? approximation() :
-        TwoPhaseIterator.asDocIdSetIterator(twoPhaseIterator());
+    return twoPhases.length == 0
+        ? approximation()
+        : TwoPhaseIterator.asDocIdSetIterator(twoPhaseIterator());
   }
 
   private DocIdSetIterator approximation() {
@@ -149,7 +149,8 @@ final class BlockMaxConjunctionScorer extends Scorer {
       }
 
       private int doNext(int doc) throws IOException {
-        advanceHead: for(;;) {
+        advanceHead:
+        for (; ; ) {
           assert doc == lead.docID();
 
           if (doc == NO_MORE_DOCS) {
@@ -179,7 +180,8 @@ final class BlockMaxConjunctionScorer extends Scorer {
               final int next = other.advance(doc);
 
               if (next > doc) {
-                // iterator beyond the current doc - advance lead and continue to the new highest doc.
+                // iterator beyond the current doc - advance lead and continue to the new highest
+                // doc.
                 doc = lead.advance(advanceTarget(next));
                 continue advanceHead;
               }
diff --git a/lucene/core/src/java/org/apache/lucene/search/BlockMaxDISI.java b/lucene/core/src/java/org/apache/lucene/search/BlockMaxDISI.java
index 804f96f..2f59d46 100644
--- a/lucene/core/src/java/org/apache/lucene/search/BlockMaxDISI.java
+++ b/lucene/core/src/java/org/apache/lucene/search/BlockMaxDISI.java
@@ -20,10 +20,10 @@ package org.apache.lucene.search;
 import java.io.IOException;
 
 /**
- * {@link DocIdSetIterator} that skips non-competitive docs by checking
- * the max score of the provided {@link Scorer} for the current block.
- * Call {@link #setMinCompetitiveScore(float)} in order to give this iterator the ability
- * to skip low-scoring documents.
+ * {@link DocIdSetIterator} that skips non-competitive docs by checking the max score of the
+ * provided {@link Scorer} for the current block. Call {@link #setMinCompetitiveScore(float)} in
+ * order to give this iterator the ability to skip low-scoring documents.
+ *
  * @lucene.internal
  */
 public class BlockMaxDISI extends DocIdSetIterator {
@@ -45,7 +45,7 @@ public class BlockMaxDISI extends DocIdSetIterator {
 
   @Override
   public int nextDoc() throws IOException {
-    return advance(docID()+1);
+    return advance(docID() + 1);
   }
 
   @Override
diff --git a/lucene/core/src/java/org/apache/lucene/search/Boolean2ScorerSupplier.java b/lucene/core/src/java/org/apache/lucene/search/Boolean2ScorerSupplier.java
index 78eac03..3fa5886 100644
--- a/lucene/core/src/java/org/apache/lucene/search/Boolean2ScorerSupplier.java
+++ b/lucene/core/src/java/org/apache/lucene/search/Boolean2ScorerSupplier.java
@@ -25,7 +25,6 @@ import java.util.List;
 import java.util.Map;
 import java.util.OptionalLong;
 import java.util.stream.Stream;
-
 import org.apache.lucene.search.BooleanClause.Occur;
 
 final class Boolean2ScorerSupplier extends ScorerSupplier {
@@ -36,20 +35,28 @@ final class Boolean2ScorerSupplier extends ScorerSupplier {
   private final int minShouldMatch;
   private long cost = -1;
 
-  Boolean2ScorerSupplier(Weight weight,
+  Boolean2ScorerSupplier(
+      Weight weight,
       Map<Occur, Collection<ScorerSupplier>> subs,
-      ScoreMode scoreMode, int minShouldMatch) {
+      ScoreMode scoreMode,
+      int minShouldMatch) {
     if (minShouldMatch < 0) {
-      throw new IllegalArgumentException("minShouldMatch must be positive, but got: " + minShouldMatch);
+      throw new IllegalArgumentException(
+          "minShouldMatch must be positive, but got: " + minShouldMatch);
     }
     if (minShouldMatch != 0 && minShouldMatch >= subs.get(Occur.SHOULD).size()) {
-      throw new IllegalArgumentException("minShouldMatch must be strictly less than the number of SHOULD clauses");
+      throw new IllegalArgumentException(
+          "minShouldMatch must be strictly less than the number of SHOULD clauses");
     }
-    if (scoreMode.needsScores() == false && minShouldMatch == 0 && subs.get(Occur.SHOULD).size() > 0
+    if (scoreMode.needsScores() == false
+        && minShouldMatch == 0
+        && subs.get(Occur.SHOULD).size() > 0
         && subs.get(Occur.MUST).size() + subs.get(Occur.FILTER).size() > 0) {
-      throw new IllegalArgumentException("Cannot pass purely optional clauses if scores are not needed");
+      throw new IllegalArgumentException(
+          "Cannot pass purely optional clauses if scores are not needed");
     }
-    if (subs.get(Occur.SHOULD).size() + subs.get(Occur.MUST).size() + subs.get(Occur.FILTER).size() == 0) {
+    if (subs.get(Occur.SHOULD).size() + subs.get(Occur.MUST).size() + subs.get(Occur.FILTER).size()
+        == 0) {
       throw new IllegalArgumentException("There should be at least one positive clause");
     }
     this.weight = weight;
@@ -59,18 +66,19 @@ final class Boolean2ScorerSupplier extends ScorerSupplier {
   }
 
   private long computeCost() {
-    OptionalLong minRequiredCost = Stream.concat(
-        subs.get(Occur.MUST).stream(),
-        subs.get(Occur.FILTER).stream())
-        .mapToLong(ScorerSupplier::cost)
-        .min();
+    OptionalLong minRequiredCost =
+        Stream.concat(subs.get(Occur.MUST).stream(), subs.get(Occur.FILTER).stream())
+            .mapToLong(ScorerSupplier::cost)
+            .min();
     if (minRequiredCost.isPresent() && minShouldMatch == 0) {
       return minRequiredCost.getAsLong();
     } else {
       final Collection<ScorerSupplier> optionalScorers = subs.get(Occur.SHOULD);
-      final long shouldCost = MinShouldMatchSumScorer.cost(
-          optionalScorers.stream().mapToLong(ScorerSupplier::cost),
-          optionalScorers.size(), minShouldMatch);
+      final long shouldCost =
+          MinShouldMatchSumScorer.cost(
+              optionalScorers.stream().mapToLong(ScorerSupplier::cost),
+              optionalScorers.size(),
+              minShouldMatch);
       return Math.min(minRequiredCost.orElse(Long.MAX_VALUE), shouldCost);
     }
   }
@@ -86,13 +94,14 @@ final class Boolean2ScorerSupplier extends ScorerSupplier {
   @Override
   public Scorer get(long leadCost) throws IOException {
     Scorer scorer = getInternal(leadCost);
-    if (scoreMode == ScoreMode.TOP_SCORES &&
-          subs.get(Occur.SHOULD).isEmpty() && subs.get(Occur.MUST).isEmpty()) {
+    if (scoreMode == ScoreMode.TOP_SCORES
+        && subs.get(Occur.SHOULD).isEmpty()
+        && subs.get(Occur.MUST).isEmpty()) {
       // no scoring clauses but scores are needed so we wrap the scorer in
       // a constant score in order to allow early termination
-      return scorer.twoPhaseIterator() != null ?
-          new ConstantScoreScorer(weight, 0f, scoreMode, scorer.twoPhaseIterator()) :
-            new ConstantScoreScorer(weight, 0f, scoreMode, scorer.iterator());
+      return scorer.twoPhaseIterator() != null
+          ? new ConstantScoreScorer(weight, 0f, scoreMode, scorer.twoPhaseIterator())
+          : new ConstantScoreScorer(weight, 0f, scoreMode, scorer.iterator());
     }
     return scorer;
   }
@@ -103,12 +112,18 @@ final class Boolean2ScorerSupplier extends ScorerSupplier {
 
     // pure conjunction
     if (subs.get(Occur.SHOULD).isEmpty()) {
-      return excl(req(subs.get(Occur.FILTER), subs.get(Occur.MUST), leadCost), subs.get(Occur.MUST_NOT), leadCost);
+      return excl(
+          req(subs.get(Occur.FILTER), subs.get(Occur.MUST), leadCost),
+          subs.get(Occur.MUST_NOT),
+          leadCost);
     }
 
     // pure disjunction
     if (subs.get(Occur.FILTER).isEmpty() && subs.get(Occur.MUST).isEmpty()) {
-      return excl(opt(subs.get(Occur.SHOULD), minShouldMatch, scoreMode, leadCost), subs.get(Occur.MUST_NOT), leadCost);
+      return excl(
+          opt(subs.get(Occur.SHOULD), minShouldMatch, scoreMode, leadCost),
+          subs.get(Occur.MUST_NOT),
+          leadCost);
     }
 
     // conjunction-disjunction mix:
@@ -117,23 +132,40 @@ final class Boolean2ScorerSupplier extends ScorerSupplier {
     // optional side must match. otherwise it's required + optional
 
     if (minShouldMatch > 0) {
-      Scorer req = excl(req(subs.get(Occur.FILTER), subs.get(Occur.MUST), leadCost), subs.get(Occur.MUST_NOT), leadCost);
+      Scorer req =
+          excl(
+              req(subs.get(Occur.FILTER), subs.get(Occur.MUST), leadCost),
+              subs.get(Occur.MUST_NOT),
+              leadCost);
       Scorer opt = opt(subs.get(Occur.SHOULD), minShouldMatch, scoreMode, leadCost);
       return new ConjunctionScorer(weight, Arrays.asList(req, opt), Arrays.asList(req, opt));
     } else {
       assert scoreMode.needsScores();
       return new ReqOptSumScorer(
-          excl(req(subs.get(Occur.FILTER), subs.get(Occur.MUST), leadCost), subs.get(Occur.MUST_NOT), leadCost),
-          opt(subs.get(Occur.SHOULD), minShouldMatch, scoreMode, leadCost), scoreMode);
+          excl(
+              req(subs.get(Occur.FILTER), subs.get(Occur.MUST), leadCost),
+              subs.get(Occur.MUST_NOT),
+              leadCost),
+          opt(subs.get(Occur.SHOULD), minShouldMatch, scoreMode, leadCost),
+          scoreMode);
     }
   }
 
-  /** Create a new scorer for the given required clauses. Note that
-   *  {@code requiredScoring} is a subset of {@code required} containing
-   *  required clauses that should participate in scoring. */
-  private Scorer req(Collection<ScorerSupplier> requiredNoScoring, Collection<ScorerSupplier> requiredScoring, long leadCost) throws IOException {
+  /**
+   * Create a new scorer for the given required clauses. Note that {@code requiredScoring} is a
+   * subset of {@code required} containing required clauses that should participate in scoring.
+   */
+  private Scorer req(
+      Collection<ScorerSupplier> requiredNoScoring,
+      Collection<ScorerSupplier> requiredScoring,
+      long leadCost)
+      throws IOException {
     if (requiredNoScoring.size() + requiredScoring.size() == 1) {
-      Scorer req = (requiredNoScoring.isEmpty() ? requiredScoring : requiredNoScoring).iterator().next().get(leadCost);
+      Scorer req =
+          (requiredNoScoring.isEmpty() ? requiredScoring : requiredNoScoring)
+              .iterator()
+              .next()
+              .get(leadCost);
 
       if (scoreMode.needsScores() == false) {
         return req;
@@ -148,6 +180,7 @@ final class Boolean2ScorerSupplier extends ScorerSupplier {
           public float score() throws IOException {
             return 0f;
           }
+
           @Override
           public float getMaxScore(int upTo) throws IOException {
             return 0f;
@@ -178,7 +211,8 @@ final class Boolean2ScorerSupplier extends ScorerSupplier {
     }
   }
 
-  private Scorer excl(Scorer main, Collection<ScorerSupplier> prohibited, long leadCost) throws IOException {
+  private Scorer excl(Scorer main, Collection<ScorerSupplier> prohibited, long leadCost)
+      throws IOException {
     if (prohibited.isEmpty()) {
       return main;
     } else {
@@ -186,8 +220,9 @@ final class Boolean2ScorerSupplier extends ScorerSupplier {
     }
   }
 
-  private Scorer opt(Collection<ScorerSupplier> optional, int minShouldMatch,
-      ScoreMode scoreMode, long leadCost) throws IOException {
+  private Scorer opt(
+      Collection<ScorerSupplier> optional, int minShouldMatch, ScoreMode scoreMode, long leadCost)
+      throws IOException {
     if (optional.size() == 1) {
       return optional.iterator().next().get(leadCost);
     } else {
@@ -204,5 +239,4 @@ final class Boolean2ScorerSupplier extends ScorerSupplier {
       }
     }
   }
-
 }
diff --git a/lucene/core/src/java/org/apache/lucene/search/BooleanClause.java b/lucene/core/src/java/org/apache/lucene/search/BooleanClause.java
index f3931b1..8455e0c 100644
--- a/lucene/core/src/java/org/apache/lucene/search/BooleanClause.java
+++ b/lucene/core/src/java/org/apache/lucene/search/BooleanClause.java
@@ -16,50 +16,66 @@
  */
 package org.apache.lucene.search;
 
-
 import java.util.Objects;
 
 /** A clause in a BooleanQuery. */
 public final class BooleanClause {
-  
+
   /** Specifies how clauses are to occur in matching documents. */
   public static enum Occur {
 
     /** Use this operator for clauses that <i>must</i> appear in the matching documents. */
-    MUST     { @Override public String toString() { return "+"; } },
+    MUST {
+      @Override
+      public String toString() {
+        return "+";
+      }
+    },
 
     /** Like {@link #MUST} except that these clauses do not participate in scoring. */
-    FILTER   { @Override public String toString() { return "#"; } },
-
-    /** Use this operator for clauses that <i>should</i> appear in the 
-     * matching documents. For a BooleanQuery with no <code>MUST</code> 
-     * clauses one or more <code>SHOULD</code> clauses must match a document 
-     * for the BooleanQuery to match.
+    FILTER {
+      @Override
+      public String toString() {
+        return "#";
+      }
+    },
+
+    /**
+     * Use this operator for clauses that <i>should</i> appear in the matching documents. For a
+     * BooleanQuery with no <code>MUST</code> clauses one or more <code>SHOULD</code> clauses must
+     * match a document for the BooleanQuery to match.
+     *
      * @see BooleanQuery.Builder#setMinimumNumberShouldMatch
      */
-    SHOULD   { @Override public String toString() { return "";  } },
-
-    /** Use this operator for clauses that <i>must not</i> appear in the matching documents.
-     * Note that it is not possible to search for queries that only consist
-     * of a <code>MUST_NOT</code> clause. These clauses do not contribute to the
-     * score of documents. */
-    MUST_NOT { @Override public String toString() { return "-"; } };
-
+    SHOULD {
+      @Override
+      public String toString() {
+        return "";
+      }
+    },
+
+    /**
+     * Use this operator for clauses that <i>must not</i> appear in the matching documents. Note
+     * that it is not possible to search for queries that only consist of a <code>MUST_NOT</code>
+     * clause. These clauses do not contribute to the score of documents.
+     */
+    MUST_NOT {
+      @Override
+      public String toString() {
+        return "-";
+      }
+    };
   }
 
-  /** The query whose matching documents are combined by the boolean query.
-   */
+  /** The query whose matching documents are combined by the boolean query. */
   private final Query query;
 
   private final Occur occur;
 
-
-  /** Constructs a BooleanClause.
-  */ 
+  /** Constructs a BooleanClause. */
   public BooleanClause(Query query, Occur occur) {
     this.query = Objects.requireNonNull(query, "Query must not be null");
     this.occur = Objects.requireNonNull(occur, "Occur must not be null");
-    
   }
 
   public Occur getOccur() {
@@ -69,7 +85,7 @@ public final class BooleanClause {
   public Query getQuery() {
     return query;
   }
-  
+
   public boolean isProhibited() {
     return Occur.MUST_NOT == occur;
   }
@@ -85,20 +101,17 @@ public final class BooleanClause {
   /** Returns true if <code>o</code> is equal to this. */
   @Override
   public boolean equals(Object o) {
-    if (o == null || !(o instanceof BooleanClause))
-      return false;
-    BooleanClause other = (BooleanClause)o;
-    return this.query.equals(other.query)
-      && this.occur == other.occur;
+    if (o == null || !(o instanceof BooleanClause)) return false;
+    BooleanClause other = (BooleanClause) o;
+    return this.query.equals(other.query) && this.occur == other.occur;
   }
 
-  /** Returns a hash code value for this object.*/
+  /** Returns a hash code value for this object. */
   @Override
   public int hashCode() {
     return 31 * query.hashCode() + occur.hashCode();
   }
 
-
   @Override
   public String toString() {
     return occur.toString() + query.toString();
diff --git a/lucene/core/src/java/org/apache/lucene/search/BooleanQuery.java b/lucene/core/src/java/org/apache/lucene/search/BooleanQuery.java
index d23bed1..e74d63d 100644
--- a/lucene/core/src/java/org/apache/lucene/search/BooleanQuery.java
+++ b/lucene/core/src/java/org/apache/lucene/search/BooleanQuery.java
@@ -16,7 +16,6 @@
  */
 package org.apache.lucene.search;
 
-
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -31,37 +30,40 @@ import java.util.Map;
 import java.util.Objects;
 import java.util.Set;
 import java.util.function.Predicate;
-
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.search.BooleanClause.Occur;
 
-/** A Query that matches documents matching boolean combinations of other
-  * queries, e.g. {@link TermQuery}s, {@link PhraseQuery}s or other
-  * BooleanQuerys.
-  */
+/**
+ * A Query that matches documents matching boolean combinations of other queries, e.g. {@link
+ * TermQuery}s, {@link PhraseQuery}s or other BooleanQuerys.
+ */
 public class BooleanQuery extends Query implements Iterable<BooleanClause> {
 
-  /** Thrown when an attempt is made to add more than {@link
-   * #getMaxClauseCount()} clauses. This typically happens if
-   * a PrefixQuery, FuzzyQuery, WildcardQuery, or TermRangeQuery
-   * is expanded to many terms during search.
+  /**
+   * Thrown when an attempt is made to add more than {@link #getMaxClauseCount()} clauses. This
+   * typically happens if a PrefixQuery, FuzzyQuery, WildcardQuery, or TermRangeQuery is expanded to
+   * many terms during search.
+   *
    * @deprecated use {@link IndexSearcher.TooManyClauses}
    */
   @Deprecated // Remove in Lucene 10
-  public static class TooManyClauses extends IndexSearcher.TooManyClauses { }
+  public static class TooManyClauses extends IndexSearcher.TooManyClauses {}
 
-  /** Return the maximum number of clauses permitted, 1024 by default.
-   * Attempts to add more than the permitted number of clauses cause {@link
-   * TooManyClauses} to be thrown.
+  /**
+   * Return the maximum number of clauses permitted, 1024 by default. Attempts to add more than the
+   * permitted number of clauses cause {@link TooManyClauses} to be thrown.
+   *
    * @see IndexSearcher#setMaxClauseCount(int)
    * @deprecated use {@link IndexSearcher#getMaxClauseCount()}
    */
   @Deprecated // Remove in Lucene 10
-  public static int getMaxClauseCount() { return IndexSearcher.getMaxClauseCount(); }
+  public static int getMaxClauseCount() {
+    return IndexSearcher.getMaxClauseCount();
+  }
 
   /**
-   * Set the maximum number of clauses permitted per BooleanQuery.
-   * Default value is 1024.
+   * Set the maximum number of clauses permitted per BooleanQuery. Default value is 1024.
+   *
    * @deprecated use {@link IndexSearcher#setMaxClauseCount(int)}
    */
   @Deprecated // Remove in Lucene 10
@@ -79,19 +81,14 @@ public class BooleanQuery extends Query implements Iterable<BooleanClause> {
     public Builder() {}
 
     /**
-     * Specifies a minimum number of the optional BooleanClauses
-     * which must be satisfied.
+     * Specifies a minimum number of the optional BooleanClauses which must be satisfied.
+     *
+     * <p>By default no optional clauses are necessary for a match (unless there are no required
+     * clauses). If this method is used, then the specified number of clauses is required.
      *
-     * <p>
-     * By default no optional clauses are necessary for a match
-     * (unless there are no required clauses).  If this method is used,
-     * then the specified number of clauses is required.
-     * </p>
-     * <p>
-     * Use of this method is totally independent of specifying that
-     * any specific clauses are required (or prohibited).  This number will
-     * only be compared against the number of matching optional clauses.
-     * </p>
+     * <p>Use of this method is totally independent of specifying that any specific clauses are
+     * required (or prohibited). This number will only be compared against the number of matching
+     * optional clauses.
      *
      * @param min the number of optional clauses that must match
      */
@@ -101,14 +98,15 @@ public class BooleanQuery extends Query implements Iterable<BooleanClause> {
     }
 
     /**
-     * Add a new clause to this {@link Builder}. Note that the order in which
-     * clauses are added does not have any impact on matching documents or query
-     * performance.
-     * @throws IndexSearcher.TooManyClauses if the new number of clauses exceeds the maximum clause number
+     * Add a new clause to this {@link Builder}. Note that the order in which clauses are added does
+     * not have any impact on matching documents or query performance.
+     *
+     * @throws IndexSearcher.TooManyClauses if the new number of clauses exceeds the maximum clause
+     *     number
      */
     public Builder add(BooleanClause clause) {
       // We do the final deep check for max clauses count limit during
-      //<code>IndexSearcher.rewrite</code> but do this check to short
+      // <code>IndexSearcher.rewrite</code> but do this check to short
       // circuit in case a single query holds more than numClauses
       if (clauses.size() >= IndexSearcher.maxClauseCount) {
         throw new IndexSearcher.TooManyClauses();
@@ -118,29 +116,29 @@ public class BooleanQuery extends Query implements Iterable<BooleanClause> {
     }
 
     /**
-     * Add a new clause to this {@link Builder}. Note that the order in which
-     * clauses are added does not have any impact on matching documents or query
-     * performance.
-     * @throws IndexSearcher.TooManyClauses if the new number of clauses exceeds the maximum clause number
+     * Add a new clause to this {@link Builder}. Note that the order in which clauses are added does
+     * not have any impact on matching documents or query performance.
+     *
+     * @throws IndexSearcher.TooManyClauses if the new number of clauses exceeds the maximum clause
+     *     number
      */
     public Builder add(Query query, Occur occur) {
       return add(new BooleanClause(query, occur));
     }
 
-    /** Create a new {@link BooleanQuery} based on the parameters that have
-     *  been set on this builder. */
+    /**
+     * Create a new {@link BooleanQuery} based on the parameters that have been set on this builder.
+     */
     public BooleanQuery build() {
       return new BooleanQuery(minimumNumberShouldMatch, clauses.toArray(new BooleanClause[0]));
     }
-
   }
 
   private final int minimumNumberShouldMatch;
-  private final List<BooleanClause> clauses;              // used for toString() and getClauses()
+  private final List<BooleanClause> clauses; // used for toString() and getClauses()
   private final Map<Occur, Collection<Query>> clauseSets; // used for equals/hashcode
 
-  private BooleanQuery(int minimumNumberShouldMatch,
-      BooleanClause[] clauses) {
+  private BooleanQuery(int minimumNumberShouldMatch, BooleanClause[] clauses) {
     this.minimumNumberShouldMatch = minimumNumberShouldMatch;
     this.clauses = Collections.unmodifiableList(Arrays.asList(clauses));
     clauseSets = new EnumMap<>(Occur.class);
@@ -155,10 +153,7 @@ public class BooleanQuery extends Query implements Iterable<BooleanClause> {
     }
   }
 
-  /**
-   * Gets the minimum number of the optional BooleanClauses
-   * which must be satisfied.
-   */
+  /** Gets the minimum number of the optional BooleanClauses which must be satisfied. */
   public int getMinimumNumberShouldMatch() {
     return minimumNumberShouldMatch;
   }
@@ -174,16 +169,17 @@ public class BooleanQuery extends Query implements Iterable<BooleanClause> {
   }
 
   /**
-   * Whether this query is a pure disjunction, ie. it only has SHOULD clauses
-   * and it is enough for a single clause to match for this boolean query to match.
+   * Whether this query is a pure disjunction, ie. it only has SHOULD clauses and it is enough for a
+   * single clause to match for this boolean query to match.
    */
   boolean isPureDisjunction() {
-    return clauses.size() == getClauses(Occur.SHOULD).size()
-        && minimumNumberShouldMatch <= 1;
+    return clauses.size() == getClauses(Occur.SHOULD).size() && minimumNumberShouldMatch <= 1;
   }
 
-  /** Returns an iterator on the clauses in this query. It implements the {@link Iterable} interface to
-   * make it possible to do:
+  /**
+   * Returns an iterator on the clauses in this query. It implements the {@link Iterable} interface
+   * to make it possible to do:
+   *
    * <pre class="prettyprint">for (BooleanClause clause : booleanQuery) {}</pre>
    */
   @Override
@@ -192,8 +188,9 @@ public class BooleanQuery extends Query implements Iterable<BooleanClause> {
   }
 
   private BooleanQuery rewriteNoScoring() {
-    boolean keepShould = getMinimumNumberShouldMatch() > 0
-        || (clauseSets.get(Occur.MUST).size() + clauseSets.get(Occur.FILTER).size() == 0);
+    boolean keepShould =
+        getMinimumNumberShouldMatch() > 0
+            || (clauseSets.get(Occur.MUST).size() + clauseSets.get(Occur.FILTER).size() == 0);
 
     if (clauseSets.get(Occur.MUST).size() == 0 && keepShould) {
       return this;
@@ -203,19 +200,22 @@ public class BooleanQuery extends Query implements Iterable<BooleanClause> {
     newQuery.setMinimumNumberShouldMatch(getMinimumNumberShouldMatch());
     for (BooleanClause clause : clauses) {
       switch (clause.getOccur()) {
-        case MUST: {
-          newQuery.add(clause.getQuery(), Occur.FILTER);
-          break;
-        }
-        case SHOULD: {
-          if (keepShould) {
+        case MUST:
+          {
+            newQuery.add(clause.getQuery(), Occur.FILTER);
+            break;
+          }
+        case SHOULD:
+          {
+            if (keepShould) {
+              newQuery.add(clause);
+            }
+            break;
+          }
+        default:
+          {
             newQuery.add(clause);
           }
-          break;
-        }
-        default: {
-          newQuery.add(clause);
-        }
       }
     }
 
@@ -223,7 +223,8 @@ public class BooleanQuery extends Query implements Iterable<BooleanClause> {
   }
 
   @Override
-  public Weight createWeight(IndexSearcher searcher, ScoreMode scoreMode, float boost) throws IOException {
+  public Weight createWeight(IndexSearcher searcher, ScoreMode scoreMode, float boost)
+      throws IOException {
     BooleanQuery query = this;
     if (scoreMode.needsScores() == false) {
       query = rewriteNoScoring();
@@ -236,7 +237,7 @@ public class BooleanQuery extends Query implements Iterable<BooleanClause> {
     if (clauses.size() == 0) {
       return new MatchNoDocsQuery("empty BooleanQuery");
     }
-    
+
     // optimize 1-clause queries
     if (clauses.size() == 1) {
       BooleanClause c = clauses.get(0);
@@ -379,9 +380,9 @@ public class BooleanQuery extends Query implements Iterable<BooleanClause> {
         shouldClauses.put(query, shouldClauses.getOrDefault(query, 0d) + boost);
       }
       if (shouldClauses.size() != clauseSets.get(Occur.SHOULD).size()) {
-        BooleanQuery.Builder builder = new BooleanQuery.Builder()
-            .setMinimumNumberShouldMatch(minimumNumberShouldMatch);
-        for (Map.Entry<Query,Double> entry : shouldClauses.entrySet()) {
+        BooleanQuery.Builder builder =
+            new BooleanQuery.Builder().setMinimumNumberShouldMatch(minimumNumberShouldMatch);
+        for (Map.Entry<Query, Double> entry : shouldClauses.entrySet()) {
           Query query = entry.getKey();
           float boost = entry.getValue().floatValue();
           if (boost != 1f) {
@@ -411,9 +412,9 @@ public class BooleanQuery extends Query implements Iterable<BooleanClause> {
         mustClauses.put(query, mustClauses.getOrDefault(query, 0d) + boost);
       }
       if (mustClauses.size() != clauseSets.get(Occur.MUST).size()) {
-        BooleanQuery.Builder builder = new BooleanQuery.Builder()
-            .setMinimumNumberShouldMatch(minimumNumberShouldMatch);
-        for (Map.Entry<Query,Double> entry : mustClauses.entrySet()) {
+        BooleanQuery.Builder builder =
+            new BooleanQuery.Builder().setMinimumNumberShouldMatch(minimumNumberShouldMatch);
+        for (Map.Entry<Query, Double> entry : mustClauses.entrySet()) {
           Query query = entry.getKey();
           float boost = entry.getValue().floatValue();
           if (boost != 1f) {
@@ -435,8 +436,7 @@ public class BooleanQuery extends Query implements Iterable<BooleanClause> {
     {
       final Collection<Query> musts = clauseSets.get(Occur.MUST);
       final Collection<Query> filters = clauseSets.get(Occur.FILTER);
-      if (musts.size() == 1
-          && filters.size() > 0) {
+      if (musts.size() == 1 && filters.size() > 0) {
         Query must = musts.iterator().next();
         float boost = 1f;
         if (must instanceof BoostQuery) {
@@ -466,9 +466,10 @@ public class BooleanQuery extends Query implements Iterable<BooleanClause> {
           }
 
           // now add back the SHOULD clauses
-          builder = new BooleanQuery.Builder()
-            .setMinimumNumberShouldMatch(getMinimumNumberShouldMatch())
-            .add(rewritten, Occur.MUST);
+          builder =
+              new BooleanQuery.Builder()
+                  .setMinimumNumberShouldMatch(getMinimumNumberShouldMatch())
+                  .add(rewritten, Occur.MUST);
           for (Query query : clauseSets.get(Occur.SHOULD)) {
             builder.add(query, Occur.SHOULD);
           }
@@ -515,8 +516,7 @@ public class BooleanQuery extends Query implements Iterable<BooleanClause> {
           for (Query q : clauseSets.get(occur)) {
             q.visit(sub);
           }
-        }
-        else {
+        } else {
           QueryVisitor v = sub.getSubVisitor(occur, this);
           for (Query q : clauseSets.get(occur)) {
             q.visit(v);
@@ -540,7 +540,7 @@ public class BooleanQuery extends Query implements Iterable<BooleanClause> {
       buffer.append(c.getOccur().toString());
 
       Query subQuery = c.getQuery();
-      if (subQuery instanceof BooleanQuery) {  // wrap sub-bools in parens
+      if (subQuery instanceof BooleanQuery) { // wrap sub-bools in parens
         buffer.append("(");
         buffer.append(subQuery.toString(field));
         buffer.append(")");
@@ -558,7 +558,7 @@ public class BooleanQuery extends Query implements Iterable<BooleanClause> {
       buffer.append(")");
     }
 
-    if (getMinimumNumberShouldMatch()>0) {
+    if (getMinimumNumberShouldMatch() > 0) {
       buffer.append('~');
       buffer.append(getMinimumNumberShouldMatch());
     }
@@ -567,26 +567,28 @@ public class BooleanQuery extends Query implements Iterable<BooleanClause> {
   }
 
   /**
-   * Compares the specified object with this boolean query for equality.
-   * Returns true if and only if the provided object<ul>
-   * <li>is also a {@link BooleanQuery},</li>
-   * <li>has the same value of {@link #getMinimumNumberShouldMatch()}</li>
-   * <li>has the same {@link Occur#SHOULD} clauses, regardless of the order</li>
-   * <li>has the same {@link Occur#MUST} clauses, regardless of the order</li>
-   * <li>has the same set of {@link Occur#FILTER} clauses, regardless of the
-   * order and regardless of duplicates</li>
-   * <li>has the same set of {@link Occur#MUST_NOT} clauses, regardless of
-   * the order and regardless of duplicates</li></ul>
+   * Compares the specified object with this boolean query for equality. Returns true if and only if
+   * the provided object
+   *
+   * <ul>
+   *   <li>is also a {@link BooleanQuery},
+   *   <li>has the same value of {@link #getMinimumNumberShouldMatch()}
+   *   <li>has the same {@link Occur#SHOULD} clauses, regardless of the order
+   *   <li>has the same {@link Occur#MUST} clauses, regardless of the order
+   *   <li>has the same set of {@link Occur#FILTER} clauses, regardless of the order and regardless
+   *       of duplicates
+   *   <li>has the same set of {@link Occur#MUST_NOT} clauses, regardless of the order and
+   *       regardless of duplicates
+   * </ul>
    */
   @Override
   public boolean equals(Object o) {
-    return sameClassAs(o) &&
-           equalsTo(getClass().cast(o));
+    return sameClassAs(o) && equalsTo(getClass().cast(o));
   }
 
   private boolean equalsTo(BooleanQuery other) {
-    return getMinimumNumberShouldMatch() == other.getMinimumNumberShouldMatch() && 
-           clauseSets.equals(other.clauseSets);
+    return getMinimumNumberShouldMatch() == other.getMinimumNumberShouldMatch()
+        && clauseSets.equals(other.clauseSets);
   }
 
   private int computeHashCode() {
@@ -610,5 +612,4 @@ public class BooleanQuery extends Query implements Iterable<BooleanClause> {
     assert hashCode == computeHashCode();
     return hashCode;
   }
-
 }
diff --git a/lucene/core/src/java/org/apache/lucene/search/BooleanScorer.java b/lucene/core/src/java/org/apache/lucene/search/BooleanScorer.java
index e1b0399..9aa25b8 100644
--- a/lucene/core/src/java/org/apache/lucene/search/BooleanScorer.java
+++ b/lucene/core/src/java/org/apache/lucene/search/BooleanScorer.java
@@ -16,19 +16,17 @@
  */
 package org.apache.lucene.search;
 
-
 import java.io.IOException;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Objects;
-
 import org.apache.lucene.util.Bits;
 import org.apache.lucene.util.PriorityQueue;
 
 /**
- * {@link BulkScorer} that is used for pure disjunctions and disjunctions
- * that have low values of {@link BooleanQuery.Builder#setMinimumNumberShouldMatch(int)}
- * and dense clauses. This scorer scores documents by batches of 2048 docs.
+ * {@link BulkScorer} that is used for pure disjunctions and disjunctions that have low values of
+ * {@link BooleanQuery.Builder#setMinimumNumberShouldMatch(int)} and dense clauses. This scorer
+ * scores documents by batches of 2048 docs.
  */
 final class BooleanScorer extends BulkScorer {
 
@@ -65,12 +63,13 @@ final class BooleanScorer extends BulkScorer {
 
   // See MinShouldMatchSumScorer for an explanation
   private static long cost(Collection<BulkScorer> scorers, int minShouldMatch) {
-    final PriorityQueue<BulkScorer> pq = new PriorityQueue<BulkScorer>(scorers.size() - minShouldMatch + 1) {
-      @Override
-      protected boolean lessThan(BulkScorer a, BulkScorer b) {
-        return a.cost() > b.cost();
-      }
-    };
+    final PriorityQueue<BulkScorer> pq =
+        new PriorityQueue<BulkScorer>(scorers.size() - minShouldMatch + 1) {
+          @Override
+          protected boolean lessThan(BulkScorer a, BulkScorer b) {
+            return a.cost() > b.cost();
+          }
+        };
     for (BulkScorer scorer : scorers) {
       pq.insertWithOverflow(scorer);
     }
@@ -91,7 +90,6 @@ final class BooleanScorer extends BulkScorer {
     protected boolean lessThan(BulkScorerAndDoc a, BulkScorerAndDoc b) {
       return a.next < b.next;
     }
-
   }
 
   static final class TailPriorityQueue extends PriorityQueue<BulkScorerAndDoc> {
@@ -109,7 +107,6 @@ final class BooleanScorer extends BulkScorer {
       Objects.checkIndex(i, size());
       return (BulkScorerAndDoc) getHeapArray()[1 + i];
     }
-
   }
 
   final Bucket[] buckets = new Bucket[SIZE];
@@ -144,12 +141,18 @@ final class BooleanScorer extends BulkScorer {
 
   final OrCollector orCollector = new OrCollector();
 
-  BooleanScorer(BooleanWeight weight, Collection<BulkScorer> scorers, int minShouldMatch, boolean needsScores) {
+  BooleanScorer(
+      BooleanWeight weight,
+      Collection<BulkScorer> scorers,
+      int minShouldMatch,
+      boolean needsScores) {
     if (minShouldMatch < 1 || minShouldMatch > scorers.size()) {
-      throw new IllegalArgumentException("minShouldMatch should be within 1..num_scorers. Got " + minShouldMatch);
+      throw new IllegalArgumentException(
+          "minShouldMatch should be within 1..num_scorers. Got " + minShouldMatch);
     }
     if (scorers.size() <= 1) {
-      throw new IllegalArgumentException("This scorer can only be used with two scorers or more, got " + scorers.size());
+      throw new IllegalArgumentException(
+          "This scorer can only be used with two scorers or more, got " + scorers.size());
     }
     for (int i = 0; i < buckets.length; i++) {
       buckets[i] = new Bucket();
@@ -203,8 +206,15 @@ final class BooleanScorer extends BulkScorer {
     }
   }
 
-  private void scoreWindowIntoBitSetAndReplay(LeafCollector collector, Bits acceptDocs,
-      int base, int min, int max, BulkScorerAndDoc[] scorers, int numScorers) throws IOException {
+  private void scoreWindowIntoBitSetAndReplay(
+      LeafCollector collector,
+      Bits acceptDocs,
+      int base,
+      int min,
+      int max,
+      BulkScorerAndDoc[] scorers,
+      int numScorers)
+      throws IOException {
     for (int i = 0; i < numScorers; ++i) {
       final BulkScorerAndDoc scorer = scorers[i];
       assert scorer.next < max;
@@ -236,7 +246,14 @@ final class BooleanScorer extends BulkScorer {
     return headTop;
   }
 
-  private void scoreWindowMultipleScorers(LeafCollector collector, Bits acceptDocs, int windowBase, int windowMin, int windowMax, int maxFreq) throws IOException {
+  private void scoreWindowMultipleScorers(
+      LeafCollector collector,
+      Bits acceptDocs,
+      int windowBase,
+      int windowMin,
+      int windowMax,
+      int maxFreq)
+      throws IOException {
     while (maxFreq < minShouldMatch && maxFreq + tail.size() >= minShouldMatch) {
       // a match is still possible
       final BulkScorerAndDoc candidate = tail.pop();
@@ -255,7 +272,8 @@ final class BooleanScorer extends BulkScorer {
       }
       tail.clear();
 
-      scoreWindowIntoBitSetAndReplay(collector, acceptDocs, windowBase, windowMin, windowMax, leads, maxFreq);
+      scoreWindowIntoBitSetAndReplay(
+          collector, acceptDocs, windowBase, windowMin, windowMax, leads, maxFreq);
     }
 
     // Push back scorers into head and tail
@@ -267,8 +285,14 @@ final class BooleanScorer extends BulkScorer {
     }
   }
 
-  private void scoreWindowSingleScorer(BulkScorerAndDoc bulkScorer, LeafCollector collector,
-      Bits acceptDocs, int windowMin, int windowMax, int max) throws IOException {
+  private void scoreWindowSingleScorer(
+      BulkScorerAndDoc bulkScorer,
+      LeafCollector collector,
+      Bits acceptDocs,
+      int windowMin,
+      int windowMax,
+      int max)
+      throws IOException {
     assert tail.size() == 0;
     final int nextWindowBase = head.top().next & ~MASK;
     final int end = Math.max(windowMax, Math.min(max, nextWindowBase));
@@ -279,8 +303,9 @@ final class BooleanScorer extends BulkScorer {
     collector.setScorer(scoreAndDoc);
   }
 
-  private BulkScorerAndDoc scoreWindow(BulkScorerAndDoc top, LeafCollector collector,
-      Bits acceptDocs, int min, int max) throws IOException {
+  private BulkScorerAndDoc scoreWindow(
+      BulkScorerAndDoc top, LeafCollector collector, Bits acceptDocs, int min, int max)
+      throws IOException {
     final int windowBase = top.next & ~MASK; // find the window that the next match belongs to
     final int windowMin = Math.max(min, windowBase);
     final int windowMax = Math.min(max, windowBase + SIZE);
@@ -317,5 +342,4 @@ final class BooleanScorer extends BulkScorer {
 
     return top.next;
   }
-
 }
diff --git a/lucene/core/src/java/org/apache/lucene/search/BooleanWeight.java b/lucene/core/src/java/org/apache/lucene/search/BooleanWeight.java
index 59bdd32..dffdbf7 100644
--- a/lucene/core/src/java/org/apache/lucene/search/BooleanWeight.java
+++ b/lucene/core/src/java/org/apache/lucene/search/BooleanWeight.java
@@ -16,26 +16,22 @@
  */
 package org.apache.lucene.search;
 
-
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.EnumMap;
 import java.util.List;
 import java.util.Map;
-
 import org.apache.lucene.index.LeafReaderContext;
 import org.apache.lucene.search.BooleanClause.Occur;
 import org.apache.lucene.search.similarities.Similarity;
 import org.apache.lucene.util.Bits;
 
-/**
- * Expert: the Weight for BooleanQuery, used to
- * normalize, score and explain these queries.
- */
+/** Expert: the Weight for BooleanQuery, used to normalize, score and explain these queries. */
 final class BooleanWeight extends Weight {
   /** The Similarity implementation. */
   final Similarity similarity;
+
   final BooleanQuery query;
 
   private static class WeightedBooleanClause {
@@ -51,14 +47,17 @@ final class BooleanWeight extends Weight {
   final ArrayList<WeightedBooleanClause> weightedClauses;
   final ScoreMode scoreMode;
 
-  BooleanWeight(BooleanQuery query, IndexSearcher searcher, ScoreMode scoreMode, float boost) throws IOException {
+  BooleanWeight(BooleanQuery query, IndexSearcher searcher, ScoreMode scoreMode, float boost)
+      throws IOException {
     super(query);
     this.query = query;
     this.scoreMode = scoreMode;
     this.similarity = searcher.getSimilarity();
     weightedClauses = new ArrayList<>();
     for (BooleanClause c : query) {
-      Weight w = searcher.createWeight(c.getQuery(), c.isScoring() ? scoreMode : ScoreMode.COMPLETE_NO_SCORES, boost);
+      Weight w =
+          searcher.createWeight(
+              c.getQuery(), c.isScoring() ? scoreMode : ScoreMode.COMPLETE_NO_SCORES, boost);
       weightedClauses.add(new WeightedBooleanClause(c, w));
     }
   }
@@ -78,10 +77,16 @@ final class BooleanWeight extends Weight {
         if (c.isScoring()) {
           subs.add(e);
         } else if (c.isRequired()) {
-          subs.add(Explanation.match(0f, "match on required clause, product of:",
-              Explanation.match(0f, Occur.FILTER + " clause"), e));
+          subs.add(
+              Explanation.match(
+                  0f,
+                  "match on required clause, product of:",
+                  Explanation.match(0f, Occur.FILTER + " clause"),
+                  e));
         } else if (c.isProhibited()) {
-          subs.add(Explanation.noMatch("match on prohibited clause (" + c.getQuery().toString() + ")", e));
+          subs.add(
+              Explanation.noMatch(
+                  "match on prohibited clause (" + c.getQuery().toString() + ")", e));
           fail = true;
         }
         if (!c.isProhibited()) {
@@ -91,16 +96,20 @@ final class BooleanWeight extends Weight {
           shouldMatchCount++;
         }
       } else if (c.isRequired()) {
-        subs.add(Explanation.noMatch("no match on required clause (" + c.getQuery().toString() + ")", e));
+        subs.add(
+            Explanation.noMatch(
+                "no match on required clause (" + c.getQuery().toString() + ")", e));
         fail = true;
       }
     }
     if (fail) {
-      return Explanation.noMatch("Failure to meet condition(s) of required/prohibited clause(s)", subs);
+      return Explanation.noMatch(
+          "Failure to meet condition(s) of required/prohibited clause(s)", subs);
     } else if (matchCount == 0) {
       return Explanation.noMatch("No matching clauses", subs);
     } else if (shouldMatchCount < minShouldMatch) {
-      return Explanation.noMatch("Failure to match minimum number of optional clauses: " + minShouldMatch, subs);
+      return Explanation.noMatch(
+          "Failure to match minimum number of optional clauses: " + minShouldMatch, subs);
     } else {
       // Replicating the same floating-point errors as the scorer does is quite
       // complex (essentially because of how ReqOptSumScorer casts intermediate
@@ -151,21 +160,23 @@ final class BooleanWeight extends Weight {
     return new BulkScorer() {
 
       @Override
-      public int score(final LeafCollector collector, Bits acceptDocs, int min, int max) throws IOException {
-        final LeafCollector noScoreCollector = new LeafCollector() {
-          ScoreAndDoc fake = new ScoreAndDoc();
-
-          @Override
-          public void setScorer(Scorable scorer) throws IOException {
-            collector.setScorer(fake);
-          }
-
-          @Override
-          public void collect(int doc) throws IOException {
-            fake.doc = doc;
-            collector.collect(doc);
-          }
-        };
+      public int score(final LeafCollector collector, Bits acceptDocs, int min, int max)
+          throws IOException {
+        final LeafCollector noScoreCollector =
+            new LeafCollector() {
+              ScoreAndDoc fake = new ScoreAndDoc();
+
+              @Override
+              public void setScorer(Scorable scorer) throws IOException {
+                collector.setScorer(fake);
+              }
+
+              @Override
+              public void collect(int doc) throws IOException {
+                fake.doc = doc;
+                collector.collect(doc);
+              }
+            };
         return scorer.score(noScoreCollector, acceptDocs, min, max);
       }
 
@@ -206,7 +217,8 @@ final class BooleanWeight extends Weight {
       return optional.get(0);
     }
 
-    return new BooleanScorer(this, optional, Math.max(1, query.getMinimumNumberShouldMatch()), scoreMode.needsScores());
+    return new BooleanScorer(
+        this, optional, Math.max(1, query.getMinimumNumberShouldMatch()), scoreMode.needsScores());
   }
 
   // Return a BulkScorer for the required clauses only,
@@ -236,12 +248,15 @@ final class BooleanWeight extends Weight {
     return scorer;
   }
 
-  /** Try to build a boolean scorer for this weight. Returns null if {@link BooleanScorer}
-   *  cannot be used. */
+  /**
+   * Try to build a boolean scorer for this weight. Returns null if {@link BooleanScorer} cannot be
+   * used.
+   */
   BulkScorer booleanScorer(LeafReaderContext context) throws IOException {
     final int numOptionalClauses = query.getClauses(Occur.SHOULD).size();
-    final int numRequiredClauses = query.getClauses(Occur.MUST).size() + query.getClauses(Occur.FILTER).size();
-    
+    final int numRequiredClauses =
+        query.getClauses(Occur.MUST).size() + query.getClauses(Occur.FILTER).size();
+
     BulkScorer positiveScorer;
     if (numRequiredClauses == 0) {
       positiveScorer = optionalBulkScorer(context);
@@ -300,9 +315,10 @@ final class BooleanWeight extends Weight {
     if (prohibited.isEmpty()) {
       return positiveScorer;
     } else {
-      Scorer prohibitedScorer = prohibited.size() == 1
-          ? prohibited.get(0)
-          : new DisjunctionSumScorer(this, prohibited, ScoreMode.COMPLETE_NO_SCORES);
+      Scorer prohibitedScorer =
+          prohibited.size() == 1
+              ? prohibited.get(0)
+              : new DisjunctionSumScorer(this, prohibited, ScoreMode.COMPLETE_NO_SCORES);
       if (prohibitedScorer.twoPhaseIterator() != null) {
         // ReqExclBulkScorer can't deal efficiently with two-phased prohibited clauses
         return null;
@@ -347,8 +363,7 @@ final class BooleanWeight extends Weight {
     }
     for (WeightedBooleanClause wc : weightedClauses) {
       Weight w = wc.weight;
-      if (w.isCacheable(ctx) == false)
-        return false;
+      if (w.isCacheable(ctx) == false) return false;
     }
     return true;
   }
@@ -376,15 +391,17 @@ final class BooleanWeight extends Weight {
     }
 
     // scorer simplifications:
-    
+
     if (scorers.get(Occur.SHOULD).size() == minShouldMatch) {
       // any optional clauses are in fact required
       scorers.get(Occur.MUST).addAll(scorers.get(Occur.SHOULD));
       scorers.get(Occur.SHOULD).clear();
       minShouldMatch = 0;
     }
-    
-    if (scorers.get(Occur.FILTER).isEmpty() && scorers.get(Occur.MUST).isEmpty() && scorers.get(Occur.SHOULD).isEmpty()) {
+
+    if (scorers.get(Occur.FILTER).isEmpty()
+        && scorers.get(Occur.MUST).isEmpty()
+        && scorers.get(Occur.SHOULD).isEmpty()) {
       // no required and optional clauses.
       return null;
     } else if (scorers.get(Occur.SHOULD).size() < minShouldMatch) {
@@ -396,5 +413,4 @@ final class BooleanWeight extends Weight {
 
     return new Boolean2ScorerSupplier(this, scorers, scoreMode, minShouldMatch);
   }
-
 }
diff --git a/lucene/core/src/java/org/apache/lucene/search/BoostAttribute.java b/lucene/core/src/java/org/apache/lucene/search/BoostAttribute.java
index 9030b57..0a1570e 100644
--- a/lucene/core/src/java/org/apache/lucene/search/BoostAttribute.java
+++ b/lucene/core/src/java/org/apache/lucene/search/BoostAttribute.java
@@ -16,19 +16,21 @@
  */
 package org.apache.lucene.search;
 
-
+import org.apache.lucene.index.Terms; // javadocs only
+import org.apache.lucene.index.TermsEnum; // javadocs only
 import org.apache.lucene.util.Attribute;
 import org.apache.lucene.util.AttributeSource; // javadocs only
-import org.apache.lucene.index.TermsEnum; // javadocs only
-import org.apache.lucene.index.Terms; // javadocs only
 
-/** Add this {@link Attribute} to a {@link TermsEnum} returned by {@link MultiTermQuery#getTermsEnum(Terms,AttributeSource)}
- * and update the boost on each returned term. This enables to control the boost factor
- * for each matching term in {@link MultiTermQuery#SCORING_BOOLEAN_REWRITE} or
- * {@link TopTermsRewrite} mode.
- * {@link FuzzyQuery} is using this to take the edit distance into account.
- * <p><b>Please note:</b> This attribute is intended to be added only by the TermsEnum
- * to itself in its constructor and consumed by the {@link MultiTermQuery.RewriteMethod}.
+/**
+ * Add this {@link Attribute} to a {@link TermsEnum} returned by {@link
+ * MultiTermQuery#getTermsEnum(Terms,AttributeSource)} and update the boost on each returned term.
+ * This enables to control the boost factor for each matching term in {@link
+ * MultiTermQuery#SCORING_BOOLEAN_REWRITE} or {@link TopTermsRewrite} mode. {@link FuzzyQuery} is
+ * using this to take the edit distance into account.
+ *
+ * <p><b>Please note:</b> This attribute is intended to be added only by the TermsEnum to itself in
+ * its constructor and consumed by the {@link MultiTermQuery.RewriteMethod}.
+ *
  * @lucene.internal
  */
 public interface BoostAttribute extends Attribute {
diff --git a/lucene/core/src/java/org/apache/lucene/search/BoostAttributeImpl.java b/lucene/core/src/java/org/apache/lucene/search/BoostAttributeImpl.java
index 9eced23..f7f218e3 100644
--- a/lucene/core/src/java/org/apache/lucene/search/BoostAttributeImpl.java
+++ b/lucene/core/src/java/org/apache/lucene/search/BoostAttributeImpl.java
@@ -16,11 +16,12 @@
  */
 package org.apache.lucene.search;
 
-
 import org.apache.lucene.util.AttributeImpl;
 import org.apache.lucene.util.AttributeReflector;
 
-/** Implementation class for {@link BoostAttribute}.
+/**
+ * Implementation class for {@link BoostAttribute}.
+ *
  * @lucene.internal
  */
 public final class BoostAttributeImpl extends AttributeImpl implements BoostAttribute {
@@ -30,7 +31,7 @@ public final class BoostAttributeImpl extends AttributeImpl implements BoostAttr
   public void setBoost(float boost) {
     this.boost = boost;
   }
-  
+
   @Override
   public float getBoost() {
     return boost;
@@ -40,7 +41,7 @@ public final class BoostAttributeImpl extends AttributeImpl implements BoostAttr
   public void clear() {
     boost = 1.0f;
   }
-  
+
   @Override
   public void copyTo(AttributeImpl target) {
     ((BoostAttribute) target).setBoost(boost);
diff --git a/lucene/core/src/java/org/apache/lucene/search/BoostQuery.java b/lucene/core/src/java/org/apache/lucene/search/BoostQuery.java
index 5f04363..172ea00 100644
--- a/lucene/core/src/java/org/apache/lucene/search/BoostQuery.java
+++ b/lucene/core/src/java/org/apache/lucene/search/BoostQuery.java
@@ -16,28 +16,26 @@
  */
 package org.apache.lucene.search;
 
-
 import java.io.IOException;
 import java.util.Objects;
-
 import org.apache.lucene.index.IndexReader;
 
 /**
- * A {@link Query} wrapper that allows to give a boost to the wrapped query.
- * Boost values that are less than one will give less importance to this
- * query compared to other ones while values that are greater than one will
- * give more importance to the scores returned by this query.
+ * A {@link Query} wrapper that allows to give a boost to the wrapped query. Boost values that are
+ * less than one will give less importance to this query compared to other ones while values that
+ * are greater than one will give more importance to the scores returned by this query.
  *
- * More complex boosts can be applied by using FunctionScoreQuery in the
- * lucene-queries module
+ * <p>More complex boosts can be applied by using FunctionScoreQuery in the lucene-queries module
  */
 public final class BoostQuery extends Query {
 
   private final Query query;
   private final float boost;
 
-  /** Sole constructor: wrap {@code query} in such a way that the produced
-   *  scores will be boosted by {@code boost}. */
+  /**
+   * Sole constructor: wrap {@code query} in such a way that the produced scores will be boosted by
+   * {@code boost}.
+   */
   public BoostQuery(Query query, float boost) {
     this.query = Objects.requireNonNull(query);
     if (Float.isFinite(boost) == false || Float.compare(boost, 0f) < 0) {
@@ -46,29 +44,24 @@ public final class BoostQuery extends Query {
     this.boost = boost;
   }
 
-  /**
-   * Return the wrapped {@link Query}.
-   */
+  /** Return the wrapped {@link Query}. */
   public Query getQuery() {
     return query;
   }
 
-  /**
-   * Return the applied boost.
-   */
+  /** Return the applied boost. */
   public float getBoost() {
     return boost;
   }
 
   @Override
   public boolean equals(Object other) {
-    return sameClassAs(other) &&
-           equalsTo(getClass().cast(other));
+    return sameClassAs(other) && equalsTo(getClass().cast(other));
   }
-  
+
   private boolean equalsTo(BoostQuery other) {
-    return query.equals(other.query) && 
-           Float.floatToIntBits(boost) == Float.floatToIntBits(other.boost);
+    return query.equals(other.query)
+        && Float.floatToIntBits(boost) == Float.floatToIntBits(other.boost);
   }
 
   @Override
@@ -121,8 +114,8 @@ public final class BoostQuery extends Query {
   }
 
   @Override
-  public Weight createWeight(IndexSearcher searcher, ScoreMode scoreMode, float boost) throws IOException {
+  public Weight createWeight(IndexSearcher searcher, ScoreMode scoreMode, float boost)
+      throws IOException {
     return query.createWeight(searcher, scoreMode, BoostQuery.this.boost * boost);
   }
-
 }
diff --git a/lucene/core/src/java/org/apache/lucene/search/BulkScorer.java b/lucene/core/src/java/org/apache/lucene/search/BulkScorer.java
index 661c129..fb7805a 100644
--- a/lucene/core/src/java/org/apache/lucene/search/BulkScorer.java
+++ b/lucene/core/src/java/org/apache/lucene/search/BulkScorer.java
@@ -16,24 +16,23 @@
  */
 package org.apache.lucene.search;
 
-
 import java.io.IOException;
-
 import org.apache.lucene.util.Bits;
 
-/** This class is used to score a range of documents at
- *  once, and is returned by {@link Weight#bulkScorer}.  Only
- *  queries that have a more optimized means of scoring
- *  across a range of documents need to override this.
- *  Otherwise, a default implementation is wrapped around
- *  the {@link Scorer} returned by {@link Weight#scorer}. */
-
+/**
+ * This class is used to score a range of documents at once, and is returned by {@link
+ * Weight#bulkScorer}. Only queries that have a more optimized means of scoring across a range of
+ * documents need to override this. Otherwise, a default implementation is wrapped around the {@link
+ * Scorer} returned by {@link Weight#scorer}.
+ */
 public abstract class BulkScorer {
 
-  /** Scores and collects all matching documents.
+  /**
+   * Scores and collects all matching documents.
+   *
    * @param collector The collector to which all matching documents are passed.
-   * @param acceptDocs {@link Bits} that represents the allowed documents to match, or
-   *                   {@code null} if they are all allowed to match.
+   * @param acceptDocs {@link Bits} that represents the allowed documents to match, or {@code null}
+   *     if they are all allowed to match.
    */
   public void score(LeafCollector collector, Bits acceptDocs) throws IOException {
     final int next = score(collector, acceptDocs, 0, DocIdSetIterator.NO_MORE_DOCS);
@@ -41,20 +40,25 @@ public abstract class BulkScorer {
   }
 
   /**
-   * Collects matching documents in a range and return an estimation of the
-   * next matching document which is on or after {@code max}.
-   * <p>The return value must be:</p><ul>
-   *   <li>&gt;= {@code max},</li>
-   *   <li>{@link DocIdSetIterator#NO_MORE_DOCS} if there are no more matches,</li>
-   *   <li>&lt;= the first matching document that is &gt;= {@code max} otherwise.</li>
+   * Collects matching documents in a range and return an estimation of the next matching document
+   * which is on or after {@code max}.
+   *
+   * <p>The return value must be:
+   *
+   * <ul>
+   *   <li>&gt;= {@code max},
+   *   <li>{@link DocIdSetIterator#NO_MORE_DOCS} if there are no more matches,
+   *   <li>&lt;= the first matching document that is &gt;= {@code max} otherwise.
    * </ul>
-   * <p>{@code min} is the minimum document to be considered for matching. All
-   * documents strictly before this value must be ignored.</p>
-   * <p>Although {@code max} would be a legal return value for this method, higher
-   * values might help callers skip more efficiently over non-matching portions
-   * of the docID space.</p>
-   * <p>For instance, a {@link Scorer}-based implementation could look like
-   * below:</p>
+   *
+   * <p>{@code min} is the minimum document to be considered for matching. All documents strictly
+   * before this value must be ignored.
+   *
+   * <p>Although {@code max} would be a legal return value for this method, higher values might help
+   * callers skip more efficiently over non-matching portions of the docID space.
+   *
+   * <p>For instance, a {@link Scorer}-based implementation could look like below:
+   *
    * <pre class="prettyprint">
    * private final Scorer scorer; // set via constructor
    *
@@ -74,17 +78,16 @@ public abstract class BulkScorer {
    * }
    * </pre>
    *
-   * @param  collector The collector to which all matching documents are passed.
-   * @param acceptDocs {@link Bits} that represents the allowed documents to match, or
-   *                   {@code null} if they are all allowed to match.
-   * @param  min Score starting at, including, this document 
-   * @param  max Score up to, but not including, this doc
+   * @param collector The collector to which all matching documents are passed.
+   * @param acceptDocs {@link Bits} that represents the allowed documents to match, or {@code null}
+   *     if they are all allowed to match.
+   * @param min Score starting at, including, this document
+   * @param max Score up to, but not including, this doc
    * @return an under-estimation of the next matching doc after max
    */
-  public abstract int score(LeafCollector collector, Bits acceptDocs, int min, int max) throws IOException;
+  public abstract int score(LeafCollector collector, Bits acceptDocs, int min, int max)
+      throws IOException;
 
-  /**
-   * Same as {@link DocIdSetIterator#cost()} for bulk scorers.
-   */
+  /** Same as {@link DocIdSetIterator#cost()} for bulk scorers. */
   public abstract long cost();
 }
diff --git a/lucene/core/src/java/org/apache/lucene/search/CachingCollector.java b/lucene/core/src/java/org/apache/lucene/search/CachingCollector.java
index bc1c185..898cf73 100644
--- a/lucene/core/src/java/org/apache/lucene/search/CachingCollector.java
+++ b/lucene/core/src/java/org/apache/lucene/search/CachingCollector.java
@@ -19,27 +19,21 @@ package org.apache.lucene.search;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
-
 import org.apache.lucene.index.LeafReaderContext;
 import org.apache.lucene.util.ArrayUtil;
 
 /**
- * Caches all docs, and optionally also scores, coming from
- * a search, and is then able to replay them to another
- * collector.  You specify the max RAM this class may use.
- * Once the collection is done, call {@link #isCached}. If
- * this returns true, you can use {@link #replay(Collector)}
- * against a new collector.  If it returns false, this means
- * too much RAM was required and you must instead re-run the
- * original search.
+ * Caches all docs, and optionally also scores, coming from a search, and is then able to replay
+ * them to another collector. You specify the max RAM this class may use. Once the collection is
+ * done, call {@link #isCached}. If this returns true, you can use {@link #replay(Collector)}
+ * against a new collector. If it returns false, this means too much RAM was required and you must
+ * instead re-run the original search.
  *
- * <p><b>NOTE</b>: this class consumes 4 (or 8 bytes, if
- * scoring is cached) per collected document.  If the result
- * set is large this can easily be a very substantial amount
- * of RAM!
+ * <p><b>NOTE</b>: this class consumes 4 (or 8 bytes, if scoring is cached) per collected document.
+ * If the result set is large this can easily be a very substantial amount of RAM!
  *
- * <p>See the Lucene <code>modules/grouping</code> module for more
- * details including a full code example.</p>
+ * <p>See the Lucene <code>modules/grouping</code> module for more details including a full code
+ * example.
  *
  * @lucene.experimental
  */
@@ -57,13 +51,14 @@ public abstract class CachingCollector extends FilterCollector {
     float score;
 
     @Override
-    public final float score() { return score; }
+    public final float score() {
+      return score;
+    }
 
     @Override
     public int docID() {
       return doc;
     }
-
   }
 
   private static class NoScoreCachingCollector extends CachingCollector {
@@ -84,7 +79,8 @@ public abstract class CachingCollector extends FilterCollector {
       return new NoScoreCachingLeafCollector(in, maxDocsToCache);
     }
 
-    // note: do *not* override needScore to say false. Just because we aren't caching the score doesn't mean the
+    // note: do *not* override needScore to say false. Just because we aren't caching the score
+    // doesn't mean the
     //   wrapped collector doesn't need it to do its job.
 
     public LeafCollector getLeafCollector(LeafReaderContext context) throws IOException {
@@ -133,7 +129,8 @@ public abstract class CachingCollector extends FilterCollector {
     public void replay(Collector other) throws IOException {
       postCollection();
       if (!isCached()) {
-        throw new IllegalStateException("cannot replay: cache was cleared because too much RAM was required");
+        throw new IllegalStateException(
+            "cannot replay: cache was cleared because too much RAM was required");
       }
       assert docs.size() == contexts.size();
       for (int i = 0; i < contexts.size(); ++i) {
@@ -142,7 +139,6 @@ public abstract class CachingCollector extends FilterCollector {
         collect(collector, i);
       }
     }
-
   }
 
   private static class ScoreCachingCollector extends NoScoreCachingCollector {
@@ -165,7 +161,10 @@ public abstract class CachingCollector extends FilterCollector {
       scores.add(coll.cachedScores());
     }
 
-    /** Ensure the scores are collected so they can be replayed, even if the wrapped collector doesn't need them. */
+    /**
+     * Ensure the scores are collected so they can be replayed, even if the wrapped collector
+     * doesn't need them.
+     */
     @Override
     public ScoreMode scoreMode() {
       return ScoreMode.COMPLETE;
@@ -220,7 +219,8 @@ public abstract class CachingCollector extends FilterCollector {
           if (docCount >= maxDocsToCache) {
             invalidate();
           } else {
-            final int newLen = Math.min(ArrayUtil.oversize(docCount + 1, Integer.BYTES), maxDocsToCache);
+            final int newLen =
+                Math.min(ArrayUtil.oversize(docCount + 1, Integer.BYTES), maxDocsToCache);
             grow(newLen);
           }
         }
@@ -239,7 +239,6 @@ public abstract class CachingCollector extends FilterCollector {
     int[] cachedDocs() {
       return docs == null ? null : ArrayUtil.copyOfSubArray(docs, 0, docCount);
     }
-
   }
 
   private class ScoreCachingLeafCollector extends NoScoreCachingLeafCollector {
@@ -282,38 +281,33 @@ public abstract class CachingCollector extends FilterCollector {
   }
 
   /**
-   * Creates a {@link CachingCollector} which does not wrap another collector.
-   * The cached documents and scores can later be {@link #replay(Collector)
-   * replayed}.
+   * Creates a {@link CachingCollector} which does not wrap another collector. The cached documents
+   * and scores can later be {@link #replay(Collector) replayed}.
    */
   public static CachingCollector create(boolean cacheScores, double maxRAMMB) {
-    Collector other = new SimpleCollector() {
+    Collector other =
+        new SimpleCollector() {
 
-      @Override
-      public void collect(int doc) {}
+          @Override
+          public void collect(int doc) {}
 
-      @Override
-      public ScoreMode scoreMode() {
-        return ScoreMode.COMPLETE;
-      }
-
-    };
+          @Override
+          public ScoreMode scoreMode() {
+            return ScoreMode.COMPLETE;
+          }
+        };
     return create(other, cacheScores, maxRAMMB);
   }
 
   /**
-   * Create a new {@link CachingCollector} that wraps the given collector and
-   * caches documents and scores up to the specified RAM threshold.
+   * Create a new {@link CachingCollector} that wraps the given collector and caches documents and
+   * scores up to the specified RAM threshold.
    *
-   * @param other
-   *          the Collector to wrap and delegate calls to.
-   * @param cacheScores
-   *          whether to cache scores in addition to document IDs. Note that
-   *          this increases the RAM consumed per doc
-   * @param maxRAMMB
-   *          the maximum RAM in MB to consume for caching the documents and
-   *          scores. If the collector exceeds the threshold, no documents and
-   *          scores are cached.
+   * @param other the Collector to wrap and delegate calls to.
+   * @param cacheScores whether to cache scores in addition to document IDs. Note that this
+   *     increases the RAM consumed per doc
+   * @param maxRAMMB the maximum RAM in MB to consume for caching the documents and scores. If the
+   *     collector exceeds the threshold, no documents and scores are cached.
    */
   public static CachingCollector create(Collector other, boolean cacheScores, double maxRAMMB) {
     int bytesPerDoc = Integer.BYTES;
@@ -325,21 +319,19 @@ public abstract class CachingCollector extends FilterCollector {
   }
 
   /**
-   * Create a new {@link CachingCollector} that wraps the given collector and
-   * caches documents and scores up to the specified max docs threshold.
+   * Create a new {@link CachingCollector} that wraps the given collector and caches documents and
+   * scores up to the specified max docs threshold.
    *
-   * @param other
-   *          the Collector to wrap and delegate calls to.
-   * @param cacheScores
-   *          whether to cache scores in addition to document IDs. Note that
-   *          this increases the RAM consumed per doc
-   * @param maxDocsToCache
-   *          the maximum number of documents for caching the documents and
-   *          possible the scores. If the collector exceeds the threshold,
-   *          no documents and scores are cached.
+   * @param other the Collector to wrap and delegate calls to.
+   * @param cacheScores whether to cache scores in addition to document IDs. Note that this
+   *     increases the RAM consumed per doc
+   * @param maxDocsToCache the maximum number of documents for caching the documents and possible
+   *     the scores. If the collector exceeds the threshold, no documents and scores are cached.
    */
   public static CachingCollector create(Collector other, boolean cacheScores, int maxDocsToCache) {
-    return cacheScores ? new ScoreCachingCollector(other, maxDocsToCache) : new NoScoreCachingCollector(other, maxDocsToCache);
+    return cacheScores
+        ? new ScoreCachingCollector(other, maxDocsToCache)
+        : new NoScoreCachingCollector(other, maxDocsToCache);
   }
 
   private boolean cached;
@@ -349,25 +341,19 @@ public abstract class CachingCollector extends FilterCollector {
     cached = true;
   }
 
-  /**
-   * Return true is this collector is able to replay collection.
-   */
+  /** Return true is this collector is able to replay collection. */
   public final boolean isCached() {
     return cached;
   }
 
   /**
-   * Replays the cached doc IDs (and scores) to the given Collector. If this
-   * instance does not cache scores, then Scorer is not set on
-   * {@code other.setScorer} as well as scores are not replayed.
+   * Replays the cached doc IDs (and scores) to the given Collector. If this instance does not cache
+   * scores, then Scorer is not set on {@code other.setScorer} as well as scores are not replayed.
    *
-   * @throws IllegalStateException
-   *           if this collector is not cached (i.e., if the RAM limits were too
-   *           low for the number of documents + scores to cache).
-   * @throws IllegalArgumentException
-   *           if the given Collect's does not support out-of-order collection,
-   *           while the collector passed to the ctor does.
+   * @throws IllegalStateException if this collector is not cached (i.e., if the RAM limits were too
+   *     low for the number of documents + scores to cache).
+   * @throws IllegalArgumentException if the given Collect's does not support out-of-order
+   *     collection, while the collector passed to the ctor does.
    */
   public abstract void replay(Collector other) throws IOException;
-
 }
diff --git a/lucene/core/src/java/org/apache/lucene/search/CollectionStatistics.java b/lucene/core/src/java/org/apache/lucene/search/CollectionStatistics.java
index 2dac059..d424abc 100644
--- a/lucene/core/src/java/org/apache/lucene/search/CollectionStatistics.java
+++ b/lucene/core/src/java/org/apache/lucene/search/CollectionStatistics.java
@@ -17,33 +17,34 @@
 package org.apache.lucene.search;
 
 import java.util.Objects;
-
 import org.apache.lucene.index.IndexReader; // javadocs
-import org.apache.lucene.index.Terms;       // javadocs
-
+import org.apache.lucene.index.Terms; // javadocs
 
 /**
  * Contains statistics for a collection (field).
- * <p>
- * This class holds statistics across all documents for scoring purposes:
+ *
+ * <p>This class holds statistics across all documents for scoring purposes:
+ *
  * <ul>
- *   <li> {@link #maxDoc()}: number of documents.
- *   <li> {@link #docCount()}: number of documents that contain this field.
- *   <li> {@link #sumDocFreq()}: number of postings-list entries.
- *   <li> {@link #sumTotalTermFreq()}: number of tokens.
+ *   <li>{@link #maxDoc()}: number of documents.
+ *   <li>{@link #docCount()}: number of documents that contain this field.
+ *   <li>{@link #sumDocFreq()}: number of postings-list entries.
+ *   <li>{@link #sumTotalTermFreq()}: number of tokens.
  * </ul>
- * <p>
- * The following conditions are always true:
+ *
+ * <p>The following conditions are always true:
+ *
  * <ul>
- *   <li> All statistics are positive integers: never zero or negative.
- *   <li> {@code docCount} &lt;= {@code maxDoc}
- *   <li> {@code docCount} &lt;= {@code sumDocFreq} &lt;= {@code sumTotalTermFreq}
+ *   <li>All statistics are positive integers: never zero or negative.
+ *   <li>{@code docCount} &lt;= {@code maxDoc}
+ *   <li>{@code docCount} &lt;= {@code sumDocFreq} &lt;= {@code sumTotalTermFreq}
  * </ul>
- * <p>
- * Values may include statistics on deleted documents that have not yet been merged away.
- * <p>
- * Be careful when performing calculations on these values because they are represented
- * as 64-bit integer values, you may need to cast to {@code double} for your use.
+ *
+ * <p>Values may include statistics on deleted documents that have not yet been merged away.
+ *
+ * <p>Be careful when performing calculations on these values because they are represented as 64-bit
+ * integer values, you may need to cast to {@code double} for your use.
+ *
  * @lucene.experimental
  */
 public class CollectionStatistics {
@@ -52,9 +53,10 @@ public class CollectionStatistics {
   private final long docCount;
   private final long sumTotalTermFreq;
   private final long sumDocFreq;
-  
+
   /**
    * Creates statistics instance for a collection (field).
+   *
    * @param field Field's name
    * @param maxDoc total number of documents.
    * @param docCount number of documents containing the field.
@@ -66,7 +68,8 @@ public class CollectionStatistics {
    * @throws IllegalArgumentException if {@code sumDocFreq} is less than {@code docCount}.
    * @throws IllegalArgumentException if {@code sumTotalTermFreq} is less than {@code sumDocFreq}.
    */
-  public CollectionStatistics(String field, long maxDoc, long docCount, long sumTotalTermFreq, long sumDocFreq) {
+  public CollectionStatistics(
+      String field, long maxDoc, long docCount, long sumTotalTermFreq, long sumDocFreq) {
     Objects.requireNonNull(field);
     if (maxDoc <= 0) {
       throw new IllegalArgumentException("maxDoc must be positive, maxDoc: " + maxDoc);
@@ -75,19 +78,29 @@ public class CollectionStatistics {
       throw new IllegalArgumentException("docCount must be positive, docCount: " + docCount);
     }
     if (docCount > maxDoc) {
-      throw new IllegalArgumentException("docCount must not exceed maxDoc, docCount: " + docCount + ", maxDoc: " + maxDoc);
+      throw new IllegalArgumentException(
+          "docCount must not exceed maxDoc, docCount: " + docCount + ", maxDoc: " + maxDoc);
     }
     if (sumDocFreq <= 0) {
       throw new IllegalArgumentException("sumDocFreq must be positive, sumDocFreq: " + sumDocFreq);
     }
     if (sumDocFreq < docCount) {
-      throw new IllegalArgumentException("sumDocFreq must be at least docCount, sumDocFreq: " + sumDocFreq + ", docCount: " + docCount);
+      throw new IllegalArgumentException(
+          "sumDocFreq must be at least docCount, sumDocFreq: "
+              + sumDocFreq
+              + ", docCount: "
+              + docCount);
     }
     if (sumTotalTermFreq <= 0) {
-      throw new IllegalArgumentException("sumTotalTermFreq must be positive, sumTotalTermFreq: " + sumTotalTermFreq);
+      throw new IllegalArgumentException(
+          "sumTotalTermFreq must be positive, sumTotalTermFreq: " + sumTotalTermFreq);
     }
     if (sumTotalTermFreq < sumDocFreq) {
-      throw new IllegalArgumentException("sumTotalTermFreq must be at least sumDocFreq, sumTotalTermFreq: " + sumTotalTermFreq + ", sumDocFreq: " + sumDocFreq);
+      throw new IllegalArgumentException(
+          "sumTotalTermFreq must be at least sumDocFreq, sumTotalTermFreq: "
+              + sumTotalTermFreq
+              + ", sumDocFreq: "
+              + sumDocFreq);
     }
     this.field = field;
     this.maxDoc = maxDoc;
@@ -95,64 +108,67 @@ public class CollectionStatistics {
     this.sumTotalTermFreq = sumTotalTermFreq;
     this.sumDocFreq = sumDocFreq;
   }
-  
+
   /**
    * The field's name.
-   * <p>
-   * This value is never {@code null}.
+   *
+   * <p>This value is never {@code null}.
+   *
    * @return field's name, not {@code null}
    */
   public final String field() {
     return field;
   }
-  
+
   /**
-   * The total number of documents, regardless of
-   * whether they all contain values for this field.
-   * <p>
-   * This value is always a positive number.
+   * The total number of documents, regardless of whether they all contain values for this field.
+   *
+   * <p>This value is always a positive number.
+   *
    * @return total number of documents, in the range [1 .. {@link Long#MAX_VALUE}]
    * @see IndexReader#maxDoc()
    */
   public final long maxDoc() {
     return maxDoc;
   }
-  
+
   /**
-   * The total number of documents that have at least
-   * one term for this field.
-   * <p>
-   * This value is always a positive number, and never
-   * exceeds {@link #maxDoc()}.
+   * The total number of documents that have at least one term for this field.
+   *
+   * <p>This value is always a positive number, and never exceeds {@link #maxDoc()}.
+   *
    * @return total number of documents containing this field, in the range [1 .. {@link #maxDoc()}]
    * @see Terms#getDocCount()
    */
   public final long docCount() {
     return docCount;
   }
-  
+
   /**
-   * The total number of tokens for this field.
-   * This is the "word count" for this field across all documents.
-   * It is the sum of {@link TermStatistics#totalTermFreq()} across all terms.
-   * It is also the sum of each document's field length across all documents.
-   * <p>
-   * This value is always a positive number, and always at least {@link #sumDocFreq()}.
-   * @return total number of tokens in the field, in the range [{@link #sumDocFreq()} .. {@link Long#MAX_VALUE}]
+   * The total number of tokens for this field. This is the "word count" for this field across all
+   * documents. It is the sum of {@link TermStatistics#totalTermFreq()} across all terms. It is also
+   * the sum of each document's field length across all documents.
+   *
+   * <p>This value is always a positive number, and always at least {@link #sumDocFreq()}.
+   *
+   * @return total number of tokens in the field, in the range [{@link #sumDocFreq()} .. {@link
+   *     Long#MAX_VALUE}]
    * @see Terms#getSumTotalTermFreq()
    */
   public final long sumTotalTermFreq() {
     return sumTotalTermFreq;
   }
-  
+
   /**
-   * The total number of posting list entries for this field.
-   * This is the sum of term-document pairs: the sum of {@link TermStatistics#docFreq()} across all terms.
-   * It is also the sum of each document's unique term count for this field across all documents.
-   * <p>
-   * This value is always a positive number, always at least {@link #docCount()}, and never
+   * The total number of posting list entries for this field. This is the sum of term-document
+   * pairs: the sum of {@link TermStatistics#docFreq()} across all terms. It is also the sum of each
+   * document's unique term count for this field across all documents.
+   *
+   * <p>This value is always a positive number, always at least {@link #docCount()}, and never
    * exceeds {@link #sumTotalTermFreq()}.
-   * @return number of posting list entries, in the range [{@link #docCount()} .. {@link #sumTotalTermFreq()}]
+   *
+   * @return number of posting list entries, in the range [{@link #docCount()} .. {@link
+   *     #sumTotalTermFreq()}]
    * @see Terms#getSumDocFreq()
    */
   public final long sumDocFreq() {
diff --git a/lucene/core/src/java/org/apache/lucene/search/CollectionTerminatedException.java b/lucene/core/src/java/org/apache/lucene/search/CollectionTerminatedException.java
index e0a874e..2a7e044 100644
--- a/lucene/core/src/java/org/apache/lucene/search/CollectionTerminatedException.java
+++ b/lucene/core/src/java/org/apache/lucene/search/CollectionTerminatedException.java
@@ -16,13 +16,14 @@
  */
 package org.apache.lucene.search;
 
-
-/** Throw this exception in {@link LeafCollector#collect(int)} to prematurely
- *  terminate collection of the current leaf.
- *  <p>Note: IndexSearcher swallows this exception and never re-throws it.
- *  As a consequence, you should not catch it when calling
- *  {@link IndexSearcher#search} as it is unnecessary and might hide misuse
- *  of this exception. */
+/**
+ * Throw this exception in {@link LeafCollector#collect(int)} to prematurely terminate collection of
+ * the current leaf.
+ *
+ * <p>Note: IndexSearcher swallows this exception and never re-throws it. As a consequence, you
+ * should not catch it when calling {@link IndexSearcher#search} as it is unnecessary and might hide
+ * misuse of this exception.
+ */
 @SuppressWarnings("serial")
 public final class CollectionTerminatedException extends RuntimeException {
 
@@ -30,5 +31,4 @@ public final class CollectionTerminatedException extends RuntimeException {
   public CollectionTerminatedException() {
     super();
   }
-
 }
diff --git a/lucene/core/src/java/org/apache/lucene/search/Collector.java b/lucene/core/src/java/org/apache/lucene/search/Collector.java
index 9818c67..3af2210 100644
--- a/lucene/core/src/java/org/apache/lucene/search/Collector.java
+++ b/lucene/core/src/java/org/apache/lucene/search/Collector.java
@@ -16,49 +16,31 @@
  */
 package org.apache.lucene.search;
 
-
 import java.io.IOException;
-
 import org.apache.lucene.index.LeafReaderContext;
 
 /**
- * <p>Expert: Collectors are primarily meant to be used to
- * gather raw results from a search, and implement sorting
- * or custom result filtering, collation, etc. </p>
+ * Expert: Collectors are primarily meant to be used to gather raw results from a search, and
+ * implement sorting or custom result filtering, collation, etc.
  *
- * <p>Lucene's core collectors are derived from {@link Collector}
- * and {@link SimpleCollector}. Likely your application can
- * use one of these classes, or subclass {@link TopDocsCollector},
+ * <p>Lucene's core collectors are derived from {@link Collector} and {@link SimpleCollector}.
+ * Likely your application can use one of these classes, or subclass {@link TopDocsCollector},
  * instead of implementing Collector directly:
  *
  * <ul>
- *
- *   <li>{@link TopDocsCollector} is an abstract base class
- *   that assumes you will retrieve the top N docs,
- *   according to some criteria, after collection is
- *   done.  </li>
- *
- *   <li>{@link TopScoreDocCollector} is a concrete subclass
- *   {@link TopDocsCollector} and sorts according to score +
- *   docID.  This is used internally by the {@link
- *   IndexSearcher} search methods that do not take an
- *   explicit {@link Sort}. It is likely the most frequently
- *   used collector.</li>
- *
- *   <li>{@link TopFieldCollector} subclasses {@link
- *   TopDocsCollector} and sorts according to a specified
- *   {@link Sort} object (sort by field).  This is used
- *   internally by the {@link IndexSearcher} search methods
- *   that take an explicit {@link Sort}.
- *
- *   <li>{@link TimeLimitingCollector}, which wraps any other
- *   Collector and aborts the search if it's taken too much
- *   time.</li>
- *
- *   <li>{@link PositiveScoresOnlyCollector} wraps any other
- *   Collector and prevents collection of hits whose score
- *   is &lt;= 0.0</li>
- *
+ *   <li>{@link TopDocsCollector} is an abstract base class that assumes you will retrieve the top N
+ *       docs, according to some criteria, after collection is done.
+ *   <li>{@link TopScoreDocCollector} is a concrete subclass {@link TopDocsCollector} and sorts
+ *       according to score + docID. This is used internally by the {@link IndexSearcher} search
+ *       methods that do not take an explicit {@link Sort}. It is likely the most frequently used
+ *       collector.
+ *   <li>{@link TopFieldCollector} subclasses {@link TopDocsCollector} and sorts according to a
+ *       specified {@link Sort} object (sort by field). This is used internally by the {@link
+ *       IndexSearcher} search methods that take an explicit {@link Sort}.
+ *   <li>{@link TimeLimitingCollector}, which wraps any other Collector and aborts the search if
+ *       it's taken too much time.
+ *   <li>{@link PositiveScoresOnlyCollector} wraps any other Collector and prevents collection of
+ *       hits whose score is &lt;= 0.0
  * </ul>
  *
  * @lucene.experimental
@@ -68,13 +50,10 @@ public interface Collector {
   /**
    * Create a new {@link LeafCollector collector} to collect the given context.
    *
-   * @param context
-   *          next atomic reader context
+   * @param context next atomic reader context
    */
   LeafCollector getLeafCollector(LeafReaderContext context) throws IOException;
-  
-  /**
-   * Indicates what features are required from the scorer.
-   */
+
+  /** Indicates what features are required from the scorer. */
   ScoreMode scoreMode();
 }
diff --git a/lucene/core/src/java/org/apache/lucene/search/CollectorManager.java b/lucene/core/src/java/org/apache/lucene/search/CollectorManager.java
index 6a2e9a6..d9969e0 100644
--- a/lucene/core/src/java/org/apache/lucene/search/CollectorManager.java
+++ b/lucene/core/src/java/org/apache/lucene/search/CollectorManager.java
@@ -16,41 +16,34 @@
  */
 package org.apache.lucene.search;
 
-
 import java.io.IOException;
 import java.util.Collection;
 
 /**
- * A manager of collectors. This class is useful to parallelize execution of
- * search requests and has two main methods:
+ * A manager of collectors. This class is useful to parallelize execution of search requests and has
+ * two main methods:
+ *
  * <ul>
- *   <li>{@link #newCollector()} which must return a NEW collector which
- *       will be used to collect a certain set of leaves.</li>
- *   <li>{@link #reduce(Collection)} which will be used to reduce the
- *       results of individual collections into a meaningful result.
- *       This method is only called after all leaves have been fully
- *       collected.</li>
+ *   <li>{@link #newCollector()} which must return a NEW collector which will be used to collect a
+ *       certain set of leaves.
+ *   <li>{@link #reduce(Collection)} which will be used to reduce the results of individual
+ *       collections into a meaningful result. This method is only called after all leaves have been
+ *       fully collected.
  * </ul>
  *
  * @see IndexSearcher#search(Query, CollectorManager)
  * @lucene.experimental
  */
 public interface CollectorManager<C extends Collector, T> {
-  
-  /**
-   * Return a new {@link Collector}. This must return a different instance on
-   * each call.
-   */
+
+  /** Return a new {@link Collector}. This must return a different instance on each call. */
   C newCollector() throws IOException;
 
   /**
-   * Reduce the results of individual collectors into a meaningful result.
-   * For instance a {@link TopDocsCollector} would compute the
-   * {@link TopDocsCollector#topDocs() top docs} of each collector and then
-   * merge them using {@link TopDocs#merge(int, TopDocs[])}.
-   * This method must be called after collection is finished on all provided
-   * collectors.
+   * Reduce the results of individual collectors into a meaningful result. For instance a {@link
+   * TopDocsCollector} would compute the {@link TopDocsCollector#topDocs() top docs} of each
+   * collector and then merge them using {@link TopDocs#merge(int, TopDocs[])}. This method must be
+   * called after collection is finished on all provided collectors.
    */
   T reduce(Collection<C> collectors) throws IOException;
-  
 }
diff --git a/lucene/core/src/java/org/apache/lucene/search/ConjunctionDISI.java b/lucene/core/src/java/org/apache/lucene/search/ConjunctionDISI.java
index 30bdabb..9fb778d 100644
--- a/lucene/core/src/java/org/apache/lucene/search/ConjunctionDISI.java
+++ b/lucene/core/src/java/org/apache/lucene/search/ConjunctionDISI.java
@@ -16,32 +16,33 @@
  */
 package org.apache.lucene.search;
 
-
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.List;
-
 import org.apache.lucene.search.spans.Spans;
 import org.apache.lucene.util.ArrayUtil;
 import org.apache.lucene.util.BitSet;
 import org.apache.lucene.util.BitSetIterator;
 import org.apache.lucene.util.CollectionUtil;
 
-/** A conjunction of DocIdSetIterators.
- * Requires that all of its sub-iterators must be on the same document all the time.
- * This iterates over the doc ids that are present in each given DocIdSetIterator.
- * <br>Public only for use in {@link org.apache.lucene.search.spans}.
+/**
+ * A conjunction of DocIdSetIterators. Requires that all of its sub-iterators must be on the same
+ * document all the time. This iterates over the doc ids that are present in each given
+ * DocIdSetIterator. <br>
+ * Public only for use in {@link org.apache.lucene.search.spans}.
+ *
  * @lucene.internal
  */
 public final class ConjunctionDISI extends DocIdSetIterator {
 
-  /** Create a conjunction over the provided {@link Scorer}s. Note that the
-   * returned {@link DocIdSetIterator} might leverage two-phase iteration in
-   * which case it is possible to retrieve the {@link TwoPhaseIterator} using
-   * {@link TwoPhaseIterator#unwrap}. */
+  /**
+   * Create a conjunction over the provided {@link Scorer}s. Note that the returned {@link
+   * DocIdSetIterator} might leverage two-phase iteration in which case it is possible to retrieve
+   * the {@link TwoPhaseIterator} using {@link TwoPhaseIterator#unwrap}.
+   */
   public static DocIdSetIterator intersectScorers(Collection<Scorer> scorers) {
     if (scorers.size() < 2) {
       throw new IllegalArgumentException("Cannot make a ConjunctionDISI of less than 2 iterators");
@@ -55,10 +56,11 @@ public final class ConjunctionDISI extends DocIdSetIterator {
     return createConjunction(allIterators, twoPhaseIterators);
   }
 
-  /** Create a conjunction over the provided DocIdSetIterators. Note that the
-   * returned {@link DocIdSetIterator} might leverage two-phase iteration in
-   * which case it is possible to retrieve the {@link TwoPhaseIterator} using
-   * {@link TwoPhaseIterator#unwrap}. */
+  /**
+   * Create a conjunction over the provided DocIdSetIterators. Note that the returned {@link
+   * DocIdSetIterator} might leverage two-phase iteration in which case it is possible to retrieve
+   * the {@link TwoPhaseIterator} using {@link TwoPhaseIterator#unwrap}.
+   */
   public static DocIdSetIterator intersectIterators(List<DocIdSetIterator> iterators) {
     if (iterators.size() < 2) {
       throw new IllegalArgumentException("Cannot make a ConjunctionDISI of less than 2 iterators");
@@ -72,10 +74,11 @@ public final class ConjunctionDISI extends DocIdSetIterator {
     return createConjunction(allIterators, twoPhaseIterators);
   }
 
-  /** Create a conjunction over the provided {@link Spans}. Note that the
-   * returned {@link DocIdSetIterator} might leverage two-phase iteration in
-   * which case it is possible to retrieve the {@link TwoPhaseIterator} using
-   * {@link TwoPhaseIterator#unwrap}. */
+  /**
+   * Create a conjunction over the provided {@link Spans}. Note that the returned {@link
+   * DocIdSetIterator} might leverage two-phase iteration in which case it is possible to retrieve
+   * the {@link TwoPhaseIterator} using {@link TwoPhaseIterator#unwrap}.
+   */
   public static DocIdSetIterator intersectSpans(List<Spans> spanList) {
     if (spanList.size() < 2) {
       throw new IllegalArgumentException("Cannot make a ConjunctionDISI of less than 2 iterators");
@@ -89,8 +92,14 @@ public final class ConjunctionDISI extends DocIdSetIterator {
     return createConjunction(allIterators, twoPhaseIterators);
   }
 
-  /** Adds the scorer, possibly splitting up into two phases or collapsing if it is another conjunction */
-  private static void addScorer(Scorer scorer, List<DocIdSetIterator> allIterators, List<TwoPhaseIterator> twoPhaseIterators) {
+  /**
+   * Adds the scorer, possibly splitting up into two phases or collapsing if it is another
+   * conjunction
+   */
+  private static void addScorer(
+      Scorer scorer,
+      List<DocIdSetIterator> allIterators,
+      List<TwoPhaseIterator> twoPhaseIterators) {
     TwoPhaseIterator twoPhaseIter = scorer.twoPhaseIterator();
     if (twoPhaseIter != null) {
       addTwoPhaseIterator(twoPhaseIter, allIterators, twoPhaseIterators);
@@ -100,7 +109,8 @@ public final class ConjunctionDISI extends DocIdSetIterator {
   }
 
   /** Adds the Spans. */
-  private static void addSpans(Spans spans, List<DocIdSetIterator> allIterators, List<TwoPhaseIterator> twoPhaseIterators) {
+  private static void addSpans(
+      Spans spans, List<DocIdSetIterator> allIterators, List<TwoPhaseIterator> twoPhaseIterators) {
     TwoPhaseIterator twoPhaseIter = spans.asTwoPhaseIterator();
     if (twoPhaseIter != null) {
       addTwoPhaseIterator(twoPhaseIter, allIterators, twoPhaseIterators);
@@ -109,13 +119,18 @@ public final class ConjunctionDISI extends DocIdSetIterator {
     }
   }
 
-  private static void addIterator(DocIdSetIterator disi, List<DocIdSetIterator> allIterators, List<TwoPhaseIterator> twoPhaseIterators) {
+  private static void addIterator(
+      DocIdSetIterator disi,
+      List<DocIdSetIterator> allIterators,
+      List<TwoPhaseIterator> twoPhaseIterators) {
     TwoPhaseIterator twoPhase = TwoPhaseIterator.unwrap(disi);
     if (twoPhase != null) {
       addTwoPhaseIterator(twoPhase, allIterators, twoPhaseIterators);
-    } else if (disi.getClass() == ConjunctionDISI.class) { // Check for exactly this class for collapsing
+    } else if (disi.getClass()
+        == ConjunctionDISI.class) { // Check for exactly this class for collapsing
       ConjunctionDISI conjunction = (ConjunctionDISI) disi;
-      // subconjuctions have already split themselves into two phase iterators and others, so we can take those
+      // subconjuctions have already split themselves into two phase iterators and others, so we can
+      // take those
       // iterators as they are and move them up to this conjunction
       allIterators.add(conjunction.lead1);
       allIterators.add(conjunction.lead2);
@@ -129,25 +144,35 @@ public final class ConjunctionDISI extends DocIdSetIterator {
     }
   }
 
-  private static void addTwoPhaseIterator(TwoPhaseIterator twoPhaseIter, List<DocIdSetIterator> allIterators, List<TwoPhaseIterator> twoPhaseIterators) {
+  private static void addTwoPhaseIterator(
+      TwoPhaseIterator twoPhaseIter,
+      List<DocIdSetIterator> allIterators,
+      List<TwoPhaseIterator> twoPhaseIterators) {
     addIterator(twoPhaseIter.approximation(), allIterators, twoPhaseIterators);
-    if (twoPhaseIter.getClass() == ConjunctionTwoPhaseIterator.class) { // Check for exactly this class for collapsing
-      Collections.addAll(twoPhaseIterators, ((ConjunctionTwoPhaseIterator) twoPhaseIter).twoPhaseIterators);
+    if (twoPhaseIter.getClass()
+        == ConjunctionTwoPhaseIterator.class) { // Check for exactly this class for collapsing
+      Collections.addAll(
+          twoPhaseIterators, ((ConjunctionTwoPhaseIterator) twoPhaseIter).twoPhaseIterators);
     } else {
       twoPhaseIterators.add(twoPhaseIter);
     }
   }
 
   private static DocIdSetIterator createConjunction(
-      List<DocIdSetIterator> allIterators,
-      List<TwoPhaseIterator> twoPhaseIterators) {
+      List<DocIdSetIterator> allIterators, List<TwoPhaseIterator> twoPhaseIterators) {
 
     // check that all sub-iterators are on the same doc ID
-    int curDoc = allIterators.size() > 0 ? allIterators.get(0).docID() : twoPhaseIterators.get(0).approximation.docID();
+    int curDoc =
+        allIterators.size() > 0
+            ? allIterators.get(0).docID()
+            : twoPhaseIterators.get(0).approximation.docID();
     boolean iteratorsOnTheSameDoc = allIterators.stream().allMatch(it -> it.docID() == curDoc);
-    iteratorsOnTheSameDoc = iteratorsOnTheSameDoc && twoPhaseIterators.stream().allMatch(it -> it.approximation().docID() == curDoc);
+    iteratorsOnTheSameDoc =
+        iteratorsOnTheSameDoc
+            && twoPhaseIterators.stream().allMatch(it -> it.approximation().docID() == curDoc);
     if (iteratorsOnTheSameDoc == false) {
-      throw new IllegalArgumentException("Sub-iterators of ConjunctionDISI are not on the same document!");
+      throw new IllegalArgumentException(
+          "Sub-iterators of ConjunctionDISI are not on the same document!");
     }
 
     long minCost = allIterators.stream().mapToLong(DocIdSetIterator::cost).min().getAsLong();
@@ -176,7 +201,9 @@ public final class ConjunctionDISI extends DocIdSetIterator {
     }
 
     if (twoPhaseIterators.isEmpty() == false) {
-      disi = TwoPhaseIterator.asDocIdSetIterator(new ConjunctionTwoPhaseIterator(disi, twoPhaseIterators));
+      disi =
+          TwoPhaseIterator.asDocIdSetIterator(
+              new ConjunctionTwoPhaseIterator(disi, twoPhaseIterators));
     }
 
     return disi;
@@ -190,19 +217,22 @@ public final class ConjunctionDISI extends DocIdSetIterator {
 
     // Sort the array the first time to allow the least frequent DocsEnum to
     // lead the matching.
-    CollectionUtil.timSort(iterators, new Comparator<DocIdSetIterator>() {
-      @Override
-      public int compare(DocIdSetIterator o1, DocIdSetIterator o2) {
-        return Long.compare(o1.cost(), o2.cost());
-      }
-    });
+    CollectionUtil.timSort(
+        iterators,
+        new Comparator<DocIdSetIterator>() {
+          @Override
+          public int compare(DocIdSetIterator o1, DocIdSetIterator o2) {
+            return Long.compare(o1.cost(), o2.cost());
+          }
+        });
     lead1 = iterators.get(0);
     lead2 = iterators.get(1);
     others = iterators.subList(2, iterators.size()).toArray(new DocIdSetIterator[0]);
   }
 
   private int doNext(int doc) throws IOException {
-    advanceHead: for(;;) {
+    advanceHead:
+    for (; ; ) {
       assert doc == lead1.docID();
 
       // find agreement between the two iterators with the lower costs
@@ -238,7 +268,8 @@ public final class ConjunctionDISI extends DocIdSetIterator {
 
   @Override
   public int advance(int target) throws IOException {
-    assert assertItersOnSameDoc() : "Sub-iterators of ConjunctionDISI are not one the same document!";
+    assert assertItersOnSameDoc()
+        : "Sub-iterators of ConjunctionDISI are not one the same document!";
     return doNext(lead1.advance(target));
   }
 
@@ -249,7 +280,8 @@ public final class ConjunctionDISI extends DocIdSetIterator {
 
   @Override
   public int nextDoc() throws IOException {
-    assert assertItersOnSameDoc() : "Sub-iterators of ConjunctionDISI are not on the same document!";
+    assert assertItersOnSameDoc()
+        : "Sub-iterators of ConjunctionDISI are not on the same document!";
     return doNext(lead1.nextDoc());
   }
 
@@ -300,18 +332,21 @@ public final class ConjunctionDISI extends DocIdSetIterator {
 
     @Override
     public int nextDoc() throws IOException {
-      assert assertItersOnSameDoc() : "Sub-iterators of ConjunctionDISI are not on the same document!";
+      assert assertItersOnSameDoc()
+          : "Sub-iterators of ConjunctionDISI are not on the same document!";
       return doNext(lead.nextDoc());
     }
 
     @Override
     public int advance(int target) throws IOException {
-      assert assertItersOnSameDoc() : "Sub-iterators of ConjunctionDISI are not on the same document!";
+      assert assertItersOnSameDoc()
+          : "Sub-iterators of ConjunctionDISI are not on the same document!";
       return doNext(lead.advance(target));
     }
 
     private int doNext(int doc) throws IOException {
-      advanceLead: for (;; doc = lead.nextDoc()) {
+      advanceLead:
+      for (; ; doc = lead.nextDoc()) {
         if (doc >= minLength) {
           return NO_MORE_DOCS;
         }
@@ -341,33 +376,34 @@ public final class ConjunctionDISI extends DocIdSetIterator {
       }
       return iteratorsOnTheSameDoc;
     }
-
   }
 
-  /**
-   * {@link TwoPhaseIterator} implementing a conjunction.
-   */
+  /** {@link TwoPhaseIterator} implementing a conjunction. */
   private static final class ConjunctionTwoPhaseIterator extends TwoPhaseIterator {
 
     private final TwoPhaseIterator[] twoPhaseIterators;
     private final float matchCost;
 
-    private ConjunctionTwoPhaseIterator(DocIdSetIterator approximation,
-        List<? extends TwoPhaseIterator> twoPhaseIterators) {
+    private ConjunctionTwoPhaseIterator(
+        DocIdSetIterator approximation, List<? extends TwoPhaseIterator> twoPhaseIterators) {
       super(approximation);
       assert twoPhaseIterators.size() > 0;
 
-      CollectionUtil.timSort(twoPhaseIterators, new Comparator<TwoPhaseIterator>() {
-        @Override
-        public int compare(TwoPhaseIterator o1, TwoPhaseIterator o2) {
-          return Float.compare(o1.matchCost(), o2.matchCost());
-        }
-      });
+      CollectionUtil.timSort(
+          twoPhaseIterators,
+          new Comparator<TwoPhaseIterator>() {
+            @Override
+            public int compare(TwoPhaseIterator o1, TwoPhaseIterator o2) {
+              return Float.compare(o1.matchCost(), o2.matchCost());
+            }
+          });
 
-      this.twoPhaseIterators = twoPhaseIterators.toArray(new TwoPhaseIterator[twoPhaseIterators.size()]);
+      this.twoPhaseIterators =
+          twoPhaseIterators.toArray(new TwoPhaseIterator[twoPhaseIterators.size()]);
 
       // Compute the matchCost as the total matchCost of the sub iterators.
-      // TODO: This could be too high because the matching is done cheapest first: give the lower matchCosts a higher weight.
+      // TODO: This could be too high because the matching is done cheapest first: give the lower
+      // matchCosts a higher weight.
       float totalMatchCost = 0;
       for (TwoPhaseIterator tpi : twoPhaseIterators) {
         totalMatchCost += tpi.matchCost();
@@ -389,7 +425,5 @@ public final class ConjunctionDISI extends DocIdSetIterator {
     public float matchCost() {
       return matchCost;
     }
-
   }
-
 }
diff --git a/lucene/core/src/java/org/apache/lucene/search/ConjunctionScorer.java b/lucene/core/src/java/org/apache/lucene/search/ConjunctionScorer.java
index 7ba4aa3..b0a1a9a 100644
--- a/lucene/core/src/java/org/apache/lucene/search/ConjunctionScorer.java
+++ b/lucene/core/src/java/org/apache/lucene/search/ConjunctionScorer.java
@@ -16,7 +16,6 @@
  */
 package org.apache.lucene.search;
 
-
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -28,8 +27,12 @@ class ConjunctionScorer extends Scorer {
   final Scorer[] scorers;
   final Collection<Scorer> required;
 
-  /** Create a new {@link ConjunctionScorer}, note that {@code scorers} must be a subset of {@code required}. */
-  ConjunctionScorer(Weight weight, Collection<Scorer> required, Collection<Scorer> scorers) throws IOException {
+  /**
+   * Create a new {@link ConjunctionScorer}, note that {@code scorers} must be a subset of {@code
+   * required}.
+   */
+  ConjunctionScorer(Weight weight, Collection<Scorer> required, Collection<Scorer> scorers)
+      throws IOException {
     super(weight);
     assert required.containsAll(scorers);
     this.disi = ConjunctionDISI.intersectScorers(required);
diff --git a/lucene/core/src/java/org/apache/lucene/search/ConstantScoreQuery.java b/lucene/core/src/java/org/apache/lucene/search/ConstantScoreQuery.java
index 26d4fe2..015c821 100644
--- a/lucene/core/src/java/org/apache/lucene/search/ConstantScoreQuery.java
+++ b/lucene/core/src/java/org/apache/lucene/search/ConstantScoreQuery.java
@@ -16,24 +16,20 @@
  */
 package org.apache.lucene.search;
 
-
 import java.io.IOException;
 import java.util.Objects;
-
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.LeafReaderContext;
 import org.apache.lucene.util.Bits;
 
 /**
- * A query that wraps another query and simply returns a constant score equal to
- * 1 for every document that matches the query.
- * It therefore simply strips of all scores and always returns 1.
+ * A query that wraps another query and simply returns a constant score equal to 1 for every
+ * document that matches the query. It therefore simply strips of all scores and always returns 1.
  */
 public final class ConstantScoreQuery extends Query {
   private final Query query;
 
-  /** Strips off scores from the passed in Query. The hits will get a constant score
-   * of 1. */
+  /** Strips off scores from the passed in Query. The hits will get a constant score of 1. */
   public ConstantScoreQuery(Query query) {
     this.query = Objects.requireNonNull(query, "Query must not be null");
   }
@@ -67,10 +63,10 @@ public final class ConstantScoreQuery extends Query {
     query.visit(visitor.getSubVisitor(BooleanClause.Occur.FILTER, this));
   }
 
-  /** We return this as our {@link BulkScorer} so that if the CSQ
-   *  wraps a query with its own optimized top-level
-   *  scorer (e.g. BooleanScorer) we can use that
-   *  top-level scorer. */
+  /**
+   * We return this as our {@link BulkScorer} so that if the CSQ wraps a query with its own
+   * optimized top-level scorer (e.g. BooleanScorer) we can use that top-level scorer.
+   */
   protected static class ConstantBulkScorer extends BulkScorer {
     final BulkScorer bulkScorer;
     final Weight weight;
@@ -83,7 +79,8 @@ public final class ConstantScoreQuery extends Query {
     }
 
     @Override
-    public int score(LeafCollector collector, Bits acceptDocs, int min, int max) throws IOException {
+    public int score(LeafCollector collector, Bits acceptDocs, int min, int max)
+        throws IOException {
       return bulkScorer.score(wrapCollector(collector), acceptDocs, min, max);
     }
 
@@ -92,12 +89,13 @@ public final class ConstantScoreQuery extends Query {
         @Override
         public void setScorer(Scorable scorer) throws IOException {
           // we must wrap again here, but using the scorer passed in as parameter:
-          in.setScorer(new FilterScorable(scorer) {
-            @Override
-            public float score() {
-              return theScore;
-            }
-          });
+          in.setScorer(
+              new FilterScorable(scorer) {
+                @Override
+                public float score() {
+                  return theScore;
+                }
+              });
         }
       };
     }
@@ -109,7 +107,8 @@ public final class ConstantScoreQuery extends Query {
   }
 
   @Override
-  public Weight createWeight(IndexSearcher searcher, ScoreMode scoreMode, float boost) throws IOException {
+  public Weight createWeight(IndexSearcher searcher, ScoreMode scoreMode, float boost)
+      throws IOException {
     final Weight innerWeight = searcher.createWeight(query, ScoreMode.COMPLETE_NO_SCORES, 1f);
     if (scoreMode.needsScores()) {
       return new ConstantScoreWeight(this, boost) {
@@ -137,7 +136,8 @@ public final class ConstantScoreQuery extends Query {
               final Scorer innerScorer = innerScorerSupplier.get(leadCost);
               final TwoPhaseIterator twoPhaseIterator = innerScorer.twoPhaseIterator();
               if (twoPhaseIterator == null) {
-                return new ConstantScoreScorer(innerWeight, score(), scoreMode, innerScorer.iterator());
+                return new ConstantScoreScorer(
+                    innerWeight, score(), scoreMode, innerScorer.iterator());
               } else {
                 return new ConstantScoreScorer(innerWeight, score(), scoreMode, twoPhaseIterator);
               }
@@ -168,7 +168,6 @@ public final class ConstantScoreQuery extends Query {
         public boolean isCacheable(LeafReaderContext ctx) {
           return innerWeight.isCacheable(ctx);
         }
-
       };
     } else {
       return innerWeight;
@@ -177,16 +176,12 @@ public final class ConstantScoreQuery extends Query {
 
   @Override
   public String toString(String field) {
-    return new StringBuilder("ConstantScore(")
-      .append(query.toString(field))
-      .append(')')
-      .toString();
+    return new StringBuilder("ConstantScore(").append(query.toString(field)).append(')').toString();
   }
 
   @Override
   public boolean equals(Object other) {
-    return sameClassAs(other) &&
-           query.equals(((ConstantScoreQuery) other).query);
+    return sameClassAs(other) && query.equals(((ConstantScoreQuery) other).query);
   }
 
   @Override
diff --git a/lucene/core/src/java/org/apache/lucene/search/ConstantScoreScorer.java b/lucene/core/src/java/org/apache/lucene/search/ConstantScoreScorer.java
index 17c8362..759300e 100644
--- a/lucene/core/src/java/org/apache/lucene/search/ConstantScoreScorer.java
+++ b/lucene/core/src/java/org/apache/lucene/search/ConstantScoreScorer.java
@@ -16,11 +16,11 @@
  */
 package org.apache.lucene.search;
 
-
 import java.io.IOException;
 
 /**
  * A constant-scoring {@link Scorer}.
+ *
  * @lucene.internal
  */
 public final class ConstantScoreScorer extends Scorer {
@@ -60,44 +60,54 @@ public final class ConstantScoreScorer extends Scorer {
   private final TwoPhaseIterator twoPhaseIterator;
   private final DocIdSetIterator disi;
 
-  /** Constructor based on a {@link DocIdSetIterator} which will be used to
-   *  drive iteration. Two phase iteration will not be supported.
-   *  @param weight the parent weight
-   *  @param score the score to return on each document
-   *  @param scoreMode the score mode
-   *  @param disi the iterator that defines matching documents */
-  public ConstantScoreScorer(Weight weight, float score, ScoreMode scoreMode, DocIdSetIterator disi) {
+  /**
+   * Constructor based on a {@link DocIdSetIterator} which will be used to drive iteration. Two
+   * phase iteration will not be supported.
+   *
+   * @param weight the parent weight
+   * @param score the score to return on each document
+   * @param scoreMode the score mode
+   * @param disi the iterator that defines matching documents
+   */
+  public ConstantScoreScorer(
+      Weight weight, float score, ScoreMode scoreMode, DocIdSetIterator disi) {
     super(weight);
     this.score = score;
     this.scoreMode = scoreMode;
-    this.approximation = scoreMode == ScoreMode.TOP_SCORES ? new DocIdSetIteratorWrapper(disi) : disi;
+    this.approximation =
+        scoreMode == ScoreMode.TOP_SCORES ? new DocIdSetIteratorWrapper(disi) : disi;
     this.twoPhaseIterator = null;
     this.disi = this.approximation;
   }
 
-  /** Constructor based on a {@link TwoPhaseIterator}. In that case the
-   *  {@link Scorer} will support two-phase iteration.
-   *  @param weight the parent weight
-   *  @param score the score to return on each document
-   *  @param scoreMode the score mode
-   *  @param twoPhaseIterator the iterator that defines matching documents */
-  public ConstantScoreScorer(Weight weight, float score, ScoreMode scoreMode, TwoPhaseIterator twoPhaseIterator) {
+  /**
+   * Constructor based on a {@link TwoPhaseIterator}. In that case the {@link Scorer} will support
+   * two-phase iteration.
+   *
+   * @param weight the parent weight
+   * @param score the score to return on each document
+   * @param scoreMode the score mode
+   * @param twoPhaseIterator the iterator that defines matching documents
+   */
+  public ConstantScoreScorer(
+      Weight weight, float score, ScoreMode scoreMode, TwoPhaseIterator twoPhaseIterator) {
     super(weight);
     this.score = score;
     this.scoreMode = scoreMode;
     if (scoreMode == ScoreMode.TOP_SCORES) {
       this.approximation = new DocIdSetIteratorWrapper(twoPhaseIterator.approximation());
-      this.twoPhaseIterator = new TwoPhaseIterator(this.approximation) {
-        @Override
-        public boolean matches() throws IOException {
-          return twoPhaseIterator.matches();
-        }
-
-        @Override
-        public float matchCost() {
-          return twoPhaseIterator.matchCost();
-        }
-      };
+      this.twoPhaseIterator =
+          new TwoPhaseIterator(this.approximation) {
+            @Override
+            public boolean matches() throws IOException {
+              return twoPhaseIterator.matches();
+            }
+
+            @Override
+            public float matchCost() {
+              return twoPhaseIterator.matchCost();
+            }
+          };
     } else {
       this.approximation = twoPhaseIterator.approximation();
       this.twoPhaseIterator = twoPhaseIterator;
@@ -136,5 +146,4 @@ public final class ConstantScoreScorer extends Scorer {
   public float score() throws IOException {
     return score;
   }
-
 }
diff --git a/lucene/core/src/java/org/apache/lucene/search/ConstantScoreWeight.java b/lucene/core/src/java/org/apache/lucene/search/ConstantScoreWeight.java
index 7ee4cce..4aa8d31 100644
--- a/lucene/core/src/java/org/apache/lucene/search/ConstantScoreWeight.java
+++ b/lucene/core/src/java/org/apache/lucene/search/ConstantScoreWeight.java
@@ -16,15 +16,13 @@
  */
 package org.apache.lucene.search;
 
-
 import java.io.IOException;
-
 import org.apache.lucene.index.LeafReaderContext;
 
 /**
- * A Weight that has a constant score equal to the boost of the wrapped query.
- * This is typically useful when building queries which do not produce
- * meaningful scores and are mostly useful for filtering.
+ * A Weight that has a constant score equal to the boost of the wrapped query. This is typically
+ * useful when building queries which do not produce meaningful scores and are mostly useful for
+ * filtering.
  *
  * @lucene.internal
  */
@@ -58,11 +56,9 @@ public abstract class ConstantScoreWeight extends Weight {
     }
 
     if (exists) {
-      return Explanation.match(
-          score, getQuery().toString() + (score == 1f ? "" : "^" + score));
+      return Explanation.match(score, getQuery().toString() + (score == 1f ? "" : "^" + score));
     } else {
       return Explanation.noMatch(getQuery().toString() + " doesn't match id " + doc);
     }
   }
-
 }
diff --git a/lucene/core/src/java/org/apache/lucene/search/ControlledRealTimeReopenThread.java b/lucene/core/src/java/org/apache/lucene/search/ControlledRealTimeReopenThread.java
index ccd954d..611317a 100644
--- a/lucene/core/src/java/org/apache/lucene/search/ControlledRealTimeReopenThread.java
+++ b/lucene/core/src/java/org/apache/lucene/search/ControlledRealTimeReopenThread.java
@@ -16,25 +16,22 @@
  */
 package org.apache.lucene.search;
 
-
 import java.io.Closeable;
 import java.io.IOException;
 import java.util.concurrent.locks.Condition;
 import java.util.concurrent.locks.ReentrantLock;
-
 import org.apache.lucene.index.IndexWriter;
 import org.apache.lucene.util.ThreadInterruptedException;
 
-/** Utility class that runs a thread to manage periodicc
- *  reopens of a {@link ReferenceManager}, with methods to wait for a specific
- *  index changes to become visible.  When a given search request needs to see a specific
- *  index change, call the {#waitForGeneration} to wait for
- *  that change to be visible.  Note that this will only
- *  scale well if most searches do not need to wait for a
- *  specific index generation.
+/**
+ * Utility class that runs a thread to manage periodicc reopens of a {@link ReferenceManager}, with
+ * methods to wait for a specific index changes to become visible. When a given search request needs
+ * to see a specific index change, call the {#waitForGeneration} to wait for that change to be
+ * visible. Note that this will only scale well if most searches do not need to wait for a specific
+ * index generation.
  *
- * @lucene.experimental */
-
+ * @lucene.experimental
+ */
 public class ControlledRealTimeReopenThread<T> extends Thread implements Closeable {
   private final ReferenceManager<T> manager;
   private final long targetMaxStaleNS;
@@ -47,31 +44,34 @@ public class ControlledRealTimeReopenThread<T> extends Thread implements Closeab
 
   private final ReentrantLock reopenLock = new ReentrantLock();
   private final Condition reopenCond = reopenLock.newCondition();
-  
+
   /**
-   * Create ControlledRealTimeReopenThread, to periodically
-   * reopen the {@link ReferenceManager}.
+   * Create ControlledRealTimeReopenThread, to periodically reopen the {@link ReferenceManager}.
    *
-   * @param targetMaxStaleSec Maximum time until a new
-   *        reader must be opened; this sets the upper bound
-   *        on how slowly reopens may occur, when no
-   *        caller is waiting for a specific generation to
-   *        become visible.
-   *
-   * @param targetMinStaleSec Mininum time until a new
-   *        reader can be opened; this sets the lower bound
-   *        on how quickly reopens may occur, when a caller
-   *        is waiting for a specific generation to
-   *        become visible.
+   * @param targetMaxStaleSec Maximum time until a new reader must be opened; this sets the upper
+   *     bound on how slowly reopens may occur, when no caller is waiting for a specific generation
+   *     to become visible.
+   * @param targetMinStaleSec Mininum time until a new reader can be opened; this sets the lower
+   *     bound on how quickly reopens may occur, when a caller is waiting for a specific generation
+   *     to become visible.
    */
-  public ControlledRealTimeReopenThread(IndexWriter writer, ReferenceManager<T> manager, double targetMaxStaleSec, double targetMinStaleSec) {
+  public ControlledRealTimeReopenThread(
+      IndexWriter writer,
+      ReferenceManager<T> manager,
+      double targetMaxStaleSec,
+      double targetMinStaleSec) {
     if (targetMaxStaleSec < targetMinStaleSec) {
-      throw new IllegalArgumentException("targetMaxScaleSec (= " + targetMaxStaleSec + ") < targetMinStaleSec (=" + targetMinStaleSec + ")");
+      throw new IllegalArgumentException(
+          "targetMaxScaleSec (= "
+              + targetMaxStaleSec
+              + ") < targetMinStaleSec (="
+              + targetMinStaleSec
+              + ")");
     }
     this.writer = writer;
     this.manager = manager;
-    this.targetMaxStaleNS = (long) (1000000000*targetMaxStaleSec);
-    this.targetMinStaleNS = (long) (1000000000*targetMinStaleSec);
+    this.targetMaxStaleNS = (long) (1000000000 * targetMaxStaleSec);
+    this.targetMinStaleNS = (long) (1000000000 * targetMinStaleSec);
     manager.addListener(new HandleRefresh());
   }
 
@@ -95,7 +95,7 @@ public class ControlledRealTimeReopenThread<T> extends Thread implements Closeab
 
   @Override
   public synchronized void close() {
-    //System.out.println("NRT: set finish");
+    // System.out.println("NRT: set finish");
 
     finish = true;
 
@@ -119,13 +119,11 @@ public class ControlledRealTimeReopenThread<T> extends Thread implements Closeab
   }
 
   /**
-   * Waits for the target generation to become visible in
-   * the searcher.
-   * If the current searcher is older than the
-   * target generation, this method will block
-   * until the searcher is reopened, by another via
-   * {@link ReferenceManager#maybeRefresh} or until the {@link ReferenceManager} is closed.
-   * 
+   * Waits for the target generation to become visible in the searcher. If the current searcher is
+   * older than the target generation, this method will block until the searcher is reopened, by
+   * another via {@link ReferenceManager#maybeRefresh} or until the {@link ReferenceManager} is
+   * closed.
+   *
    * @param targetGen the generation to wait for
    */
   public void waitForGeneration(long targetGen) throws InterruptedException {
@@ -133,25 +131,21 @@ public class ControlledRealTimeReopenThread<T> extends Thread implements Closeab
   }
 
   /**
-   * Waits for the target generation to become visible in
-   * the searcher, up to a maximum specified milli-seconds.
-   * If the current searcher is older than the target
-   * generation, this method will block until the
-   * searcher has been reopened by another thread via
-   * {@link ReferenceManager#maybeRefresh}, the given waiting time has elapsed, or until
-   * the {@link ReferenceManager} is closed.
-   * <p>
-   * NOTE: if the waiting time elapses before the requested target generation is
-   * available the current {@link SearcherManager} is returned instead.
-   * 
-   * @param targetGen
-   *          the generation to wait for
-   * @param maxMS
-   *          maximum milliseconds to wait, or -1 to wait indefinitely
-   * @return true if the targetGeneration is now available,
-   *         or false if maxMS wait time was exceeded
+   * Waits for the target generation to become visible in the searcher, up to a maximum specified
+   * milli-seconds. If the current searcher is older than the target generation, this method will
+   * block until the searcher has been reopened by another thread via {@link
+   * ReferenceManager#maybeRefresh}, the given waiting time has elapsed, or until the {@link
+   * ReferenceManager} is closed.
+   *
+   * <p>NOTE: if the waiting time elapses before the requested target generation is available the
+   * current {@link SearcherManager} is returned instead.
+   *
+   * @param targetGen the generation to wait for
+   * @param maxMS maximum milliseconds to wait, or -1 to wait indefinitely
+   * @return true if the targetGeneration is now available, or false if maxMS wait time was exceeded
    */
-  public synchronized boolean waitForGeneration(long targetGen, int maxMS) throws InterruptedException {
+  public synchronized boolean waitForGeneration(long targetGen, int maxMS)
+      throws InterruptedException {
     if (targetGen > searchingGen) {
       // Notify the reopen thread that the waitingGen has
       // changed, so it may wake up and realize it should
@@ -168,13 +162,13 @@ public class ControlledRealTimeReopenThread<T> extends Thread implements Closeab
         reopenLock.unlock();
       }
 
-      long startMS = System.nanoTime()/1000000;
+      long startMS = System.nanoTime() / 1000000;
 
       while (targetGen > searchingGen) {
         if (maxMS < 0) {
           wait();
         } else {
-          long msLeft = (startMS + maxMS) - System.nanoTime()/1000000;
+          long msLeft = (startMS + maxMS) - System.nanoTime() / 1000000;
           if (msLeft <= 0) {
             return false;
           } else {
@@ -193,7 +187,7 @@ public class ControlledRealTimeReopenThread<T> extends Thread implements Closeab
     // case clock shift messes up nanoTime?
     long lastReopenStartNS = System.nanoTime();
 
-    //System.out.println("reopen: start");
+    // System.out.println("reopen: start");
     while (!finish) {
 
       // TODO: try to guestimate how long reopen might
@@ -208,7 +202,8 @@ public class ControlledRealTimeReopenThread<T> extends Thread implements Closeab
         try {
           // True if we have someone waiting for reopened searcher:
           boolean hasWaiting = waitingGen > searchingGen;
-          final long nextReopenStartNS = lastReopenStartNS + (hasWaiting ? targetMinStaleNS : targetMaxStaleNS);
+          final long nextReopenStartNS =
+              lastReopenStartNS + (hasWaiting ? targetMinStaleNS : targetMaxStaleNS);
 
           final long sleepNS = nextReopenStartNS - System.nanoTime();
 
diff --git a/lucene/core/src/java/org/apache/lucene/search/DisiPriorityQueue.java b/lucene/core/src/java/org/apache/lucene/search/DisiPriorityQueue.java
index 0692a7b..5981b03 100644
--- a/lucene/core/src/java/org/apache/lucene/search/DisiPriorityQueue.java
+++ b/lucene/core/src/java/org/apache/lucene/search/DisiPriorityQueue.java
@@ -16,16 +16,15 @@
  */
 package org.apache.lucene.search;
 
-
 import java.util.Arrays;
 import java.util.Iterator;
-
 import org.apache.lucene.util.PriorityQueue;
 
 /**
- * A priority queue of DocIdSetIterators that orders by current doc ID.
- * This specialization is needed over {@link PriorityQueue} because the
- * pluggable comparison function makes the rebalancing quite slow.
+ * A priority queue of DocIdSetIterators that orders by current doc ID. This specialization is
+ * needed over {@link PriorityQueue} because the pluggable comparison function makes the rebalancing
+ * quite slow.
+ *
  * @lucene.internal
  */
 public final class DisiPriorityQueue implements Iterable<DisiWrapper> {
@@ -79,8 +78,7 @@ public final class DisiPriorityQueue implements Iterable<DisiWrapper> {
     return w1;
   }
 
-  private DisiWrapper topList(DisiWrapper list, DisiWrapper[] heap,
-                                    int size, int i) {
+  private DisiWrapper topList(DisiWrapper list, DisiWrapper[] heap, int size, int i) {
     final DisiWrapper w = heap[i];
     if (w.doc == list.doc) {
       list = prepend(w, list);
@@ -165,7 +163,4 @@ public final class DisiPriorityQueue implements Iterable<DisiWrapper> {
   public Iterator<DisiWrapper> iterator() {
     return Arrays.asList(heap).subList(0, size).iterator();
   }
-
 }
-
-
diff --git a/lucene/core/src/java/org/apache/lucene/search/DisiWrapper.java b/lucene/core/src/java/org/apache/lucene/search/DisiWrapper.java
index fac94180..6adb650 100644
--- a/lucene/core/src/java/org/apache/lucene/search/DisiWrapper.java
+++ b/lucene/core/src/java/org/apache/lucene/search/DisiWrapper.java
@@ -16,11 +16,11 @@
  */
 package org.apache.lucene.search;
 
-
 import org.apache.lucene.search.spans.Spans;
 
 /**
  * Wrapper used in {@link DisiPriorityQueue}.
+ *
  * @lucene.internal
  */
 public class DisiWrapper {
@@ -53,7 +53,7 @@ public class DisiWrapper {
     this.cost = iterator.cost();
     this.doc = -1;
     this.twoPhaseView = scorer.twoPhaseIterator();
-      
+
     if (twoPhaseView != null) {
       approximation = twoPhaseView.approximation();
       matchCost = twoPhaseView.matchCost();
@@ -70,7 +70,7 @@ public class DisiWrapper {
     this.cost = iterator.cost();
     this.doc = -1;
     this.twoPhaseView = spans.asTwoPhaseIterator();
-      
+
     if (twoPhaseView != null) {
       approximation = twoPhaseView.approximation();
       matchCost = twoPhaseView.matchCost();
@@ -82,4 +82,3 @@ public class DisiWrapper {
     this.lastApproxMatchDoc = -2;
   }
 }
-
diff --git a/lucene/core/src/java/org/apache/lucene/search/DisjunctionDISIApproximation.java b/lucene/core/src/java/org/apache/lucene/search/DisjunctionDISIApproximation.java
index 395c152..805eadf 100644
--- a/lucene/core/src/java/org/apache/lucene/search/DisjunctionDISIApproximation.java
+++ b/lucene/core/src/java/org/apache/lucene/search/DisjunctionDISIApproximation.java
@@ -19,8 +19,9 @@ package org.apache.lucene.search;
 import java.io.IOException;
 
 /**
- * A {@link DocIdSetIterator} which is a disjunction of the approximations of
- * the provided iterators.
+ * A {@link DocIdSetIterator} which is a disjunction of the approximations of the provided
+ * iterators.
+ *
  * @lucene.internal
  */
 public class DisjunctionDISIApproximation extends DocIdSetIterator {
@@ -44,7 +45,7 @@ public class DisjunctionDISIApproximation extends DocIdSetIterator {
 
   @Override
   public int docID() {
-   return subIterators.top().doc;
+    return subIterators.top().doc;
   }
 
   @Override
@@ -70,5 +71,3 @@ public class DisjunctionDISIApproximation extends DocIdSetIterator {
     return top.doc;
   }
 }
-
-
diff --git a/lucene/core/src/java/org/apache/lucene/search/DisjunctionMatchesIterator.java b/lucene/core/src/java/org/apache/lucene/search/DisjunctionMatchesIterator.java
index 9adbaf4..925d130 100644
--- a/lucene/core/src/java/org/apache/lucene/search/DisjunctionMatchesIterator.java
+++ b/lucene/core/src/java/org/apache/lucene/search/DisjunctionMatchesIterator.java
@@ -21,7 +21,6 @@ import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Objects;
-
 import org.apache.lucene.index.LeafReaderContext;
 import org.apache.lucene.index.PostingsEnum;
 import org.apache.lucene.index.Term;
@@ -34,22 +33,29 @@ import org.apache.lucene.util.PriorityQueue;
 /**
  * A {@link MatchesIterator} that combines matches from a set of sub-iterators
  *
- * Matches are sorted by their start positions, and then by their end positions, so that
- * prefixes sort first.  Matches may overlap, or be duplicated if they appear in more
- * than one of the sub-iterators.
+ * <p>Matches are sorted by their start positions, and then by their end positions, so that prefixes
+ * sort first. Matches may overlap, or be duplicated if they appear in more than one of the
+ * sub-iterators.
  */
 final class DisjunctionMatchesIterator implements MatchesIterator {
 
   /**
    * Create a {@link DisjunctionMatchesIterator} over a list of terms
    *
-   * Only terms that have at least one match in the given document will be included
+   * <p>Only terms that have at least one match in the given document will be included
    */
-  static MatchesIterator fromTerms(LeafReaderContext context, int doc, Query query, String field, List<Term> terms) throws IOException {
+  static MatchesIterator fromTerms(
+      LeafReaderContext context, int doc, Query query, String field, List<Term> terms)
+      throws IOException {
     Objects.requireNonNull(field);
     for (Term term : terms) {
       if (Objects.equals(field, term.field()) == false) {
-        throw new IllegalArgumentException("Tried to generate iterator from terms in multiple fields: expected [" + field + "] but got [" + term.field() + "]");
+        throw new IllegalArgumentException(
+            "Tried to generate iterator from terms in multiple fields: expected ["
+                + field
+                + "] but got ["
+                + term.field()
+                + "]");
       }
     }
     return fromTermsEnum(context, doc, query, field, asBytesRefIterator(terms));
@@ -58,34 +64,36 @@ final class DisjunctionMatchesIterator implements MatchesIterator {
   private static BytesRefIterator asBytesRefIterator(List<Term> terms) {
     return new BytesRefIterator() {
       int i = 0;
+
       @Override
       public BytesRef next() {
-        if (i >= terms.size())
-          return null;
+        if (i >= terms.size()) return null;
         return terms.get(i++).bytes();
       }
     };
   }
 
   /**
-   * Create a {@link DisjunctionMatchesIterator} over a list of terms extracted from a {@link BytesRefIterator}
+   * Create a {@link DisjunctionMatchesIterator} over a list of terms extracted from a {@link
+   * BytesRefIterator}
    *
-   * Only terms that have at least one match in the given document will be included
+   * <p>Only terms that have at least one match in the given document will be included
    */
-  static MatchesIterator fromTermsEnum(LeafReaderContext context, int doc, Query query, String field, BytesRefIterator terms) throws IOException {
+  static MatchesIterator fromTermsEnum(
+      LeafReaderContext context, int doc, Query query, String field, BytesRefIterator terms)
+      throws IOException {
     Objects.requireNonNull(field);
     Terms t = context.reader().terms(field);
-    if (t == null)
-      return null;
+    if (t == null) return null;
     TermsEnum te = t.iterator();
     PostingsEnum reuse = null;
     for (BytesRef term = terms.next(); term != null; term = terms.next()) {
       if (te.seekExact(term)) {
         PostingsEnum pe = te.postings(reuse, PostingsEnum.OFFSETS);
         if (pe.advance(doc) == doc) {
-          return new TermsEnumDisjunctionMatchesIterator(new TermMatchesIterator(query, pe), terms, te, doc, query);
-        }
-        else {
+          return new TermsEnumDisjunctionMatchesIterator(
+              new TermMatchesIterator(query, pe), terms, te, doc, query);
+        } else {
           reuse = pe;
         }
       }
@@ -105,7 +113,8 @@ final class DisjunctionMatchesIterator implements MatchesIterator {
 
     private MatchesIterator it = null;
 
-    TermsEnumDisjunctionMatchesIterator(MatchesIterator first, BytesRefIterator terms, TermsEnum te, int doc, Query query) {
+    TermsEnumDisjunctionMatchesIterator(
+        MatchesIterator first, BytesRefIterator terms, TermsEnum te, int doc, Query query) {
       this.first = first;
       this.terms = terms;
       this.te = te;
@@ -172,10 +181,8 @@ final class DisjunctionMatchesIterator implements MatchesIterator {
   }
 
   static MatchesIterator fromSubIterators(List<MatchesIterator> mis) throws IOException {
-    if (mis.size() == 0)
-      return null;
-    if (mis.size() == 1)
-      return mis.get(0);
+    if (mis.size() == 0) return null;
+    if (mis.size() == 1) return mis.get(0);
     return new DisjunctionMatchesIterator(mis);
   }
 
@@ -184,14 +191,15 @@ final class DisjunctionMatchesIterator implements MatchesIterator {
   private boolean started = false;
 
   private DisjunctionMatchesIterator(List<MatchesIterator> matches) throws IOException {
-    queue = new PriorityQueue<MatchesIterator>(matches.size()){
-      @Override
-      protected boolean lessThan(MatchesIterator a, MatchesIterator b) {
-        return a.startPosition() < b.startPosition() ||
-            (a.startPosition() == b.startPosition() && a.endPosition() < b.endPosition()) ||
-            (a.startPosition() == b.startPosition() && a.endPosition() == b.endPosition());
-      }
-    };
+    queue =
+        new PriorityQueue<MatchesIterator>(matches.size()) {
+          @Override
+          protected boolean lessThan(MatchesIterator a, MatchesIterator b) {
+            return a.startPosition() < b.startPosition()
+                || (a.startPosition() == b.startPosition() && a.endPosition() < b.endPosition())
+                || (a.startPosition() == b.startPosition() && a.endPosition() == b.endPosition());
+          }
+        };
     for (MatchesIterator mi : matches) {
       if (mi.next()) {
         queue.add(mi);
diff --git a/lucene/core/src/java/org/apache/lucene/search/DisjunctionMaxQuery.java b/lucene/core/src/java/org/apache/lucene/search/DisjunctionMaxQuery.java
index d934847..97ca0fd 100644
--- a/lucene/core/src/java/org/apache/lucene/search/DisjunctionMaxQuery.java
+++ b/lucene/core/src/java/org/apache/lucene/search/DisjunctionMaxQuery.java
@@ -24,23 +24,23 @@ import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Objects;
-
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.LeafReaderContext;
 
 /**
- * A query that generates the union of documents produced by its subqueries, and that scores each document with the maximum
- * score for that document as produced by any subquery, plus a tie breaking increment for any additional matching subqueries.
- * This is useful when searching for a word in multiple fields with different boost factors (so that the fields cannot be
- * combined equivalently into a single search field).  We want the primary score to be the one associated with the highest boost,
- * not the sum of the field scores (as BooleanQuery would give).
- * If the query is "albino elephant" this ensures that "albino" matching one field and "elephant" matching
- * another gets a higher score than "albino" matching both fields.
- * To get this result, use both BooleanQuery and DisjunctionMaxQuery:  for each term a DisjunctionMaxQuery searches for it in
- * each field, while the set of these DisjunctionMaxQuery's is combined into a BooleanQuery.
- * The tie breaker capability allows results that include the same term in multiple fields to be judged better than results that
- * include this term in only the best of those multiple fields, without confusing this with the better case of two different terms
- * in the multiple fields.
+ * A query that generates the union of documents produced by its subqueries, and that scores each
+ * document with the maximum score for that document as produced by any subquery, plus a tie
+ * breaking increment for any additional matching subqueries. This is useful when searching for a
+ * word in multiple fields with different boost factors (so that the fields cannot be combined
+ * equivalently into a single search field). We want the primary score to be the one associated with
+ * the highest boost, not the sum of the field scores (as BooleanQuery would give). If the query is
+ * "albino elephant" this ensures that "albino" matching one field and "elephant" matching another
+ * gets a higher score than "albino" matching both fields. To get this result, use both BooleanQuery
+ * and DisjunctionMaxQuery: for each term a DisjunctionMaxQuery searches for it in each field, while
+ * the set of these DisjunctionMaxQuery's is combined into a BooleanQuery. The tie breaker
+ * capability allows results that include the same term in multiple fields to be judged better than
+ * results that include this term in only the best of those multiple fields, without confusing this
+ * with the better case of two different terms in the multiple fields.
  */
 public final class DisjunctionMaxQuery extends Query implements Iterable<Query> {
 
@@ -52,11 +52,13 @@ public final class DisjunctionMaxQuery extends Query implements Iterable<Query>
 
   /**
    * Creates a new DisjunctionMaxQuery
+   *
    * @param disjuncts a {@code Collection<Query>} of all the disjuncts to add
-   * @param tieBreakerMultiplier  the score of each non-maximum disjunct for a document is multiplied by this weight
-   *        and added into the final score.  If non-zero, the value should be small, on the order of 0.1, which says that
-   *        10 occurrences of word in a lower-scored field that is also in a higher scored field is just as good as a unique
-   *        word in the lower scored field (i.e., one that is not in any higher scored field.
+   * @param tieBreakerMultiplier the score of each non-maximum disjunct for a document is multiplied
+   *     by this weight and added into the final score. If non-zero, the value should be small, on
+   *     the order of 0.1, which says that 10 occurrences of word in a lower-scored field that is
+   *     also in a higher scored field is just as good as a unique word in the lower scored field
+   *     (i.e., one that is not in any higher scored field.
    */
   public DisjunctionMaxQuery(Collection<Query> disjuncts, float tieBreakerMultiplier) {
     Objects.requireNonNull(disjuncts, "Collection of Querys must not be null");
@@ -72,36 +74,36 @@ public final class DisjunctionMaxQuery extends Query implements Iterable<Query>
   public Iterator<Query> iterator() {
     return getDisjuncts().iterator();
   }
-  
-  /**
-   * @return the disjuncts.
-   */
+
+  /** @return the disjuncts. */
   public List<Query> getDisjuncts() {
     return Collections.unmodifiableList(Arrays.asList(disjuncts));
   }
 
-  /**
-   * @return tie breaker value for multiple matches.
-   */
+  /** @return tie breaker value for multiple matches. */
   public float getTieBreakerMultiplier() {
     return tieBreakerMultiplier;
   }
 
   /**
-   * Expert: the Weight for DisjunctionMaxQuery, used to
-   * normalize, score and explain these queries.
+   * Expert: the Weight for DisjunctionMaxQuery, used to normalize, score and explain these queries.
    *
-   * <p>NOTE: this API and implementation is subject to
-   * change suddenly in the next release.</p>
+   * <p>NOTE: this API and implementation is subject to change suddenly in the next release.
    */
   protected class DisjunctionMaxWeight extends Weight {
 
     /** The Weights for our subqueries, in 1-1 correspondence with disjuncts */
-    protected final ArrayList<Weight> weights = new ArrayList<>();  // The Weight's for our subqueries, in 1-1 correspondence with disjuncts
+    protected final ArrayList<Weight> weights =
+        new ArrayList<>(); // The Weight's for our subqueries, in 1-1 correspondence with disjuncts
+
     private final ScoreMode scoreMode;
 
-    /** Construct the Weight for this Query searched by searcher.  Recursively construct subquery weights. */
-    public DisjunctionMaxWeight(IndexSearcher searcher, ScoreMode scoreMode, float boost) throws IOException {
+    /**
+     * Construct the Weight for this Query searched by searcher. Recursively construct subquery
+     * weights.
+     */
+    public DisjunctionMaxWeight(IndexSearcher searcher, ScoreMode scoreMode, float boost)
+        throws IOException {
       super(DisjunctionMaxQuery.this);
       for (Query disjunctQuery : disjuncts) {
         weights.add(searcher.createWeight(disjunctQuery, scoreMode, boost));
@@ -152,8 +154,7 @@ public final class DisjunctionMaxQuery extends Query implements Iterable<Query>
         return false;
       }
       for (Weight w : weights) {
-        if (w.isCacheable(ctx) == false)
-          return false;
+        if (w.isCacheable(ctx) == false) return false;
       }
       return true;
     }
@@ -181,24 +182,30 @@ public final class DisjunctionMaxQuery extends Query implements Iterable<Query>
       }
       if (match) {
         final float score = (float) (max + otherSum * tieBreakerMultiplier);
-        final String desc = tieBreakerMultiplier == 0.0f ? "max of:" : "max plus " + tieBreakerMultiplier + " times others of:";
+        final String desc =
+            tieBreakerMultiplier == 0.0f
+                ? "max of:"
+                : "max plus " + tieBreakerMultiplier + " times others of:";
         return Explanation.match(score, desc, subs);
       } else {
         return Explanation.noMatch("No matching clause");
       }
     }
-    
-  }  // end of DisjunctionMaxWeight inner class
+  } // end of DisjunctionMaxWeight inner class
 
   /** Create the Weight used to score us */
   @Override
-  public Weight createWeight(IndexSearcher searcher, ScoreMode scoreMode, float boost) throws IOException {
+  public Weight createWeight(IndexSearcher searcher, ScoreMode scoreMode, float boost)
+      throws IOException {
     return new DisjunctionMaxWeight(searcher, scoreMode, boost);
   }
 
-  /** Optimize our representation and our subqueries representations
+  /**
+   * Optimize our representation and our subqueries representations
+   *
    * @param reader the IndexReader we query
-   * @return an optimized copy of us (which may not be a copy if there is nothing to optimize) */
+   * @return an optimized copy of us (which may not be a copy if there is nothing to optimize)
+   */
   @Override
   public Query rewrite(IndexReader reader) throws IOException {
     if (disjuncts.length == 1) {
@@ -236,23 +243,25 @@ public final class DisjunctionMaxQuery extends Query implements Iterable<Query>
     }
   }
 
-  /** Prettyprint us.
+  /**
+   * Prettyprint us.
+   *
    * @param field the field to which we are applied
-   * @return a string that shows what we do, of the form "(disjunct1 | disjunct2 | ... | disjunctn)^boost"
+   * @return a string that shows what we do, of the form "(disjunct1 | disjunct2 | ... |
+   *     disjunctn)^boost"
    */
   @Override
   public String toString(String field) {
     StringBuilder buffer = new StringBuilder();
     buffer.append("(");
-    for (int i = 0 ; i < disjuncts.length; i++) {
+    for (int i = 0; i < disjuncts.length; i++) {
       Query subquery = disjuncts[i];
-      if (subquery instanceof BooleanQuery) {   // wrap sub-bools in parens
+      if (subquery instanceof BooleanQuery) { // wrap sub-bools in parens
         buffer.append("(");
         buffer.append(subquery.toString(field));
         buffer.append(")");
-      }
-      else buffer.append(subquery.toString(field));
-      if (i != disjuncts.length-1) buffer.append(" | ");
+      } else buffer.append(subquery.toString(field));
+      if (i != disjuncts.length - 1) buffer.append(" | ");
     }
     buffer.append(")");
     if (tieBreakerMultiplier != 0.0f) {
@@ -262,22 +271,26 @@ public final class DisjunctionMaxQuery extends Query implements Iterable<Query>
     return buffer.toString();
   }
 
-  /** Return true if we represent the same query as other
+  /**
+   * Return true if we represent the same query as other
+   *
    * @param other another object
-   * @return true if other is a DisjunctionMaxQuery with the same boost and the same subqueries, in the same order, as us
+   * @return true if other is a DisjunctionMaxQuery with the same boost and the same subqueries, in
+   *     the same order, as us
    */
   @Override
   public boolean equals(Object other) {
-    return sameClassAs(other) &&
-           equalsTo(getClass().cast(other));
+    return sameClassAs(other) && equalsTo(getClass().cast(other));
   }
-  
+
   private boolean equalsTo(DisjunctionMaxQuery other) {
-    return tieBreakerMultiplier == other.tieBreakerMultiplier && 
-           Arrays.equals(disjuncts, other.disjuncts);
+    return tieBreakerMultiplier == other.tieBreakerMultiplier
+        && Arrays.equals(disjuncts, other.disjuncts);
   }
 
-  /** Compute a hash code for hashing us
+  /**
+   * Compute a hash code for hashing us
+   *
    * @return the hash code
    */
   @Override
@@ -287,6 +300,4 @@ public final class DisjunctionMaxQuery extends Query implements Iterable<Query>
     h = 31 * h + Arrays.hashCode(disjuncts);
     return h;
   }
-
-
 }
diff --git a/lucene/core/src/java/org/apache/lucene/search/DisjunctionMaxScorer.java b/lucene/core/src/java/org/apache/lucene/search/DisjunctionMaxScorer.java
index 63d0285..affe771 100644
--- a/lucene/core/src/java/org/apache/lucene/search/DisjunctionMaxScorer.java
+++ b/lucene/core/src/java/org/apache/lucene/search/DisjunctionMaxScorer.java
@@ -18,14 +18,13 @@ package org.apache.lucene.search;
 
 import java.io.IOException;
 import java.util.List;
-
 import org.apache.lucene.util.MathUtil;
 
 /**
- * The Scorer for DisjunctionMaxQuery.  The union of all documents generated by the subquery scorers
- * is generated in document number order.  The score for each document is the maximum of the scores computed
- * by the subquery scorers that generate that document, plus tieBreakerMultiplier times the sum of the scores
- * for the other subqueries that generate the document.
+ * The Scorer for DisjunctionMaxQuery. The union of all documents generated by the subquery scorers
+ * is generated in document number order. The score for each document is the maximum of the scores
+ * computed by the subquery scorers that generate that document, plus tieBreakerMultiplier times the
+ * sum of the scores for the other subqueries that generate the document.
  */
 final class DisjunctionMaxScorer extends DisjunctionScorer {
   private final List<Scorer> subScorers;
@@ -36,16 +35,15 @@ final class DisjunctionMaxScorer extends DisjunctionScorer {
 
   /**
    * Creates a new instance of DisjunctionMaxScorer
-   * 
-   * @param weight
-   *          The Weight to be used.
-   * @param tieBreakerMultiplier
-   *          Multiplier applied to non-maximum-scoring subqueries for a
-   *          document as they are summed into the result.
-   * @param subScorers
-   *          The sub scorers this Scorer should iterate on
+   *
+   * @param weight The Weight to be used.
+   * @param tieBreakerMultiplier Multiplier applied to non-maximum-scoring subqueries for a document
+   *     as they are summed into the result.
+   * @param subScorers The sub scorers this Scorer should iterate on
    */
-  DisjunctionMaxScorer(Weight weight, float tieBreakerMultiplier, List<Scorer> subScorers, ScoreMode scoreMode) throws IOException {
+  DisjunctionMaxScorer(
+      Weight weight, float tieBreakerMultiplier, List<Scorer> subScorers, ScoreMode scoreMode)
+      throws IOException {
     super(weight, subScorers, scoreMode);
     this.subScorers = subScorers;
     this.tieBreakerMultiplier = tieBreakerMultiplier;
diff --git a/lucene/core/src/java/org/apache/lucene/search/DisjunctionScoreBlockBoundaryPropagator.java b/lucene/core/src/java/org/apache/lucene/search/DisjunctionScoreBlockBoundaryPropagator.java
index a8fd206..20d4dcf 100644
--- a/lucene/core/src/java/org/apache/lucene/search/DisjunctionScoreBlockBoundaryPropagator.java
+++ b/lucene/core/src/java/org/apache/lucene/search/DisjunctionScoreBlockBoundaryPropagator.java
@@ -22,24 +22,25 @@ import java.util.Collection;
 import java.util.Comparator;
 
 /**
- * A helper to propagate block boundaries for disjunctions.
- * Because a disjunction matches if any of its sub clauses matches, it is
- * tempting to return the minimum block boundary across all clauses. The problem
- * is that it might then make the query slow when the minimum competitive score
- * is high and low-scoring clauses don't drive iteration anymore. So this class
- * computes block boundaries only across clauses whose maximum score is greater
- * than or equal to the minimum competitive score, or the maximum scoring clause
- * if there is no such clause.
+ * A helper to propagate block boundaries for disjunctions. Because a disjunction matches if any of
+ * its sub clauses matches, it is tempting to return the minimum block boundary across all clauses.
+ * The problem is that it might then make the query slow when the minimum competitive score is high
+ * and low-scoring clauses don't drive iteration anymore. So this class computes block boundaries
+ * only across clauses whose maximum score is greater than or equal to the minimum competitive
+ * score, or the maximum scoring clause if there is no such clause.
  */
 final class DisjunctionScoreBlockBoundaryPropagator {
 
-  private static final Comparator<Scorer> MAX_SCORE_COMPARATOR = Comparator.comparing((Scorer s) -> {
-    try {
-      return s.getMaxScore(DocIdSetIterator.NO_MORE_DOCS);
-    } catch (IOException e) {
-      throw new RuntimeException(e);
-    }
-  }).thenComparing(Comparator.comparing(s -> s.iterator().cost()));
+  private static final Comparator<Scorer> MAX_SCORE_COMPARATOR =
+      Comparator.comparing(
+              (Scorer s) -> {
+                try {
+                  return s.getMaxScore(DocIdSetIterator.NO_MORE_DOCS);
+                } catch (IOException e) {
+                  throw new RuntimeException(e);
+                }
+              })
+          .thenComparing(Comparator.comparing(s -> s.iterator().cost()));
 
   private final Scorer[] scorers;
   private final float[] maxScores;
@@ -58,9 +59,7 @@ final class DisjunctionScoreBlockBoundaryPropagator {
     }
   }
 
-  /**
-   * See {@link Scorer#advanceShallow(int)}.
-   */
+  /** See {@link Scorer#advanceShallow(int)}. */
   int advanceShallow(int target) throws IOException {
     // For scorers that are below the lead index, just propagate.
     for (int i = 0; i < leadIndex; ++i) {
@@ -98,8 +97,8 @@ final class DisjunctionScoreBlockBoundaryPropagator {
   }
 
   /**
-   * Set the minimum competitive score to filter out clauses that score less
-   * than this threshold.
+   * Set the minimum competitive score to filter out clauses that score less than this threshold.
+   *
    * @see Scorer#setMinCompetitiveScore
    */
   void setMinCompetitiveScore(float minScore) throws IOException {
@@ -108,5 +107,4 @@ final class DisjunctionScoreBlockBoundaryPropagator {
       leadIndex++;
     }
   }
-
 }
diff --git a/lucene/core/src/java/org/apache/lucene/search/DisjunctionScorer.java b/lucene/core/src/java/org/apache/lucene/search/DisjunctionScorer.java
index b1f2fd2..e7c7542 100644
--- a/lucene/core/src/java/org/apache/lucene/search/DisjunctionScorer.java
+++ b/lucene/core/src/java/org/apache/lucene/search/DisjunctionScorer.java
@@ -16,17 +16,13 @@
  */
 package org.apache.lucene.search;
 
-
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
-
 import org.apache.lucene.util.PriorityQueue;
 
-/**
- * Base class for Scorers that score disjunctions.
- */
+/** Base class for Scorers that score disjunctions. */
 abstract class DisjunctionScorer extends Scorer {
 
   private final boolean needsScores;
@@ -36,7 +32,8 @@ abstract class DisjunctionScorer extends Scorer {
   private final BlockMaxDISI blockMaxApprox;
   private final TwoPhase twoPhase;
 
-  protected DisjunctionScorer(Weight weight, List<Scorer> subScorers, ScoreMode scoreMode) throws IOException {
+  protected DisjunctionScorer(Weight weight, List<Scorer> subScorers, ScoreMode scoreMode)
+      throws IOException {
     super(weight);
     if (subScorers.size() <= 1) {
       throw new IllegalArgumentException("There must be at least 2 subScorers");
@@ -51,7 +48,8 @@ abstract class DisjunctionScorer extends Scorer {
       for (Scorer scorer : subScorers) {
         scorer.advanceShallow(0);
       }
-      this.blockMaxApprox = new BlockMaxDISI(new DisjunctionDISIApproximation(this.subScorers), this);
+      this.blockMaxApprox =
+          new BlockMaxDISI(new DisjunctionDISIApproximation(this.subScorers), this);
       this.approximation = blockMaxApprox;
     } else {
       this.approximation = new DisjunctionDISIApproximation(this.subScorers);
@@ -105,12 +103,13 @@ abstract class DisjunctionScorer extends Scorer {
     private TwoPhase(DocIdSetIterator approximation, float matchCost) {
       super(approximation);
       this.matchCost = matchCost;
-      unverifiedMatches = new PriorityQueue<DisiWrapper>(DisjunctionScorer.this.subScorers.size()) {
-        @Override
-        protected boolean lessThan(DisiWrapper a, DisiWrapper b) {
-          return a.matchCost < b.matchCost;
-        }
-      };
+      unverifiedMatches =
+          new PriorityQueue<DisiWrapper>(DisjunctionScorer.this.subScorers.size()) {
+            @Override
+            protected boolean lessThan(DisiWrapper a, DisiWrapper b) {
+              return a.matchCost < b.matchCost;
+            }
+          };
     }
 
     DisiWrapper getSubMatches() throws IOException {
@@ -124,20 +123,20 @@ abstract class DisjunctionScorer extends Scorer {
       unverifiedMatches.clear();
       return verifiedMatches;
     }
-    
+
     @Override
     public boolean matches() throws IOException {
       verifiedMatches = null;
       unverifiedMatches.clear();
-      
+
       for (DisiWrapper w = subScorers.topList(); w != null; ) {
         DisiWrapper next = w.next;
-        
+
         if (w.twoPhaseView == null) {
           // implicitly verified, move it to verifiedMatches
           w.next = verifiedMatches;
           verifiedMatches = w;
-          
+
           if (needsScores == false) {
             // we can stop here
             return true;
@@ -147,11 +146,11 @@ abstract class DisjunctionScorer extends Scorer {
         }
         w = next;
       }
-      
+
       if (verifiedMatches != null) {
         return true;
       }
-      
+
       // verify subs that have an two-phase iterator
       // least-costly ones first
       while (unverifiedMatches.size() > 0) {
@@ -162,10 +161,10 @@ abstract class DisjunctionScorer extends Scorer {
           return true;
         }
       }
-      
+
       return false;
     }
-    
+
     @Override
     public float matchCost() {
       return matchCost;
@@ -174,7 +173,7 @@ abstract class DisjunctionScorer extends Scorer {
 
   @Override
   public final int docID() {
-   return subScorers.top().doc;
+    return subScorers.top().doc;
   }
 
   BlockMaxDISI getBlockMaxApprox() {
@@ -205,5 +204,4 @@ abstract class DisjunctionScorer extends Scorer {
     }
     return children;
   }
-
 }
diff --git a/lucene/core/src/java/org/apache/lucene/search/DisjunctionSumScorer.java b/lucene/core/src/java/org/apache/lucene/search/DisjunctionSumScorer.java
index 18835ed..6909af7 100644
--- a/lucene/core/src/java/org/apache/lucene/search/DisjunctionSumScorer.java
+++ b/lucene/core/src/java/org/apache/lucene/search/DisjunctionSumScorer.java
@@ -16,19 +16,20 @@
  */
 package org.apache.lucene.search;
 
-
 import java.io.IOException;
 import java.util.List;
 
-/** A Scorer for OR like queries, counterpart of <code>ConjunctionScorer</code>.
- */
+/** A Scorer for OR like queries, counterpart of <code>ConjunctionScorer</code>. */
 final class DisjunctionSumScorer extends DisjunctionScorer {
 
-  /** Construct a <code>DisjunctionScorer</code>.
+  /**
+   * Construct a <code>DisjunctionScorer</code>.
+   *
    * @param weight The weight to be used.
    * @param subScorers Array of at least two subscorers.
    */
-  DisjunctionSumScorer(Weight weight, List<Scorer> subScorers, ScoreMode scoreMode) throws IOException {
+  DisjunctionSumScorer(Weight weight, List<Scorer> subScorers, ScoreMode scoreMode)
+      throws IOException {
     super(weight, subScorers, scoreMode);
   }
 
@@ -39,7 +40,7 @@ final class DisjunctionSumScorer extends DisjunctionScorer {
     for (DisiWrapper w = topList; w != null; w = w.next) {
       score += w.scorer.score();
     }
-    return (float)score;
+    return (float) score;
   }
 
   @Override
@@ -48,5 +49,4 @@ final class DisjunctionSumScorer extends DisjunctionScorer {
     // we actually care about block scores.
     return Float.MAX_VALUE;
   }
-
 }
diff --git a/lucene/core/src/java/org/apache/lucene/search/DocIdSet.java b/lucene/core/src/java/org/apache/lucene/search/DocIdSet.java
index 05870d9..aa2149b 100644
--- a/lucene/core/src/java/org/apache/lucene/search/DocIdSet.java
+++ b/lucene/core/src/java/org/apache/lucene/search/DocIdSet.java
@@ -16,41 +16,42 @@
  */
 package org.apache.lucene.search;
 
-
 import java.io.IOException;
-
 import org.apache.lucene.util.Accountable;
 import org.apache.lucene.util.Bits;
 
 /**
- * A DocIdSet contains a set of doc ids. Implementing classes must
- * only implement {@link #iterator} to provide access to the set. 
+ * A DocIdSet contains a set of doc ids. Implementing classes must only implement {@link #iterator}
+ * to provide access to the set.
  */
 public abstract class DocIdSet implements Accountable {
 
   /** An empty {@code DocIdSet} instance */
-  public static final DocIdSet EMPTY = new DocIdSet() {
-    
-    @Override
-    public DocIdSetIterator iterator() {
-      return DocIdSetIterator.empty();
-    }
-    
-    // we explicitly provide no random access, as this filter is 100% sparse and iterator exits faster
-    @Override
-    public Bits bits() {
-      return null;
-    }
+  public static final DocIdSet EMPTY =
+      new DocIdSet() {
+
+        @Override
+        public DocIdSetIterator iterator() {
+          return DocIdSetIterator.empty();
+        }
 
-    @Override
-    public long ramBytesUsed() {
-      return 0L;
-    }
-  };
+        // we explicitly provide no random access, as this filter is 100% sparse and iterator exits
+        // faster
+        @Override
+        public Bits bits() {
+          return null;
+        }
 
-  /** Provides a {@link DocIdSetIterator} to access the set.
-   * This implementation can return <code>null</code> if there
-   * are no docs that match. */
+        @Override
+        public long ramBytesUsed() {
+          return 0L;
+        }
+      };
+
+  /**
+   * Provides a {@link DocIdSetIterator} to access the set. This implementation can return <code>
+   * null</code> if there are no docs that match.
+   */
   public abstract DocIdSetIterator iterator() throws IOException;
 
   // TODO: somehow this class should express the cost of
@@ -60,21 +61,19 @@ public abstract class DocIdSet implements Accountable {
   // this is the opposite of what bits() is for now
   // (down-low filtering using e.g. FixedBitSet)
 
-  /** Optionally provides a {@link Bits} interface for random access
-   * to matching documents.
-   * @return {@code null}, if this {@code DocIdSet} does not support random access.
-   * In contrast to {@link #iterator()}, a return value of {@code null}
-   * <b>does not</b> imply that no documents match the filter!
-   * The default implementation does not provide random access, so you
-   * only need to implement this method if your DocIdSet can
-   * guarantee random access to every docid in O(1) time without
-   * external disk access (as {@link Bits} interface cannot throw
-   * {@link IOException}). This is generally true for bit sets
-   * like {@link org.apache.lucene.util.FixedBitSet}, which return
-   * itself if they are used as {@code DocIdSet}.
+  /**
+   * Optionally provides a {@link Bits} interface for random access to matching documents.
+   *
+   * @return {@code null}, if this {@code DocIdSet} does not support random access. In contrast to
+   *     {@link #iterator()}, a return value of {@code null} <b>does not</b> imply that no documents
+   *     match the filter! The default implementation does not provide random access, so you only
+   *     need to implement this method if your DocIdSet can guarantee random access to every docid
+   *     in O(1) time without external disk access (as {@link Bits} interface cannot throw {@link
+   *     IOException}). This is generally true for bit sets like {@link
+   *     org.apache.lucene.util.FixedBitSet}, which return itself if they are used as {@code
+   *     DocIdSet}.
    */
   public Bits bits() throws IOException {
     return null;
   }
-
 }
diff --git a/lucene/core/src/java/org/apache/lucene/search/DocIdSetIterator.java b/lucene/core/src/java/org/apache/lucene/search/DocIdSetIterator.java
index 4b9bf26..cfde6b3 100644
--- a/lucene/core/src/java/org/apache/lucene/search/DocIdSetIterator.java
+++ b/lucene/core/src/java/org/apache/lucene/search/DocIdSetIterator.java
@@ -16,23 +16,21 @@
  */
 package org.apache.lucene.search;
 
-
 import java.io.IOException;
 
 /**
- * This abstract class defines methods to iterate over a set of non-decreasing
- * doc ids. Note that this class assumes it iterates on doc Ids, and therefore
- * {@link #NO_MORE_DOCS} is set to {@value #NO_MORE_DOCS} in order to be used as
- * a sentinel object. Implementations of this class are expected to consider
- * {@link Integer#MAX_VALUE} as an invalid value.
+ * This abstract class defines methods to iterate over a set of non-decreasing doc ids. Note that
+ * this class assumes it iterates on doc Ids, and therefore {@link #NO_MORE_DOCS} is set to {@value
+ * #NO_MORE_DOCS} in order to be used as a sentinel object. Implementations of this class are
+ * expected to consider {@link Integer#MAX_VALUE} as an invalid value.
  */
 public abstract class DocIdSetIterator {
-  
+
   /** An empty {@code DocIdSetIterator} instance */
   public static final DocIdSetIterator empty() {
     return new DocIdSetIterator() {
       boolean exhausted = false;
-      
+
       @Override
       public int advance(int target) {
         assert !exhausted;
@@ -40,18 +38,19 @@ public abstract class DocIdSetIterator {
         exhausted = true;
         return NO_MORE_DOCS;
       }
-      
+
       @Override
       public int docID() {
         return exhausted ? NO_MORE_DOCS : -1;
       }
+
       @Override
       public int nextDoc() {
         assert !exhausted;
         exhausted = true;
         return NO_MORE_DOCS;
       }
-      
+
       @Override
       public long cost() {
         return 0;
@@ -59,8 +58,7 @@ public abstract class DocIdSetIterator {
     };
   }
 
-  /** A {@link DocIdSetIterator} that matches all documents up to
-   *  {@code maxDoc - 1}. */
+  /** A {@link DocIdSetIterator} that matches all documents up to {@code maxDoc - 1}. */
   public static final DocIdSetIterator all(int maxDoc) {
     return new DocIdSetIterator() {
       int doc = -1;
@@ -91,11 +89,14 @@ public abstract class DocIdSetIterator {
     };
   }
 
-  /** A {@link DocIdSetIterator} that matches a range documents from
-   *  minDocID (inclusive) to maxDocID (exclusive). */
+  /**
+   * A {@link DocIdSetIterator} that matches a range documents from minDocID (inclusive) to maxDocID
+   * (exclusive).
+   */
   public static final DocIdSetIterator range(int minDoc, int maxDoc) {
     if (minDoc >= maxDoc) {
-        throw new IllegalArgumentException("minDoc must be < maxDoc but got minDoc=" + minDoc + " maxDoc=" + maxDoc);
+      throw new IllegalArgumentException(
+          "minDoc must be < maxDoc but got minDoc=" + minDoc + " maxDoc=" + maxDoc);
     }
     if (minDoc < 0) {
       throw new IllegalArgumentException("minDoc must be >= 0 but got minDoc=" + minDoc);
@@ -116,11 +117,11 @@ public abstract class DocIdSetIterator {
       @Override
       public int advance(int target) throws IOException {
         if (target < minDoc) {
-            doc = minDoc;
+          doc = minDoc;
         } else if (target >= maxDoc) {
-            doc = NO_MORE_DOCS;
+          doc = NO_MORE_DOCS;
         } else {
-            doc = target;
+          doc = target;
         }
         return doc;
       }
@@ -133,49 +134,46 @@ public abstract class DocIdSetIterator {
   }
 
   /**
-   * When returned by {@link #nextDoc()}, {@link #advance(int)} and
-   * {@link #docID()} it means there are no more docs in the iterator.
+   * When returned by {@link #nextDoc()}, {@link #advance(int)} and {@link #docID()} it means there
+   * are no more docs in the iterator.
    */
   public static final int NO_MORE_DOCS = Integer.MAX_VALUE;
 
   /**
    * Returns the following:
+   *
    * <ul>
-   * <li><code>-1</code> if {@link #nextDoc()} or
-   * {@link #advance(int)} were not called yet.
-   * <li>{@link #NO_MORE_DOCS} if the iterator has exhausted.
-   * <li>Otherwise it should return the doc ID it is currently on.
+   *   <li><code>-1</code> if {@link #nextDoc()} or {@link #advance(int)} were not called yet.
+   *   <li>{@link #NO_MORE_DOCS} if the iterator has exhausted.
+   *   <li>Otherwise it should return the doc ID it is currently on.
    * </ul>
+   *
    * <p>
-   * 
+   *
    * @since 2.9
    */
   public abstract int docID();
 
   /**
-   * Advances to the next document in the set and returns the doc it is
-   * currently on, or {@link #NO_MORE_DOCS} if there are no more docs in the
-   * set.<br>
-   * 
-   * <b>NOTE:</b> after the iterator has exhausted you should not call this
-   * method, as it may result in unpredicted behavior.
-   * 
+   * Advances to the next document in the set and returns the doc it is currently on, or {@link
+   * #NO_MORE_DOCS} if there are no more docs in the set.<br>
+   * <b>NOTE:</b> after the iterator has exhausted you should not call this method, as it may result
+   * in unpredicted behavior.
+   *
    * @since 2.9
    */
   public abstract int nextDoc() throws IOException;
 
- /**
-   * Advances to the first beyond the current whose document number is greater 
-   * than or equal to <i>target</i>, and returns the document number itself. 
-   * Exhausts the iterator and returns {@link #NO_MORE_DOCS} if <i>target</i> 
-   * is greater than the highest document number in the set.
-   * <p>
-   * The behavior of this method is <b>undefined</b> when called with
-   * <code> target &le; current</code>, or after the iterator has exhausted.
-   * Both cases may result in unpredicted behavior.
-   * <p>
-   * When <code> target &gt; current</code> it behaves as if written:
-   * 
+  /**
+   * Advances to the first beyond the current whose document number is greater than or equal to
+   * <i>target</i>, and returns the document number itself. Exhausts the iterator and returns {@link
+   * #NO_MORE_DOCS} if <i>target</i> is greater than the highest document number in the set.
+   *
+   * <p>The behavior of this method is <b>undefined</b> when called with <code> target &le; current
+   * </code>, or after the iterator has exhausted. Both cases may result in unpredicted behavior.
+   *
+   * <p>When <code> target &gt; current</code> it behaves as if written:
+   *
    * <pre class="prettyprint">
    * int advance(int target) {
    *   int doc;
@@ -184,21 +182,23 @@ public abstract class DocIdSetIterator {
    *   return doc;
    * }
    * </pre>
-   * 
+   *
    * Some implementations are considerably more efficient than that.
-   * <p>
-   * <b>NOTE:</b> this method may be called with {@link #NO_MORE_DOCS} for
-   * efficiency by some Scorers. If your implementation cannot efficiently
-   * determine that it should exhaust, it is recommended that you check for that
-   * value in each call to this method.
+   *
+   * <p><b>NOTE:</b> this method may be called with {@link #NO_MORE_DOCS} for efficiency by some
+   * Scorers. If your implementation cannot efficiently determine that it should exhaust, it is
+   * recommended that you check for that value in each call to this method.
+   *
    * <p>
    *
    * @since 2.9
    */
   public abstract int advance(int target) throws IOException;
 
-  /** Slow (linear) implementation of {@link #advance} relying on
-   *  {@link #nextDoc()} to advance beyond the target position. */
+  /**
+   * Slow (linear) implementation of {@link #advance} relying on {@link #nextDoc()} to advance
+   * beyond the target position.
+   */
   protected final int slowAdvance(int target) throws IOException {
     assert docID() < target;
     int doc;
@@ -210,11 +210,9 @@ public abstract class DocIdSetIterator {
 
   /**
    * Returns the estimated cost of this {@link DocIdSetIterator}.
-   * <p>
-   * This is generally an upper bound of the number of documents this iterator
-   * might match, but may be a rough heuristic, hardcoded value, or otherwise
-   * completely inaccurate.
+   *
+   * <p>This is generally an upper bound of the number of documents this iterator might match, but
+   * may be a rough heuristic, hardcoded value, or otherwise completely inaccurate.
    */
   public abstract long cost();
-  
 }
diff --git a/lucene/core/src/java/org/apache/lucene/search/DocValuesFieldExistsQuery.java b/lucene/core/src/java/org/apache/lucene/search/DocValuesFieldExistsQuery.java
index 1ac5752..851c5bf 100644
--- a/lucene/core/src/java/org/apache/lucene/search/DocValuesFieldExistsQuery.java
+++ b/lucene/core/src/java/org/apache/lucene/search/DocValuesFieldExistsQuery.java
@@ -16,25 +16,22 @@
  */
 package org.apache.lucene.search;
 
-
 import java.io.IOException;
 import java.util.Objects;
-
 import org.apache.lucene.index.DocValues;
 import org.apache.lucene.index.FieldInfo;
 import org.apache.lucene.index.LeafReader;
 import org.apache.lucene.index.LeafReaderContext;
 
 /**
- * A {@link Query} that matches documents that have a value for a given field
- * as reported by doc values iterators.
+ * A {@link Query} that matches documents that have a value for a given field as reported by doc
+ * values iterators.
  */
 public final class DocValuesFieldExistsQuery extends Query {
 
   private final String field;
 
-  /** Create a query that will match documents which have a value for the given
-   *  {@code field}. */
+  /** Create a query that will match documents which have a value for the given {@code field}. */
   public DocValuesFieldExistsQuery(String field) {
     this.field = Objects.requireNonNull(field);
   }
@@ -45,8 +42,7 @@ public final class DocValuesFieldExistsQuery extends Query {
 
   @Override
   public boolean equals(Object other) {
-    return sameClassAs(other) &&
-           field.equals(((DocValuesFieldExistsQuery) other).field);
+    return sameClassAs(other) && field.equals(((DocValuesFieldExistsQuery) other).field);
   }
 
   @Override
@@ -82,15 +78,15 @@ public final class DocValuesFieldExistsQuery extends Query {
       public boolean isCacheable(LeafReaderContext ctx) {
         return DocValues.isCacheable(ctx, field);
       }
-
     };
   }
 
   /**
-   * Returns a {@link DocIdSetIterator} from the given field or null if the field doesn't exist
-   * in the reader or if the reader has no doc values for the field.
+   * Returns a {@link DocIdSetIterator} from the given field or null if the field doesn't exist in
+   * the reader or if the reader has no doc values for the field.
    */
-  public static DocIdSetIterator getDocValuesDocIdSetIterator(String field, LeafReader reader) throws IOException {
+  public static DocIdSetIterator getDocValuesDocIdSetIterator(String field, LeafReader reader)
+      throws IOException {
     FieldInfo fieldInfo = reader.getFieldInfos().fieldInfo(field);
     final DocIdSetIterator iterator;
     if (fieldInfo != null) {
diff --git a/lucene/core/src/java/org/apache/lucene/search/DocValuesRewriteMethod.java b/lucene/core/src/java/org/apache/lucene/search/DocValuesRewriteMethod.java
index e431e50..f1dadb5 100644
--- a/lucene/core/src/java/org/apache/lucene/search/DocValuesRewriteMethod.java
+++ b/lucene/core/src/java/org/apache/lucene/search/DocValuesRewriteMethod.java
@@ -16,9 +16,7 @@
  */
 package org.apache.lucene.search;
 
-
 import java.io.IOException;
-
 import org.apache.lucene.index.DocValues;
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.LeafReaderContext;
@@ -29,47 +27,47 @@ import org.apache.lucene.util.LongBitSet;
 
 /**
  * Rewrites MultiTermQueries into a filter, using DocValues for term enumeration.
- * <p>
- * This can be used to perform these queries against an unindexed docvalues field.
+ *
+ * <p>This can be used to perform these queries against an unindexed docvalues field.
+ *
  * @lucene.experimental
  */
 public final class DocValuesRewriteMethod extends MultiTermQuery.RewriteMethod {
-  
+
   @Override
   public Query rewrite(IndexReader reader, MultiTermQuery query) {
     return new ConstantScoreQuery(new MultiTermQueryDocValuesWrapper(query));
   }
-  
+
   static class MultiTermQueryDocValuesWrapper extends Query {
-    
+
     protected final MultiTermQuery query;
-    
-    /**
-     * Wrap a {@link MultiTermQuery} as a Filter.
-     */
+
+    /** Wrap a {@link MultiTermQuery} as a Filter. */
     protected MultiTermQueryDocValuesWrapper(MultiTermQuery query) {
       this.query = query;
     }
-    
+
     @Override
     public String toString(String field) {
       // query.toString should be ok for the filter, too, if the query boost is 1.0f
       return query.toString(field);
     }
-    
+
     @Override
     public final boolean equals(final Object other) {
-      return sameClassAs(other) &&
-             query.equals(((MultiTermQueryDocValuesWrapper) other).query);
+      return sameClassAs(other) && query.equals(((MultiTermQueryDocValuesWrapper) other).query);
     }
 
     @Override
     public final int hashCode() {
       return 31 * classHash() + query.hashCode();
     }
-    
+
     /** Returns the field name for this query */
-    public final String getField() { return query.getField(); }
+    public final String getField() {
+      return query.getField();
+    }
 
     @Override
     public void visit(QueryVisitor visitor) {
@@ -77,65 +75,71 @@ public final class DocValuesRewriteMethod extends MultiTermQuery.RewriteMethod {
         visitor.getSubVisitor(BooleanClause.Occur.FILTER, query);
       }
     }
-    
+
     @Override
-    public Weight createWeight(IndexSearcher searcher, ScoreMode scoreMode, float boost) throws IOException {
+    public Weight createWeight(IndexSearcher searcher, ScoreMode scoreMode, float boost)
+        throws IOException {
       return new ConstantScoreWeight(this, boost) {
 
         @Override
         public Matches matches(LeafReaderContext context, int doc) throws IOException {
           final SortedSetDocValues fcsi = DocValues.getSortedSet(context.reader(), query.field);
-          return MatchesUtils.forField(query.field, () -> DisjunctionMatchesIterator.fromTermsEnum(context, doc, query, query.field, getTermsEnum(fcsi)));
+          return MatchesUtils.forField(
+              query.field,
+              () ->
+                  DisjunctionMatchesIterator.fromTermsEnum(
+                      context, doc, query, query.field, getTermsEnum(fcsi)));
         }
 
         private TermsEnum getTermsEnum(SortedSetDocValues fcsi) throws IOException {
-          return query.getTermsEnum(new Terms() {
+          return query.getTermsEnum(
+              new Terms() {
 
-            @Override
-            public TermsEnum iterator() throws IOException {
-              return fcsi.termsEnum();
-            }
+                @Override
+                public TermsEnum iterator() throws IOException {
+                  return fcsi.termsEnum();
+                }
 
-            @Override
-            public long getSumTotalTermFreq() {
-              throw new UnsupportedOperationException();
-            }
+                @Override
+                public long getSumTotalTermFreq() {
+                  throw new UnsupportedOperationException();
+                }
 
-            @Override
-            public long getSumDocFreq() {
-              throw new UnsupportedOperationException();
-            }
+                @Override
+                public long getSumDocFreq() {
+                  throw new UnsupportedOperationException();
+                }
 
-            @Override
-            public int getDocCount() {
-              throw new UnsupportedOperationException();
-            }
+                @Override
+                public int getDocCount() {
+                  throw new UnsupportedOperationException();
+                }
 
-            @Override
-            public long size() {
-              return -1;
-            }
+                @Override
+                public long size() {
+                  return -1;
+                }
 
-            @Override
-            public boolean hasFreqs() {
-              return false;
-            }
+                @Override
+                public boolean hasFreqs() {
+                  return false;
+                }
 
-            @Override
-            public boolean hasOffsets() {
-              return false;
-            }
+                @Override
+                public boolean hasOffsets() {
+                  return false;
+                }
 
-            @Override
-            public boolean hasPositions() {
-              return false;
-            }
+                @Override
+                public boolean hasPositions() {
+                  return false;
+                }
 
-            @Override
-            public boolean hasPayloads() {
-              return false;
-            }
-          });
+                @Override
+                public boolean hasPayloads() {
+                  return false;
+                }
+              });
         }
 
         @Override
@@ -157,38 +161,42 @@ public final class DocValuesRewriteMethod extends MultiTermQuery.RewriteMethod {
             }
           } while (termsEnum.next() != null);
 
-          return new ConstantScoreScorer(this, score(), scoreMode, new TwoPhaseIterator(fcsi) {
-
-            @Override
-            public boolean matches() throws IOException {
-              for (long ord = fcsi.nextOrd(); ord != SortedSetDocValues.NO_MORE_ORDS; ord = fcsi.nextOrd()) {
-                if (termSet.get(ord)) {
-                  return true;
+          return new ConstantScoreScorer(
+              this,
+              score(),
+              scoreMode,
+              new TwoPhaseIterator(fcsi) {
+
+                @Override
+                public boolean matches() throws IOException {
+                  for (long ord = fcsi.nextOrd();
+                      ord != SortedSetDocValues.NO_MORE_ORDS;
+                      ord = fcsi.nextOrd()) {
+                    if (termSet.get(ord)) {
+                      return true;
+                    }
+                  }
+                  return false;
                 }
-              }
-              return false;
-            }
 
-            @Override
-            public float matchCost() {
-              return 3; // lookup in a bitset
-            }
-          });
+                @Override
+                public float matchCost() {
+                  return 3; // lookup in a bitset
+                }
+              });
         }
 
         @Override
         public boolean isCacheable(LeafReaderContext ctx) {
           return DocValues.isCacheable(ctx, query.field);
         }
-
       };
     }
   }
 
   @Override
   public boolean equals(Object other) {
-    return other != null &&
-           getClass() == other.getClass();
+    return other != null && getClass() == other.getClass();
   }
 
   @Override
diff --git a/lucene/core/src/java/org/apache/lucene/search/DoubleValues.java b/lucene/core/src/java/org/apache/lucene/search/DoubleValues.java
index 3a02970..4ccf8eb 100644
--- a/lucene/core/src/java/org/apache/lucene/search/DoubleValues.java
+++ b/lucene/core/src/java/org/apache/lucene/search/DoubleValues.java
@@ -19,25 +19,20 @@ package org.apache.lucene.search;
 
 import java.io.IOException;
 
-/**
- * Per-segment, per-document double values, which can be calculated at search-time
- */
+/** Per-segment, per-document double values, which can be calculated at search-time */
 public abstract class DoubleValues {
 
-  /**
-   * Get the double value for the current document
-   */
+  /** Get the double value for the current document */
   public abstract double doubleValue() throws IOException;
 
   /**
    * Advance this instance to the given document id
+   *
    * @return true if there is a value for this document
    */
   public abstract boolean advanceExact(int doc) throws IOException;
 
-  /**
-   * Wrap a DoubleValues instance, returning a default if the wrapped instance has no value
-   */
+  /** Wrap a DoubleValues instance, returning a default if the wrapped instance has no value */
   public static DoubleValues withDefault(DoubleValues in, double missingValue) {
     return new DoubleValues() {
 
@@ -57,18 +52,19 @@ public abstract class DoubleValues {
   }
 
   /**
-   * An empty DoubleValues instance that always returns {@code false} from {@link #advanceExact(int)}
+   * An empty DoubleValues instance that always returns {@code false} from {@link
+   * #advanceExact(int)}
    */
-  public static final DoubleValues EMPTY = new DoubleValues() {
-    @Override
-    public double doubleValue() throws IOException {
-      throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public boolean advanceExact(int doc) throws IOException {
-      return false;
-    }
-  };
+  public static final DoubleValues EMPTY =
+      new DoubleValues() {
+        @Override
+        public double doubleValue() throws IOException {
+          throw new UnsupportedOperationException();
+        }
 
+        @Override
+        public boolean advanceExact(int doc) throws IOException {
+          return false;
+        }
+      };
 }
diff --git a/lucene/core/src/java/org/apache/lucene/search/DoubleValuesSource.java b/lucene/core/src/java/org/apache/lucene/search/DoubleValuesSource.java
index 368bc11..df21726 100644
--- a/lucene/core/src/java/org/apache/lucene/search/DoubleValuesSource.java
+++ b/lucene/core/src/java/org/apache/lucene/search/DoubleValuesSource.java
@@ -21,7 +21,6 @@ import java.io.IOException;
 import java.util.Objects;
 import java.util.function.DoubleToLongFunction;
 import java.util.function.LongToDoubleFunction;
-
 import org.apache.lucene.index.DocValues;
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.LeafReaderContext;
@@ -31,33 +30,32 @@ import org.apache.lucene.search.comparators.DoubleComparator;
 /**
  * Base class for producing {@link DoubleValues}
  *
- * To obtain a {@link DoubleValues} object for a leaf reader, clients should call
- * {@link #rewrite(IndexSearcher)} against the top-level searcher, and then
- * call {@link #getValues(LeafReaderContext, DoubleValues)} on the resulting
- * DoubleValuesSource.
+ * <p>To obtain a {@link DoubleValues} object for a leaf reader, clients should call {@link
+ * #rewrite(IndexSearcher)} against the top-level searcher, and then call {@link
+ * #getValues(LeafReaderContext, DoubleValues)} on the resulting DoubleValuesSource.
  *
- * DoubleValuesSource objects for NumericDocValues fields can be obtained by calling
- * {@link #fromDoubleField(String)}, {@link #fromFloatField(String)}, {@link #fromIntField(String)}
- * or {@link #fromLongField(String)}, or from {@link #fromField(String, LongToDoubleFunction)} if
+ * <p>DoubleValuesSource objects for NumericDocValues fields can be obtained by calling {@link
+ * #fromDoubleField(String)}, {@link #fromFloatField(String)}, {@link #fromIntField(String)} or
+ * {@link #fromLongField(String)}, or from {@link #fromField(String, LongToDoubleFunction)} if
  * special long-to-double encoding is required.
  *
- * Scores may be used as a source for value calculations by wrapping a {@link Scorer} using
- * {@link #fromScorer(Scorable)} and passing the resulting DoubleValues to {@link #getValues(LeafReaderContext, DoubleValues)}.
- * The scores can then be accessed using the {@link #SCORES} DoubleValuesSource.
+ * <p>Scores may be used as a source for value calculations by wrapping a {@link Scorer} using
+ * {@link #fromScorer(Scorable)} and passing the resulting DoubleValues to {@link
+ * #getValues(LeafReaderContext, DoubleValues)}. The scores can then be accessed using the {@link
+ * #SCORES} DoubleValuesSource.
  */
 public abstract class DoubleValuesSource implements SegmentCacheable {
 
   /**
    * Returns a {@link DoubleValues} instance for the passed-in LeafReaderContext and scores
    *
-   * If scores are not needed to calculate the values (ie {@link #needsScores() returns false}, callers
-   * may safely pass {@code null} for the {@code scores} parameter.
+   * <p>If scores are not needed to calculate the values (ie {@link #needsScores() returns false},
+   * callers may safely pass {@code null} for the {@code scores} parameter.
    */
-  public abstract DoubleValues getValues(LeafReaderContext ctx, DoubleValues scores) throws IOException;
+  public abstract DoubleValues getValues(LeafReaderContext ctx, DoubleValues scores)
+      throws IOException;
 
-  /**
-   * Return true if document scores are needed to calculate values
-   */
+  /** Return true if document scores are needed to calculate values */
   public abstract boolean needsScores();
 
   /**
@@ -68,30 +66,35 @@ public abstract class DoubleValuesSource implements SegmentCacheable {
    * @return an Explanation for the value
    * @throws IOException if an {@link IOException} occurs
    */
-  public Explanation explain(LeafReaderContext ctx, int docId, Explanation scoreExplanation) throws IOException {
-    DoubleValues dv = getValues(ctx, DoubleValuesSource.constant(scoreExplanation.getValue().doubleValue()).getValues(ctx, null));
-    if (dv.advanceExact(docId))
-      return Explanation.match(dv.doubleValue(), this.toString());
+  public Explanation explain(LeafReaderContext ctx, int docId, Explanation scoreExplanation)
+      throws IOException {
+    DoubleValues dv =
+        getValues(
+            ctx,
+            DoubleValuesSource.constant(scoreExplanation.getValue().doubleValue())
+                .getValues(ctx, null));
+    if (dv.advanceExact(docId)) return Explanation.match(dv.doubleValue(), this.toString());
     return Explanation.noMatch(this.toString());
   }
 
   /**
    * Return a DoubleValuesSource specialised for the given IndexSearcher
    *
-   * Implementations should assume that this will only be called once.
-   * IndexReader-independent implementations can just return {@code this}
+   * <p>Implementations should assume that this will only be called once. IndexReader-independent
+   * implementations can just return {@code this}
    *
-   * Queries that use DoubleValuesSource objects should call rewrite() during
-   * {@link Query#createWeight(IndexSearcher, ScoreMode, float)} rather than during
-   * {@link Query#rewrite(IndexReader)} to avoid IndexReader reference leakage.
+   * <p>Queries that use DoubleValuesSource objects should call rewrite() during {@link
+   * Query#createWeight(IndexSearcher, ScoreMode, float)} rather than during {@link
+   * Query#rewrite(IndexReader)} to avoid IndexReader reference leakage.
    *
-   * For the same reason, implementations that cache references to the IndexSearcher
-   * should return a new object from this method.
+   * <p>For the same reason, implementations that cache references to the IndexSearcher should
+   * return a new object from this method.
    */
   public abstract DoubleValuesSource rewrite(IndexSearcher reader) throws IOException;
 
   /**
    * Create a sort field based on the value of this producer
+   *
    * @param reverse true if the sort should be decreasing
    */
   public SortField getSortField(boolean reverse) {
@@ -107,9 +110,7 @@ public abstract class DoubleValuesSource implements SegmentCacheable {
   @Override
   public abstract String toString();
 
-  /**
-   * Convert to a LongValuesSource by casting the double values to longs
-   */
+  /** Convert to a LongValuesSource by casting the double values to longs */
   public final LongValuesSource toLongValuesSource() {
     return new LongDoubleValuesSource(this);
   }
@@ -170,7 +171,6 @@ public abstract class DoubleValuesSource implements SegmentCacheable {
     public LongValuesSource rewrite(IndexSearcher searcher) throws IOException {
       return inner.rewrite(searcher).toLongValuesSource();
     }
-
   }
 
   /**
@@ -183,30 +183,22 @@ public abstract class DoubleValuesSource implements SegmentCacheable {
     return new FieldValuesSource(field, decoder);
   }
 
-  /**
-   * Creates a DoubleValuesSource that wraps a double-valued field
-   */
+  /** Creates a DoubleValuesSource that wraps a double-valued field */
   public static DoubleValuesSource fromDoubleField(String field) {
     return fromField(field, Double::longBitsToDouble);
   }
 
-  /**
-   * Creates a DoubleValuesSource that wraps a float-valued field
-   */
+  /** Creates a DoubleValuesSource that wraps a float-valued field */
   public static DoubleValuesSource fromFloatField(String field) {
-    return fromField(field, (v) -> (double)Float.intBitsToFloat((int)v));
+    return fromField(field, (v) -> (double) Float.intBitsToFloat((int) v));
   }
 
-  /**
-   * Creates a DoubleValuesSource that wraps a long-valued field
-   */
+  /** Creates a DoubleValuesSource that wraps a long-valued field */
   public static DoubleValuesSource fromLongField(String field) {
     return fromField(field, (v) -> (double) v);
   }
 
-  /**
-   * Creates a DoubleValuesSource that wraps an int-valued field
-   */
+  /** Creates a DoubleValuesSource that wraps an int-valued field */
   public static DoubleValuesSource fromIntField(String field) {
     return fromLongField(field);
   }
@@ -214,55 +206,56 @@ public abstract class DoubleValuesSource implements SegmentCacheable {
   /**
    * A DoubleValuesSource that exposes a document's score
    *
-   * If this source is used as part of a values calculation, then callers must not
-   * pass {@code null} as the {@link DoubleValues} parameter on {@link #getValues(LeafReaderContext, DoubleValues)}
+   * <p>If this source is used as part of a values calculation, then callers must not pass {@code
+   * null} as the {@link DoubleValues} parameter on {@link #getValues(LeafReaderContext,
+   * DoubleValues)}
    */
-  public static final DoubleValuesSource SCORES = new DoubleValuesSource() {
-    @Override
-    public DoubleValues getValues(LeafReaderContext ctx, DoubleValues scores) throws IOException {
-      assert scores != null;
-      return scores;
-    }
+  public static final DoubleValuesSource SCORES =
+      new DoubleValuesSource() {
+        @Override
+        public DoubleValues getValues(LeafReaderContext ctx, DoubleValues scores)
+            throws IOException {
+          assert scores != null;
+          return scores;
+        }
 
-    @Override
-    public boolean needsScores() {
-      return true;
-    }
+        @Override
+        public boolean needsScores() {
+          return true;
+        }
 
-    @Override
-    public boolean isCacheable(LeafReaderContext ctx) {
-      return false;
-    }
+        @Override
+        public boolean isCacheable(LeafReaderContext ctx) {
+          return false;
+        }
 
-    @Override
-    public Explanation explain(LeafReaderContext ctx, int docId, Explanation scoreExplanation) {
-      return scoreExplanation;
-    }
+        @Override
+        public Explanation explain(LeafReaderContext ctx, int docId, Explanation scoreExplanation) {
+          return scoreExplanation;
+        }
 
-    @Override
-    public int hashCode() {
-      return 0;
-    }
+        @Override
+        public int hashCode() {
+          return 0;
+        }
 
-    @Override
-    public boolean equals(Object obj) {
-      return obj == this;
-    }
+        @Override
+        public boolean equals(Object obj) {
+          return obj == this;
+        }
 
-    @Override
-    public String toString() {
-      return "scores";
-    }
+        @Override
+        public String toString() {
+          return "scores";
+        }
 
-    @Override
-    public DoubleValuesSource rewrite(IndexSearcher searcher) {
-      return this;
-    }
-  };
+        @Override
+        public DoubleValuesSource rewrite(IndexSearcher searcher) {
+          return this;
+        }
+      };
 
-  /**
-   * Creates a DoubleValuesSource that always returns a constant value
-   */
+  /** Creates a DoubleValuesSource that always returns a constant value */
   public static DoubleValuesSource constant(double value) {
     return new ConstantValuesSource(value);
   }
@@ -274,17 +267,18 @@ public abstract class DoubleValuesSource implements SegmentCacheable {
 
     private ConstantValuesSource(double value) {
       this.value = value;
-      this.doubleValues = new DoubleValues() {
-        @Override
-        public double doubleValue() {
-          return value;
-        }
+      this.doubleValues =
+          new DoubleValues() {
+            @Override
+            public double doubleValue() {
+              return value;
+            }
 
-        @Override
-        public boolean advanceExact(int doc) {
-          return true;
-        }
-      };
+            @Override
+            public boolean advanceExact(int doc) {
+              return true;
+            }
+          };
     }
 
     @Override
@@ -292,7 +286,6 @@ public abstract class DoubleValuesSource implements SegmentCacheable {
       return this;
     }
 
-
     @Override
     public DoubleValues getValues(LeafReaderContext ctx, DoubleValues scores) throws IOException {
       return doubleValues;
@@ -303,7 +296,6 @@ public abstract class DoubleValuesSource implements SegmentCacheable {
       return false;
     }
 
-
     @Override
     public boolean isCacheable(LeafReaderContext ctx) {
       return true;
@@ -331,12 +323,9 @@ public abstract class DoubleValuesSource implements SegmentCacheable {
     public String toString() {
       return "constant(" + value + ")";
     }
-
   }
 
-  /**
-   * Returns a DoubleValues instance that wraps scores returned by a Scorer
-   */
+  /** Returns a DoubleValues instance that wraps scores returned by a Scorer */
   public static DoubleValues fromScorer(Scorable scorer) {
     return new DoubleValues() {
       @Override
@@ -367,8 +356,7 @@ public abstract class DoubleValuesSource implements SegmentCacheable {
       if (this == o) return true;
       if (o == null || getClass() != o.getClass()) return false;
       FieldValuesSource that = (FieldValuesSource) o;
-      return Objects.equals(field, that.field) &&
-          Objects.equals(decoder, that.decoder);
+      return Objects.equals(field, that.field) && Objects.equals(decoder, that.decoder);
     }
 
     @Override
@@ -408,18 +396,17 @@ public abstract class DoubleValuesSource implements SegmentCacheable {
     }
 
     @Override
-    public Explanation explain(LeafReaderContext ctx, int docId, Explanation scoreExplanation) throws IOException {
+    public Explanation explain(LeafReaderContext ctx, int docId, Explanation scoreExplanation)
+        throws IOException {
       DoubleValues values = getValues(ctx, null);
       if (values.advanceExact(docId))
         return Explanation.match(values.doubleValue(), this.toString());
-      else
-        return Explanation.noMatch(this.toString());
+      else return Explanation.noMatch(this.toString());
     }
 
     public DoubleValuesSource rewrite(IndexSearcher searcher) throws IOException {
       return this;
     }
-
   }
 
   private static class DoubleValuesSortField extends SortField {
@@ -435,7 +422,8 @@ public abstract class DoubleValuesSource implements SegmentCacheable {
     public void setMissingValue(Object missingValue) {
       if (missingValue instanceof Number) {
         this.missingValue = missingValue;
-        ((DoubleValuesComparatorSource) getComparatorSource()).setMissingValue(((Number) missingValue).doubleValue());
+        ((DoubleValuesComparatorSource) getComparatorSource())
+            .setMissingValue(((Number) missingValue).doubleValue());
       } else {
         super.setMissingValue(missingValue);
       }
@@ -450,8 +438,7 @@ public abstract class DoubleValuesSource implements SegmentCacheable {
     public String toString() {
       StringBuilder buffer = new StringBuilder("<");
       buffer.append(getField()).append(">");
-      if (reverse)
-        buffer.append("!");
+      if (reverse) buffer.append("!");
       return buffer.toString();
     }
 
@@ -487,8 +474,8 @@ public abstract class DoubleValuesSource implements SegmentCacheable {
     }
 
     @Override
-    public FieldComparator<Double> newComparator(String fieldname, int numHits,
-                                               int sortPos, boolean reversed) {
+    public FieldComparator<Double> newComparator(
+        String fieldname, int numHits, int sortPos, boolean reversed) {
       return new DoubleComparator(numHits, fieldname, missingValue, reversed, sortPos) {
         @Override
         public LeafFieldComparator getLeafComparator(LeafReaderContext context) throws IOException {
@@ -496,9 +483,10 @@ public abstract class DoubleValuesSource implements SegmentCacheable {
 
           return new DoubleComparator.DoubleLeafComparator(context) {
             LeafReaderContext ctx;
-            
+
             @Override
-            protected NumericDocValues getNumericDocValues(LeafReaderContext context, String field) {
+            protected NumericDocValues getNumericDocValues(
+                LeafReaderContext context, String field) {
               ctx = context;
               return asNumericDocValues(holder, Double::doubleToLongBits);
             }
@@ -514,7 +502,8 @@ public abstract class DoubleValuesSource implements SegmentCacheable {
     }
   }
 
-  private static NumericDocValues asNumericDocValues(DoubleValuesHolder in, DoubleToLongFunction converter) {
+  private static NumericDocValues asNumericDocValues(
+      DoubleValuesHolder in, DoubleToLongFunction converter) {
     return new NumericDocValues() {
       @Override
       public long longValue() throws IOException {
@@ -548,9 +537,7 @@ public abstract class DoubleValuesSource implements SegmentCacheable {
     };
   }
 
-  /**
-   * Create a DoubleValuesSource that returns the score of a particular query
-   */
+  /** Create a DoubleValuesSource that returns the score of a particular query */
   public static DoubleValuesSource fromQuery(Query query) {
     return new QueryDoubleValuesSource(query);
   }
@@ -579,7 +566,6 @@ public abstract class DoubleValuesSource implements SegmentCacheable {
     @Override
     public DoubleValues getValues(LeafReaderContext ctx, DoubleValues scores) throws IOException {
       throw new UnsupportedOperationException("This DoubleValuesSource must be rewritten");
-
     }
 
     @Override
@@ -589,7 +575,8 @@ public abstract class DoubleValuesSource implements SegmentCacheable {
 
     @Override
     public DoubleValuesSource rewrite(IndexSearcher searcher) throws IOException {
-      return new WeightDoubleValuesSource(searcher.rewrite(query).createWeight(searcher, ScoreMode.COMPLETE, 1f));
+      return new WeightDoubleValuesSource(
+          searcher.rewrite(query).createWeight(searcher, ScoreMode.COMPLETE, 1f));
     }
 
     @Override
@@ -614,12 +601,12 @@ public abstract class DoubleValuesSource implements SegmentCacheable {
     @Override
     public DoubleValues getValues(LeafReaderContext ctx, DoubleValues scores) throws IOException {
       Scorer scorer = weight.scorer(ctx);
-      if (scorer == null)
-        return DoubleValues.EMPTY;
+      if (scorer == null) return DoubleValues.EMPTY;
 
       return new DoubleValues() {
         private final TwoPhaseIterator tpi = scorer.twoPhaseIterator();
-        private final DocIdSetIterator disi = (tpi == null) ? scorer.iterator() : tpi.approximation();
+        private final DocIdSetIterator disi =
+            (tpi == null) ? scorer.iterator() : tpi.approximation();
 
         @Override
         public double doubleValue() throws IOException {
@@ -637,7 +624,8 @@ public abstract class DoubleValuesSource implements SegmentCacheable {
     }
 
     @Override
-    public Explanation explain(LeafReaderContext ctx, int docId, Explanation scoreExplanation) throws IOException {
+    public Explanation explain(LeafReaderContext ctx, int docId, Explanation scoreExplanation)
+        throws IOException {
       return weight.explain(ctx, docId);
     }
 
@@ -674,5 +662,4 @@ public abstract class DoubleValuesSource implements SegmentCacheable {
       return false;
     }
   }
-
 }
diff --git a/lucene/core/src/java/org/apache/lucene/search/ExactPhraseMatcher.java b/lucene/core/src/java/org/apache/lucene/search/ExactPhraseMatcher.java
index a61f4fc..9818af9 100644
--- a/lucene/core/src/java/org/apache/lucene/search/ExactPhraseMatcher.java
+++ b/lucene/core/src/java/org/apache/lucene/search/ExactPhraseMatcher.java
@@ -16,7 +16,6 @@
  */
 package org.apache.lucene.search;
 
-
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -24,7 +23,6 @@ import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
 import java.util.stream.Collectors;
-
 import org.apache.lucene.index.Impact;
 import org.apache.lucene.index.Impacts;
 import org.apache.lucene.index.ImpactsEnum;
@@ -33,7 +31,9 @@ import org.apache.lucene.index.PostingsEnum;
 import org.apache.lucene.search.similarities.Similarity.SimScorer;
 import org.apache.lucene.util.PriorityQueue;
 
-/** Expert: Find exact phrases
+/**
+ * Expert: Find exact phrases
+ *
  * @lucene.internal
  */
 public final class ExactPhraseMatcher extends PhraseMatcher {
@@ -54,24 +54,33 @@ public final class ExactPhraseMatcher extends PhraseMatcher {
   private final ImpactsDISI impactsApproximation;
 
   /** Expert: Creates ExactPhraseMatcher instance */
-  public ExactPhraseMatcher(PhraseQuery.PostingsAndFreq[] postings, ScoreMode scoreMode, SimScorer scorer, float matchCost) {
+  public ExactPhraseMatcher(
+      PhraseQuery.PostingsAndFreq[] postings,
+      ScoreMode scoreMode,
+      SimScorer scorer,
+      float matchCost) {
     super(matchCost);
 
-    final DocIdSetIterator approximation = ConjunctionDISI.intersectIterators(Arrays.stream(postings).map(p -> p.postings).collect(Collectors.toList()));
-    final ImpactsSource impactsSource = mergeImpacts(Arrays.stream(postings).map(p -> p.impacts).toArray(ImpactsEnum[]::new));
+    final DocIdSetIterator approximation =
+        ConjunctionDISI.intersectIterators(
+            Arrays.stream(postings).map(p -> p.postings).collect(Collectors.toList()));
+    final ImpactsSource impactsSource =
+        mergeImpacts(Arrays.stream(postings).map(p -> p.impacts).toArray(ImpactsEnum[]::new));
 
     if (scoreMode == ScoreMode.TOP_SCORES) {
-      this.approximation = this.impactsApproximation = new ImpactsDISI(approximation, impactsSource, scorer);
+      this.approximation =
+          this.impactsApproximation = new ImpactsDISI(approximation, impactsSource, scorer);
     } else {
       this.approximation = approximation;
       this.impactsApproximation = new ImpactsDISI(approximation, impactsSource, scorer);
     }
 
     List<PostingsAndPosition> postingsAndPositions = new ArrayList<>();
-    for(PhraseQuery.PostingsAndFreq posting : postings) {
+    for (PhraseQuery.PostingsAndFreq posting : postings) {
       postingsAndPositions.add(new PostingsAndPosition(posting.postings, posting.position));
     }
-    this.postings = postingsAndPositions.toArray(new PostingsAndPosition[postingsAndPositions.size()]);
+    this.postings =
+        postingsAndPositions.toArray(new PostingsAndPosition[postingsAndPositions.size()]);
   }
 
   @Override
@@ -93,10 +102,12 @@ public final class ExactPhraseMatcher extends PhraseMatcher {
     return minFreq;
   }
 
-  /** Advance the given pos enum to the first doc on or after {@code target}.
-   *  Return {@code false} if the enum was exhausted before reaching
-   *  {@code target} and {@code true} otherwise. */
-  private static boolean advancePosition(PostingsAndPosition posting, int target) throws IOException {
+  /**
+   * Advance the given pos enum to the first doc on or after {@code target}. Return {@code false} if
+   * the enum was exhausted before reaching {@code target} and {@code true} otherwise.
+   */
+  private static boolean advancePosition(PostingsAndPosition posting, int target)
+      throws IOException {
     while (posting.pos < target) {
       if (posting.upTo == posting.freq) {
         return false;
@@ -123,8 +134,7 @@ public final class ExactPhraseMatcher extends PhraseMatcher {
     if (lead.upTo < lead.freq) {
       lead.pos = lead.postings.nextPosition();
       lead.upTo += 1;
-    }
-    else {
+    } else {
       return false;
     }
     advanceHead:
@@ -177,9 +187,7 @@ public final class ExactPhraseMatcher extends PhraseMatcher {
     return postings[postings.length - 1].postings.endOffset();
   }
 
-  /**
-   * Merge impacts for multiple terms of an exact phrase.
-   */
+  /** Merge impacts for multiple terms of an exact phrase. */
   static ImpactsSource mergeImpacts(ImpactsEnum[] impactsEnums) {
     // Iteration of block boundaries uses the impacts enum with the lower cost.
     // This is consistent with BlockMaxConjunctionScorer.
@@ -235,8 +243,8 @@ public final class ExactPhraseMatcher extends PhraseMatcher {
           }
 
           /**
-           * Return the minimum level whose impacts are valid up to {@code docIdUpTo},
-           * or {@code -1} if there is no such level.
+           * Return the minimum level whose impacts are valid up to {@code docIdUpTo}, or {@code -1}
+           * if there is no such level.
            */
           private int getLevel(Impacts impacts, int docIdUpTo) {
             for (int level = 0, numLevels = impacts.numLevels(); level < numLevels; ++level) {
@@ -251,12 +259,13 @@ public final class ExactPhraseMatcher extends PhraseMatcher {
           public List<Impact> getImpacts(int level) {
             final int docIdUpTo = getDocIdUpTo(level);
 
-            PriorityQueue<SubIterator> pq = new PriorityQueue<SubIterator>(impacts.length) {
-              @Override
-              protected boolean lessThan(SubIterator a, SubIterator b) {
-                return a.current.freq < b.current.freq;
-              }
-            };
+            PriorityQueue<SubIterator> pq =
+                new PriorityQueue<SubIterator>(impacts.length) {
+                  @Override
+                  protected boolean lessThan(SubIterator a, SubIterator b) {
+                    return a.current.freq < b.current.freq;
+                  }
+                };
 
             boolean hasImpacts = false;
             List<Impact> onlyImpactList = null;
@@ -309,8 +318,10 @@ public final class ExactPhraseMatcher extends PhraseMatcher {
               }
             }
 
-            outer: while (true) {
-              if (mergedImpacts.size() > 0 && mergedImpacts.get(mergedImpacts.size() - 1).norm == currentNorm) {
+            outer:
+            while (true) {
+              if (mergedImpacts.size() > 0
+                  && mergedImpacts.get(mergedImpacts.size() - 1).norm == currentNorm) {
                 mergedImpacts.get(mergedImpacts.size() - 1).freq = currentFreq;
               } else {
                 mergedImpacts.add(new Impact(currentFreq, currentNorm));
@@ -345,5 +356,4 @@ public final class ExactPhraseMatcher extends PhraseMatcher {
       }
     };
   }
-
 }
diff --git a/lucene/core/src/java/org/apache/lucene/search/Explanation.java b/lucene/core/src/java/org/apache/lucene/search/Explanation.java
index f5d2ec4..460a20e 100644
--- a/lucene/core/src/java/org/apache/lucene/search/Explanation.java
+++ b/lucene/core/src/java/org/apache/lucene/search/Explanation.java
@@ -28,45 +28,45 @@ public final class Explanation {
 
   /**
    * Create a new explanation for a match.
-   * @param value       the contribution to the score of the document
+   *
+   * @param value the contribution to the score of the document
    * @param description how {@code value} was computed
-   * @param details     sub explanations that contributed to this explanation
+   * @param details sub explanations that contributed to this explanation
    */
-  public static Explanation match(Number value, String description, Collection<Explanation> details) {
+  public static Explanation match(
+      Number value, String description, Collection<Explanation> details) {
     return new Explanation(true, value, description, details);
   }
 
   /**
    * Create a new explanation for a match.
-   * @param value       the contribution to the score of the document
+   *
+   * @param value the contribution to the score of the document
    * @param description how {@code value} was computed
-   * @param details     sub explanations that contributed to this explanation
+   * @param details sub explanations that contributed to this explanation
    */
   public static Explanation match(Number value, String description, Explanation... details) {
     return new Explanation(true, value, description, Arrays.asList(details));
   }
 
-  /**
-   * Create a new explanation for a document which does not match.
-   */
+  /** Create a new explanation for a document which does not match. */
   public static Explanation noMatch(String description, Collection<Explanation> details) {
     return new Explanation(false, 0f, description, details);
   }
 
-  /**
-   * Create a new explanation for a document which does not match.
-   */
+  /** Create a new explanation for a document which does not match. */
   public static Explanation noMatch(String description, Explanation... details) {
     return new Explanation(false, 0f, description, Arrays.asList(details));
   }
 
-  private final boolean match;                          // whether the document matched
-  private final Number value;                            // the value of this node
-  private final String description;                     // what it represents
-  private final List<Explanation> details;              // sub-explanations
+  private final boolean match; // whether the document matched
+  private final Number value; // the value of this node
+  private final String description; // what it represents
+  private final List<Explanation> details; // sub-explanations
 
-  /** Create a new explanation  */
-  private Explanation(boolean match, Number value, String description, Collection<Explanation> details) {
+  /** Create a new explanation */
+  private Explanation(
+      boolean match, Number value, String description, Collection<Explanation> details) {
     this.match = match;
     this.value = Objects.requireNonNull(value);
     this.description = Objects.requireNonNull(description);
@@ -76,23 +76,25 @@ public final class Explanation {
     }
   }
 
-  /**
-   * Indicates whether or not this Explanation models a match.
-   */
+  /** Indicates whether or not this Explanation models a match. */
   public boolean isMatch() {
     return match;
   }
-  
+
   /** The value assigned to this explanation node. */
-  public Number getValue() { return value; }
+  public Number getValue() {
+    return value;
+  }
 
   /** A description of this explanation node. */
-  public String getDescription() { return description; }
+  public String getDescription() {
+    return description;
+  }
 
   private String getSummary() {
     return getValue() + " = " + getDescription();
   }
-  
+
   /** The sub-nodes of this explanation node. */
   public Explanation[] getDetails() {
     return details.toArray(new Explanation[0]);
@@ -113,8 +115,8 @@ public final class Explanation {
     buffer.append("\n");
 
     Explanation[] details = getDetails();
-    for (int i = 0 ; i < details.length; i++) {
-      buffer.append(details[i].toString(depth+1));
+    for (int i = 0; i < details.length; i++) {
+      buffer.append(details[i].toString(depth + 1));
     }
 
     return buffer.toString();
@@ -125,15 +127,14 @@ public final class Explanation {
     if (this == o) return true;
     if (o == null || getClass() != o.getClass()) return false;
     Explanation that = (Explanation) o;
-    return match == that.match &&
-        Objects.equals(value, that.value) &&
-        Objects.equals(description, that.description) &&
-        Objects.equals(details, that.details);
+    return match == that.match
+        && Objects.equals(value, that.value)
+        && Objects.equals(description, that.description)
+        && Objects.equals(details, that.details);
   }
 
   @Override
   public int hashCode() {
     return Objects.hash(match, value, description, details);
   }
-
 }
diff --git a/lucene/core/src/java/org/apache/lucene/search/FieldComparator.java b/lucene/core/src/java/org/apache/lucene/search/FieldComparator.java
index 9534998..90db5ac 100644
--- a/lucene/core/src/java/org/apache/lucene/search/FieldComparator.java
+++ b/lucene/core/src/java/org/apache/lucene/search/FieldComparator.java
@@ -16,10 +16,7 @@
  */
 package org.apache.lucene.search;
 
-
-
 import java.io.IOException;
-
 import org.apache.lucene.index.BinaryDocValues;
 import org.apache.lucene.index.DocValues;
 import org.apache.lucene.index.LeafReaderContext;
@@ -28,46 +25,32 @@ import org.apache.lucene.util.BytesRef;
 import org.apache.lucene.util.BytesRefBuilder;
 
 /**
- * Expert: a FieldComparator compares hits so as to determine their
- * sort order when collecting the top results with {@link
- * TopFieldCollector}.  The concrete public FieldComparator
- * classes here correspond to the SortField types.
+ * Expert: a FieldComparator compares hits so as to determine their sort order when collecting the
+ * top results with {@link TopFieldCollector}. The concrete public FieldComparator classes here
+ * correspond to the SortField types.
  *
- * <p>The document IDs passed to these methods must only
- * move forwards, since they are using doc values iterators
- * to retrieve sort values.</p>
+ * <p>The document IDs passed to these methods must only move forwards, since they are using doc
+ * values iterators to retrieve sort values.
  *
- * <p>This API is designed to achieve high performance
- * sorting, by exposing a tight interaction with {@link
- * FieldValueHitQueue} as it visits hits.  Whenever a hit is
- * competitive, it's enrolled into a virtual slot, which is
- * an int ranging from 0 to numHits-1. Segment transitions are
- * handled by creating a dedicated per-segment
- * {@link LeafFieldComparator} which also needs to interact
- * with the {@link FieldValueHitQueue} but can optimize based
- * on the segment to collect.</p>
- * 
- * <p>The following functions need to be implemented</p>
- * <ul>
- *  <li> {@link #compare} Compare a hit at 'slot a'
- *       with hit 'slot b'.
- * 
- *  <li> {@link #setTopValue} This method is called by
- *       {@link TopFieldCollector} to notify the
- *       FieldComparator of the top most value, which is
- *       used by future calls to
- *       {@link LeafFieldComparator#compareTop}.
- * 
- *  <li> {@link #getLeafComparator(org.apache.lucene.index.LeafReaderContext)} Invoked
- *       when the search is switching to the next segment.
- *       You may need to update internal state of the
- *       comparator, for example retrieving new values from
- *       DocValues.
+ * <p>This API is designed to achieve high performance sorting, by exposing a tight interaction with
+ * {@link FieldValueHitQueue} as it visits hits. Whenever a hit is competitive, it's enrolled into a
+ * virtual slot, which is an int ranging from 0 to numHits-1. Segment transitions are handled by
+ * creating a dedicated per-segment {@link LeafFieldComparator} which also needs to interact with
+ * the {@link FieldValueHitQueue} but can optimize based on the segment to collect.
  *
- *  <li> {@link #value} Return the sort value stored in
- *       the specified slot.  This is only called at the end
- *       of the search, in order to populate {@link
- *       FieldDoc#fields} when returning the top results.
+ * <p>The following functions need to be implemented
+ *
+ * <ul>
+ *   <li>{@link #compare} Compare a hit at 'slot a' with hit 'slot b'.
+ *   <li>{@link #setTopValue} This method is called by {@link TopFieldCollector} to notify the
+ *       FieldComparator of the top most value, which is used by future calls to {@link
+ *       LeafFieldComparator#compareTop}.
+ *   <li>{@link #getLeafComparator(org.apache.lucene.index.LeafReaderContext)} Invoked when the
+ *       search is switching to the next segment. You may need to update internal state of the
+ *       comparator, for example retrieving new values from DocValues.
+ *   <li>{@link #value} Return the sort value stored in the specified slot. This is only called at
+ *       the end of the search, in order to populate {@link FieldDoc#fields} when returning the top
+ *       results.
  * </ul>
  *
  * @see LeafFieldComparator
@@ -77,20 +60,18 @@ public abstract class FieldComparator<T> {
 
   /**
    * Compare hit at slot1 with hit at slot2.
-   * 
+   *
    * @param slot1 first slot to compare
    * @param slot2 second slot to compare
-   * @return any {@code N < 0} if slot2's value is sorted after
-   * slot1, any {@code N > 0} if the slot2's value is sorted before
-   * slot1 and {@code 0} if they are equal
+   * @return any {@code N < 0} if slot2's value is sorted after slot1, any {@code N > 0} if the
+   *     slot2's value is sorted before slot1 and {@code 0} if they are equal
    */
   public abstract int compare(int slot1, int slot2);
 
   /**
-   * Record the top value, for future calls to {@link
-   * LeafFieldComparator#compareTop}.  This is only called for searches that
-   * use searchAfter (deep paging), and is called before any
-   * calls to {@link #getLeafComparator(LeafReaderContext)}.
+   * Record the top value, for future calls to {@link LeafFieldComparator#compareTop}. This is only
+   * called for searches that use searchAfter (deep paging), and is called before any calls to
+   * {@link #getLeafComparator(LeafReaderContext)}.
    */
   public abstract void setTopValue(T value);
 
@@ -103,23 +84,24 @@ public abstract class FieldComparator<T> {
   public abstract T value(int slot);
 
   /**
-   * Get a per-segment {@link LeafFieldComparator} to collect the given
-   * {@link org.apache.lucene.index.LeafReaderContext}. All docIDs supplied to
-   * this {@link LeafFieldComparator} are relative to the current reader (you
-   * must add docBase if you need to map it to a top-level docID).
-   * 
+   * Get a per-segment {@link LeafFieldComparator} to collect the given {@link
+   * org.apache.lucene.index.LeafReaderContext}. All docIDs supplied to this {@link
+   * LeafFieldComparator} are relative to the current reader (you must add docBase if you need to
+   * map it to a top-level docID).
+   *
    * @param context current reader context
    * @return the comparator to use for this segment
    * @throws IOException if there is a low-level IO error
    */
-  public abstract LeafFieldComparator getLeafComparator(LeafReaderContext context) throws IOException;
-
-  /** Returns a negative integer if first is less than second,
-   *  0 if they are equal and a positive integer otherwise. Default
-   *  impl to assume the type implements Comparable and
-   *  invoke .compareTo; be sure to override this method if
-   *  your FieldComparator's type isn't a Comparable or
-   *  if your values may sometimes be null */
+  public abstract LeafFieldComparator getLeafComparator(LeafReaderContext context)
+      throws IOException;
+
+  /**
+   * Returns a negative integer if first is less than second, 0 if they are equal and a positive
+   * integer otherwise. Default impl to assume the type implements Comparable and invoke .compareTo;
+   * be sure to override this method if your FieldComparator's type isn't a Comparable or if your
+   * values may sometimes be null
+   */
   @SuppressWarnings("unchecked")
   public int compareValues(T first, T second) {
     if (first == null) {
@@ -136,30 +118,27 @@ public abstract class FieldComparator<T> {
   }
 
   /**
-   * Informs the comparator that sort is done on this single field.
-   * This is useful to enable some optimizations for skipping non-competitive documents.
+   * Informs the comparator that sort is done on this single field. This is useful to enable some
+   * optimizations for skipping non-competitive documents.
    */
-  public void setSingleSort() {
-  }
+  public void setSingleSort() {}
 
   /**
-   * Informs the comparator that the skipping of documents should be disabled.
-   * This function is called by TopFieldCollector in cases when the skipping functionality
-   * should not be applied or not necessary. An example could be when
-   * search sort is a part of the index sort, and can be already efficiently
-   * handled by TopFieldCollector, and doing extra work for skipping in the comparator
-   * is redundant.
+   * Informs the comparator that the skipping of documents should be disabled. This function is
+   * called by TopFieldCollector in cases when the skipping functionality should not be applied or
+   * not necessary. An example could be when search sort is a part of the index sort, and can be
+   * already efficiently handled by TopFieldCollector, and doing extra work for skipping in the
+   * comparator is redundant.
    */
-  public void disableSkipping() {
-  }
+  public void disableSkipping() {}
 
-  /** Sorts by descending relevance.  NOTE: if you are
-   *  sorting only by descending relevance and then
-   *  secondarily by ascending docID, performance is faster
-   *  using {@link TopScoreDocCollector} directly (which {@link
-   *  IndexSearcher#search} uses when no {@link Sort} is
-   *  specified). */
-  public static final class RelevanceComparator extends FieldComparator<Float> implements LeafFieldComparator {
+  /**
+   * Sorts by descending relevance. NOTE: if you are sorting only by descending relevance and then
+   * secondarily by ascending docID, performance is faster using {@link TopScoreDocCollector}
+   * directly (which {@link IndexSearcher#search} uses when no {@link Sort} is specified).
+   */
+  public static final class RelevanceComparator extends FieldComparator<Float>
+      implements LeafFieldComparator {
     private final float[] scores;
     private float bottom;
     private Scorable scorer;
@@ -192,7 +171,7 @@ public abstract class FieldComparator<T> {
     public LeafFieldComparator getLeafComparator(LeafReaderContext context) {
       return this;
     }
-    
+
     @Override
     public void setBottom(final int bottom) {
       this.bottom = scores[bottom];
@@ -214,7 +193,7 @@ public abstract class FieldComparator<T> {
         this.scorer = scorer;
       }
     }
-    
+
     @Override
     public Float value(int slot) {
       return Float.valueOf(scores[slot]);
@@ -235,71 +214,72 @@ public abstract class FieldComparator<T> {
       return Float.compare(docValue, topValue);
     }
   }
-  
-  /** Sorts by field's natural Term sort order, using
-   *  ordinals.  This is functionally equivalent to {@link
-   *  org.apache.lucene.search.FieldComparator.TermValComparator}, but it first resolves the string
-   *  to their relative ordinal positions (using the index
-   *  returned by {@link org.apache.lucene.index.LeafReader#getSortedDocValues(String)}), and
-   *  does most comparisons using the ordinals.  For medium
-   *  to large results, this comparator will be much faster
-   *  than {@link org.apache.lucene.search.FieldComparator.TermValComparator}.  For very small
-   *  result sets it may be slower. */
-  public static class TermOrdValComparator extends FieldComparator<BytesRef> implements LeafFieldComparator {
+
+  /**
+   * Sorts by field's natural Term sort order, using ordinals. This is functionally equivalent to
+   * {@link org.apache.lucene.search.FieldComparator.TermValComparator}, but it first resolves the
+   * string to their relative ordinal positions (using the index returned by {@link
+   * org.apache.lucene.index.LeafReader#getSortedDocValues(String)}), and does most comparisons
+   * using the ordinals. For medium to large results, this comparator will be much faster than
+   * {@link org.apache.lucene.search.FieldComparator.TermValComparator}. For very small result sets
+   * it may be slower.
+   */
+  public static class TermOrdValComparator extends FieldComparator<BytesRef>
+      implements LeafFieldComparator {
     /* Ords for each slot.
-       @lucene.internal */
+    @lucene.internal */
     final int[] ords;
 
     /* Values for each slot.
-       @lucene.internal */
+    @lucene.internal */
     final BytesRef[] values;
     private final BytesRefBuilder[] tempBRs;
 
     /* Which reader last copied a value into the slot. When
-       we compare two slots, we just compare-by-ord if the
-       readerGen is the same; else we must compare the
-       values (slower).
-       @lucene.internal */
+    we compare two slots, we just compare-by-ord if the
+    readerGen is the same; else we must compare the
+    values (slower).
+    @lucene.internal */
     final int[] readerGen;
 
     /* Gen of current reader we are on.
-       @lucene.internal */
+    @lucene.internal */
     int currentReaderGen = -1;
 
     /* Current reader's doc ord/values.
-       @lucene.internal */
+    @lucene.internal */
     SortedDocValues termsIndex;
 
     private final String field;
 
     /* Bottom slot, or -1 if queue isn't full yet
-       @lucene.internal */
+    @lucene.internal */
     int bottomSlot = -1;
 
     /* Bottom ord (same as ords[bottomSlot] once bottomSlot
-       is set).  Cached for faster compares.
-       @lucene.internal */
+    is set).  Cached for faster compares.
+    @lucene.internal */
     int bottomOrd;
 
     /* True if current bottom slot matches the current
-       reader.
-       @lucene.internal */
+    reader.
+    @lucene.internal */
     boolean bottomSameReader;
 
     /* Bottom value (same as values[bottomSlot] once
-       bottomSlot is set).  Cached for faster compares.
-      @lucene.internal */
+     bottomSlot is set).  Cached for faster compares.
+    @lucene.internal */
     BytesRef bottomValue;
 
     /** Set by setTopValue. */
     BytesRef topValue;
+
     boolean topSameReader;
     int topOrd;
 
-    /** -1 if missing values are sorted first, 1 if they are
-     *  sorted last */
+    /** -1 if missing values are sorted first, 1 if they are sorted last */
     final int missingSortCmp;
-    
+
     /** Which ordinal to use for a missing value. */
     final int missingOrd;
 
@@ -308,9 +288,10 @@ public abstract class FieldComparator<T> {
       this(numHits, field, false);
     }
 
-    /** Creates this, with control over how missing values
-     *  are sorted.  Pass sortMissingLast=true to put
-     *  missing values at the end. */
+    /**
+     * Creates this, with control over how missing values are sorted. Pass sortMissingLast=true to
+     * put missing values at the end.
+     */
     public TermOrdValComparator(int numHits, String field, boolean sortMissingLast) {
       ords = new int[numHits];
       values = new BytesRef[numHits];
@@ -390,12 +371,13 @@ public abstract class FieldComparator<T> {
       ords[slot] = ord;
       readerGen[slot] = currentReaderGen;
     }
-    
+
     /** Retrieves the SortedDocValues for the field in this segment */
-    protected SortedDocValues getSortedDocValues(LeafReaderContext context, String field) throws IOException {
+    protected SortedDocValues getSortedDocValues(LeafReaderContext context, String field)
+        throws IOException {
       return DocValues.getSorted(context.reader(), field);
     }
-    
+
     @Override
     public LeafFieldComparator getLeafComparator(LeafReaderContext context) throws IOException {
       termsIndex = getSortedDocValues(context, field);
@@ -409,13 +391,14 @@ public abstract class FieldComparator<T> {
           topOrd = ord;
         } else {
           topSameReader = false;
-          topOrd = -ord-2;
+          topOrd = -ord - 2;
         }
       } else {
         topOrd = missingOrd;
         topSameReader = true;
       }
-      //System.out.println("  getLeafComparator topOrd=" + topOrd + " topSameReader=" + topSameReader);
+      // System.out.println("  getLeafComparator topOrd=" + topOrd + " topSameReader=" +
+      // topSameReader);
 
       if (bottomSlot != -1) {
         // Recompute bottomOrd/SameReader
@@ -424,7 +407,7 @@ public abstract class FieldComparator<T> {
 
       return this;
     }
-    
+
     @Override
     public void setBottom(final int bottom) throws IOException {
       bottomSlot = bottom;
@@ -449,7 +432,7 @@ public abstract class FieldComparator<T> {
             bottomOrd = ord;
             // exact value match
             bottomSameReader = true;
-            readerGen[bottomSlot] = currentReaderGen;            
+            readerGen[bottomSlot] = currentReaderGen;
             ords[bottomSlot] = bottomOrd;
           }
         }
@@ -461,7 +444,7 @@ public abstract class FieldComparator<T> {
       // null is fine: it means the last doc of the prior
       // search was missing this value
       topValue = value;
-      //System.out.println("setTopValue " + topValue);
+      // System.out.println("setTopValue " + topValue);
     }
 
     @Override
@@ -480,7 +463,7 @@ public abstract class FieldComparator<T> {
       if (topSameReader) {
         // ord is precisely comparable, even in the equal
         // case
-        //System.out.println("compareTop doc=" + doc + " ord=" + ord + " ret=" + (topOrd-ord));
+        // System.out.println("compareTop doc=" + doc + " ord=" + ord + " ret=" + (topOrd-ord));
         return topOrd - ord;
       } else if (ord <= topOrd) {
         // the equals case always means doc is < value
@@ -507,13 +490,15 @@ public abstract class FieldComparator<T> {
     @Override
     public void setScorer(Scorable scorer) {}
   }
-  
-  /** Sorts by field's natural Term sort order.  All
-   *  comparisons are done using BytesRef.compareTo, which is
-   *  slow for medium to large result sets but possibly
-   *  very fast for very small results sets. */
-  public static class TermValComparator extends FieldComparator<BytesRef> implements LeafFieldComparator {
-    
+
+  /**
+   * Sorts by field's natural Term sort order. All comparisons are done using BytesRef.compareTo,
+   * which is slow for medium to large result sets but possibly very fast for very small results
+   * sets.
+   */
+  public static class TermValComparator extends FieldComparator<BytesRef>
+      implements LeafFieldComparator {
+
     private final BytesRef[] values;
     private final BytesRefBuilder[] tempBRs;
     private BinaryDocValues docTerms;
@@ -566,7 +551,8 @@ public abstract class FieldComparator<T> {
     }
 
     /** Retrieves the BinaryDocValues for the field in this segment */
-    protected BinaryDocValues getBinaryDocValues(LeafReaderContext context, String field) throws IOException {
+    protected BinaryDocValues getBinaryDocValues(LeafReaderContext context, String field)
+        throws IOException {
       return DocValues.getBinary(context.reader(), field);
     }
 
@@ -575,7 +561,7 @@ public abstract class FieldComparator<T> {
       docTerms = getBinaryDocValues(context, field);
       return this;
     }
-    
+
     @Override
     public void setBottom(final int bottom) {
       this.bottom = values[bottom];
diff --git a/lucene/core/src/java/org/apache/lucene/search/FieldComparatorSource.java b/lucene/core/src/java/org/apache/lucene/search/FieldComparatorSource.java
index e7db0ba..1539926 100644
--- a/lucene/core/src/java/org/apache/lucene/search/FieldComparatorSource.java
+++ b/lucene/core/src/java/org/apache/lucene/search/FieldComparatorSource.java
@@ -16,22 +16,19 @@
  */
 package org.apache.lucene.search;
 
-
 /**
  * Provides a {@link FieldComparator} for custom field sorting.
  *
  * @lucene.experimental
- *
  */
 public abstract class FieldComparatorSource {
 
   /**
    * Creates a comparator for the field in the given index.
-   * 
-   * @param fieldname
-   *          Name of the field to create comparator for.
+   *
+   * @param fieldname Name of the field to create comparator for.
    * @return FieldComparator.
    */
-  public abstract FieldComparator<?> newComparator(String fieldname, int numHits, int sortPos, boolean reversed);
-
+  public abstract FieldComparator<?> newComparator(
+      String fieldname, int numHits, int sortPos, boolean reversed);
 }
diff --git a/lucene/core/src/java/org/apache/lucene/search/FieldDoc.java b/lucene/core/src/java/org/apache/lucene/search/FieldDoc.java
index 6125404..111db38 100644
--- a/lucene/core/src/java/org/apache/lucene/search/FieldDoc.java
+++ b/lucene/core/src/java/org/apache/lucene/search/FieldDoc.java
@@ -16,35 +16,30 @@
  */
 package org.apache.lucene.search;
 
-
 import java.util.Arrays;
 
 /**
- * Expert: A ScoreDoc which also contains information about
- * how to sort the referenced document.  In addition to the
- * document number and score, this object contains an array
- * of values for the document from the field(s) used to sort.
- * For example, if the sort criteria was to sort by fields
- * "a", "b" then "c", the <code>fields</code> object array
- * will have three elements, corresponding respectively to
- * the term values for the document in fields "a", "b" and "c".
- * The class of each element in the array will be either
- * Integer, Float or String depending on the type of values
- * in the terms of each field.
+ * Expert: A ScoreDoc which also contains information about how to sort the referenced document. In
+ * addition to the document number and score, this object contains an array of values for the
+ * document from the field(s) used to sort. For example, if the sort criteria was to sort by fields
+ * "a", "b" then "c", the <code>fields</code> object array will have three elements, corresponding
+ * respectively to the term values for the document in fields "a", "b" and "c". The class of each
+ * element in the array will be either Integer, Float or String depending on the type of values in
+ * the terms of each field.
  *
  * <p>Created: Feb 11, 2004 1:23:38 PM
  *
- * @since   lucene 1.4
+ * @since lucene 1.4
  * @see ScoreDoc
  * @see TopFieldDocs
  */
 public class FieldDoc extends ScoreDoc {
 
-  /** Expert: The values which are used to sort the referenced document.
-   * The order of these will match the original sort criteria given by a
-   * Sort object.  Each Object will have been returned from
-   * the <code>value</code> method corresponding
-   * FieldComparator used to sort this field.
+  /**
+   * Expert: The values which are used to sort the referenced document. The order of these will
+   * match the original sort criteria given by a Sort object. Each Object will have been returned
+   * from the <code>value</code> method corresponding FieldComparator used to sort this field.
+   *
    * @see Sort
    * @see IndexSearcher#search(Query,int,Sort)
    */
@@ -60,13 +55,13 @@ public class FieldDoc extends ScoreDoc {
     super(doc, score);
     this.fields = fields;
   }
-  
+
   /** Expert: Creates one of these objects with the given sort information. */
   public FieldDoc(int doc, float score, Object[] fields, int shardIndex) {
     super(doc, score, shardIndex);
     this.fields = fields;
   }
-  
+
   // A convenience method for debugging.
   @Override
   public String toString() {
diff --git a/lucene/core/src/java/org/apache/lucene/search/FieldValueHitQueue.java b/lucene/core/src/java/org/apache/lucene/search/FieldValueHitQueue.java
index a790636..b445403 100644
--- a/lucene/core/src/java/org/apache/lucene/search/FieldValueHitQueue.java
+++ b/lucene/core/src/java/org/apache/lucene/search/FieldValueHitQueue.java
@@ -16,25 +16,21 @@
  */
 package org.apache.lucene.search;
 
-
 import java.io.IOException;
-
 import org.apache.lucene.index.LeafReaderContext;
 import org.apache.lucene.util.PriorityQueue;
 
 /**
  * Expert: A hit queue for sorting by hits by terms in more than one field.
- * 
+ *
  * @lucene.experimental
  * @since 2.9
  * @see IndexSearcher#search(Query,int,Sort)
  */
-public abstract class FieldValueHitQueue<T extends FieldValueHitQueue.Entry> extends PriorityQueue<T> {
+public abstract class FieldValueHitQueue<T extends FieldValueHitQueue.Entry>
+    extends PriorityQueue<T> {
 
-  /**
-   * Extension of ScoreDoc to also store the 
-   * {@link FieldComparator} slot.
-   */
+  /** Extension of ScoreDoc to also store the {@link FieldComparator} slot. */
   public static class Entry extends ScoreDoc {
     public int slot;
 
@@ -42,7 +38,7 @@ public abstract class FieldValueHitQueue<T extends FieldValueHitQueue.Entry> ext
       super(doc, Float.NaN);
       this.slot = slot;
     }
-    
+
     @Override
     public String toString() {
       return "slot:" + slot + " " + super.toString();
@@ -50,14 +46,15 @@ public abstract class FieldValueHitQueue<T extends FieldValueHitQueue.Entry> ext
   }
 
   /**
-   * An implementation of {@link FieldValueHitQueue} which is optimized in case
-   * there is just one comparator.
+   * An implementation of {@link FieldValueHitQueue} which is optimized in case there is just one
+   * comparator.
    */
-  private static final class OneComparatorFieldValueHitQueue<T extends FieldValueHitQueue.Entry> extends FieldValueHitQueue<T> {
-    
+  private static final class OneComparatorFieldValueHitQueue<T extends FieldValueHitQueue.Entry>
+      extends FieldValueHitQueue<T> {
+
     private final int oneReverseMul;
     private final FieldComparator<?> oneComparator;
-    
+
     public OneComparatorFieldValueHitQueue(SortField[] fields, int size) {
       super(fields, size);
 
@@ -68,9 +65,11 @@ public abstract class FieldValueHitQueue<T extends FieldValueHitQueue.Entry> ext
 
     /**
      * Returns whether <code>hitA</code> is less relevant than <code>hitB</code>.
+     *
      * @param hitA Entry
      * @param hitB Entry
-     * @return <code>true</code> if document <code>hitA</code> should be sorted after document <code>hitB</code>.
+     * @return <code>true</code> if document <code>hitA</code> should be sorted after document
+     *     <code>hitB</code>.
      */
     @Override
     protected boolean lessThan(final Entry hitA, final Entry hitB) {
@@ -86,19 +85,19 @@ public abstract class FieldValueHitQueue<T extends FieldValueHitQueue.Entry> ext
       // avoid random sort order that could lead to duplicates (bug #31241):
       return hitA.doc > hitB.doc;
     }
-
   }
-  
+
   /**
-   * An implementation of {@link FieldValueHitQueue} which is optimized in case
-   * there is more than one comparator.
+   * An implementation of {@link FieldValueHitQueue} which is optimized in case there is more than
+   * one comparator.
    */
-  private static final class MultiComparatorsFieldValueHitQueue<T extends FieldValueHitQueue.Entry> extends FieldValueHitQueue<T> {
+  private static final class MultiComparatorsFieldValueHitQueue<T extends FieldValueHitQueue.Entry>
+      extends FieldValueHitQueue<T> {
 
     public MultiComparatorsFieldValueHitQueue(SortField[] fields, int size) {
       super(fields, size);
     }
-  
+
     @Override
     protected boolean lessThan(final Entry hitA, final Entry hitB) {
 
@@ -117,7 +116,6 @@ public abstract class FieldValueHitQueue<T extends FieldValueHitQueue.Entry> ext
       // avoid random sort order that could lead to duplicates (bug #31241):
       return hitA.doc > hitB.doc;
     }
-    
   }
 
   // prevent instantiation and extension.
@@ -125,7 +123,7 @@ public abstract class FieldValueHitQueue<T extends FieldValueHitQueue.Entry> ext
     super(size);
     // When we get here, fields.length is guaranteed to be > 0, therefore no
     // need to check it again.
-    
+
     // All these are required by this class's API - need to return arrays.
     // Therefore even in the case of a single comparator, create an array
     // anyway.
@@ -147,17 +145,16 @@ public abstract class FieldValueHitQueue<T extends FieldValueHitQueue.Entry> ext
 
   /**
    * Creates a hit queue sorted by the given list of fields.
-   * 
-   * <p><b>NOTE</b>: The instances returned by this method
-   * pre-allocate a full array of length <code>numHits</code>.
-   * 
-   * @param fields
-   *          SortField array we are sorting by in priority order (highest
-   *          priority first); cannot be <code>null</code> or empty
-   * @param size
-   *          The number of hits to retain. Must be greater than zero.
+   *
+   * <p><b>NOTE</b>: The instances returned by this method pre-allocate a full array of length
+   * <code>numHits</code>.
+   *
+   * @param fields SortField array we are sorting by in priority order (highest priority first);
+   *     cannot be <code>null</code> or empty
+   * @param size The number of hits to retain. Must be greater than zero.
    */
-  public static <T extends FieldValueHitQueue.Entry> FieldValueHitQueue<T> create(SortField[] fields, int size) {
+  public static <T extends FieldValueHitQueue.Entry> FieldValueHitQueue<T> create(
+      SortField[] fields, int size) {
 
     if (fields.length == 0) {
       throw new IllegalArgumentException("Sort must contain at least one field");
@@ -169,7 +166,7 @@ public abstract class FieldValueHitQueue<T extends FieldValueHitQueue.Entry> ext
       return new MultiComparatorsFieldValueHitQueue<>(fields, size);
     }
   }
-  
+
   public FieldComparator<?>[] getComparators() {
     return comparators;
   }
@@ -188,19 +185,19 @@ public abstract class FieldValueHitQueue<T extends FieldValueHitQueue.Entry> ext
 
   /** Stores the sort criteria being used. */
   protected final SortField[] fields;
+
   protected final FieldComparator<?>[] comparators;
   protected final int[] reverseMul;
 
   @Override
-  protected abstract boolean lessThan (final Entry a, final Entry b);
+  protected abstract boolean lessThan(final Entry a, final Entry b);
 
   /**
-   * Given a queue Entry, creates a corresponding FieldDoc
-   * that contains the values used to sort the given document.
-   * These values are not the raw values out of the index, but the internal
-   * representation of them. This is so the given search hit can be collated by
-   * a MultiSearcher with other search hits.
-   * 
+   * Given a queue Entry, creates a corresponding FieldDoc that contains the values used to sort the
+   * given document. These values are not the raw values out of the index, but the internal
+   * representation of them. This is so the given search hit can be collated by a MultiSearcher with
+   * other search hits.
+   *
    * @param entry The Entry used to create a FieldDoc
    * @return The newly created FieldDoc
    * @see IndexSearcher#search(Query,int,Sort)
@@ -211,7 +208,7 @@ public abstract class FieldValueHitQueue<T extends FieldValueHitQueue.Entry> ext
     for (int i = 0; i < n; ++i) {
       fields[i] = comparators[i].value(entry.slot);
     }
-    //if (maxscore > 1.0f) doc.score /= maxscore;   // normalize scores
+    // if (maxscore > 1.0f) doc.score /= maxscore;   // normalize scores
     return new FieldDoc(entry.doc, entry.score, fields);
   }
 
diff --git a/lucene/core/src/java/org/apache/lucene/search/FilterCollector.java b/lucene/core/src/java/org/apache/lucene/search/FilterCollector.java
index f7ff0ce..9f57a57 100644
--- a/lucene/core/src/java/org/apache/lucene/search/FilterCollector.java
+++ b/lucene/core/src/java/org/apache/lucene/search/FilterCollector.java
@@ -17,10 +17,8 @@
 package org.apache.lucene.search;
 
 import java.io.IOException;
-
 import org.apache.lucene.index.LeafReaderContext;
 
-
 /**
  * {@link Collector} delegator.
  *
diff --git a/lucene/core/src/java/org/apache/lucene/search/FilterLeafCollector.java b/lucene/core/src/java/org/apache/lucene/search/FilterLeafCollector.java
index 5adecb9..2473366 100644
--- a/lucene/core/src/java/org/apache/lucene/search/FilterLeafCollector.java
+++ b/lucene/core/src/java/org/apache/lucene/search/FilterLeafCollector.java
@@ -16,7 +16,6 @@
  */
 package org.apache.lucene.search;
 
-
 import java.io.IOException;
 
 /**
@@ -52,5 +51,4 @@ public abstract class FilterLeafCollector implements LeafCollector {
     }
     return name + "(" + in + ")";
   }
-
 }
diff --git a/lucene/core/src/java/org/apache/lucene/search/FilterMatchesIterator.java b/lucene/core/src/java/org/apache/lucene/search/FilterMatchesIterator.java
index 214cf61..3392fdf 100644
--- a/lucene/core/src/java/org/apache/lucene/search/FilterMatchesIterator.java
+++ b/lucene/core/src/java/org/apache/lucene/search/FilterMatchesIterator.java
@@ -19,18 +19,15 @@ package org.apache.lucene.search;
 
 import java.io.IOException;
 
-/**
- * A MatchesIterator that delegates all calls to another MatchesIterator
- */
+/** A MatchesIterator that delegates all calls to another MatchesIterator */
 public abstract class FilterMatchesIterator implements MatchesIterator {
 
-  /**
-   * The delegate
-   */
+  /** The delegate */
   protected final MatchesIterator in;
 
   /**
    * Create a new FilterMatchesIterator
+   *
    * @param in the delegate
    */
   protected FilterMatchesIterator(MatchesIterator in) {
diff --git a/lucene/core/src/java/org/apache/lucene/search/FilterScorable.java b/lucene/core/src/java/org/apache/lucene/search/FilterScorable.java
index c2e68c1..d9e0e29 100644
--- a/lucene/core/src/java/org/apache/lucene/search/FilterScorable.java
+++ b/lucene/core/src/java/org/apache/lucene/search/FilterScorable.java
@@ -22,12 +22,10 @@ import java.util.Collection;
 import java.util.Collections;
 
 /**
- * Filter a {@link Scorable}, intercepting methods and optionally changing
- * their return values
+ * Filter a {@link Scorable}, intercepting methods and optionally changing their return values
  *
- * The default implementation simply passes all calls to its delegate, with
- * the exception of {@link #setMinCompetitiveScore(float)} which defaults
- * to a no-op.
+ * <p>The default implementation simply passes all calls to its delegate, with the exception of
+ * {@link #setMinCompetitiveScore(float)} which defaults to a no-op.
  */
 public class FilterScorable extends Scorable {
 
@@ -35,7 +33,8 @@ public class FilterScorable extends Scorable {
 
   /**
    * Filter a scorer
-   * @param in  the scorer to filter
+   *
+   * @param in the scorer to filter
    */
   public FilterScorable(Scorable in) {
     this.in = in;
diff --git a/lucene/core/src/java/org/apache/lucene/search/FilterScorer.java b/lucene/core/src/java/org/apache/lucene/search/FilterScorer.java
index 7bcb1ce..5d27cc9 100644
--- a/lucene/core/src/java/org/apache/lucene/search/FilterScorer.java
+++ b/lucene/core/src/java/org/apache/lucene/search/FilterScorer.java
@@ -16,24 +16,21 @@
  */
 package org.apache.lucene.search;
 
-
 import java.io.IOException;
 
-/** 
- * A {@code FilterScorer} contains another {@code Scorer}, which it
- * uses as its basic source of data, possibly transforming the data along the
- * way or providing additional functionality. The class
- * {@code FilterScorer} itself simply implements all abstract methods
- * of {@code Scorer} with versions that pass all requests to the
- * contained scorer. Subclasses of {@code FilterScorer} may
- * further override some of these methods and may also provide additional
- * methods and fields.
+/**
+ * A {@code FilterScorer} contains another {@code Scorer}, which it uses as its basic source of
+ * data, possibly transforming the data along the way or providing additional functionality. The
+ * class {@code FilterScorer} itself simply implements all abstract methods of {@code Scorer} with
+ * versions that pass all requests to the contained scorer. Subclasses of {@code FilterScorer} may
+ * further override some of these methods and may also provide additional methods and fields.
  */
 public abstract class FilterScorer extends Scorer {
   protected final Scorer in;
 
   /**
    * Create a new FilterScorer
+   *
    * @param in the {@link Scorer} to wrap
    */
   public FilterScorer(Scorer in) {
@@ -43,6 +40,7 @@ public abstract class FilterScorer extends Scorer {
 
   /**
    * Create a new FilterScorer with a specific weight
+   *
    * @param in the {@link Scorer} to wrap
    * @param weight a {@link Weight}
    */
@@ -53,7 +51,7 @@ public abstract class FilterScorer extends Scorer {
     }
     this.in = in;
   }
-  
+
   @Override
   public float score() throws IOException {
     return in.score();
@@ -71,7 +69,7 @@ public abstract class FilterScorer extends Scorer {
   public final DocIdSetIterator iterator() {
     return in.iterator();
   }
-  
+
   @Override
   public final TwoPhaseIterator twoPhaseIterator() {
     return in.twoPhaseIterator();
diff --git a/lucene/core/src/java/org/apache/lucene/search/FilterWeight.java b/lucene/core/src/java/org/apache/lucene/search/FilterWeight.java
index 5292e78..e9f2bbe 100644
--- a/lucene/core/src/java/org/apache/lucene/search/FilterWeight.java
+++ b/lucene/core/src/java/org/apache/lucene/search/FilterWeight.java
@@ -17,36 +17,31 @@
 package org.apache.lucene.search;
 
 import java.io.IOException;
-
 import org.apache.lucene.index.LeafReaderContext;
 
 /**
- * A {@code FilterWeight} contains another {@code Weight} and implements
- * all abstract methods by calling the contained weight's method.
+ * A {@code FilterWeight} contains another {@code Weight} and implements all abstract methods by
+ * calling the contained weight's method.
  *
- * Note that {@code FilterWeight} does not override the non-abstract
- * {@link Weight#bulkScorer(LeafReaderContext)} method and subclasses of
- * {@code FilterWeight} must provide their bulkScorer implementation
- * if required.
+ * <p>Note that {@code FilterWeight} does not override the non-abstract {@link
+ * Weight#bulkScorer(LeafReaderContext)} method and subclasses of {@code FilterWeight} must provide
+ * their bulkScorer implementation if required.
  *
  * @lucene.internal
  */
 public abstract class FilterWeight extends Weight {
 
-  final protected Weight in;
+  protected final Weight in;
 
-  /**
-   * Default constructor.
-   */
+  /** Default constructor. */
   protected FilterWeight(Weight weight) {
     this(weight.getQuery(), weight);
   }
 
   /**
-   * Alternative constructor.
-   * Use this variant only if the <code>weight</code> was not obtained
-   * via the {@link Query#createWeight(IndexSearcher, ScoreMode, float)}
-   * method of the <code>query</code> object.
+   * Alternative constructor. Use this variant only if the <code>weight</code> was not obtained via
+   * the {@link Query#createWeight(IndexSearcher, ScoreMode, float)} method of the <code>query
+   * </code> object.
    */
   protected FilterWeight(Query query, Weight weight) {
     super(query);
diff --git a/lucene/core/src/java/org/apache/lucene/search/FilteredDocIdSetIterator.java b/lucene/core/src/java/org/apache/lucene/search/FilteredDocIdSetIterator.java
index bd88a08..723b0a2 100644
--- a/lucene/core/src/java/org/apache/lucene/search/FilteredDocIdSetIterator.java
+++ b/lucene/core/src/java/org/apache/lucene/search/FilteredDocIdSetIterator.java
@@ -16,13 +16,11 @@
  */
 package org.apache.lucene.search;
 
-
 import java.io.IOException;
 
 /**
- * Abstract decorator class of a DocIdSetIterator
- * implementation that provides on-demand filter/validation
- * mechanism on an underlying DocIdSetIterator.
+ * Abstract decorator class of a DocIdSetIterator implementation that provides on-demand
+ * filter/validation mechanism on an underlying DocIdSetIterator.
  */
 public abstract class FilteredDocIdSetIterator extends DocIdSetIterator {
   protected DocIdSetIterator _innerIter;
@@ -30,6 +28,7 @@ public abstract class FilteredDocIdSetIterator extends DocIdSetIterator {
 
   /**
    * Constructor.
+   *
    * @param innerIter Underlying DocIdSetIterator.
    */
   public FilteredDocIdSetIterator(DocIdSetIterator innerIter) {
@@ -47,6 +46,7 @@ public abstract class FilteredDocIdSetIterator extends DocIdSetIterator {
 
   /**
    * Validation method to determine whether a docid should be in the result set.
+   *
    * @param doc docid to be tested
    * @return true if input docid should be in the result set, false otherwise.
    * @see #FilteredDocIdSetIterator(DocIdSetIterator)
@@ -57,7 +57,7 @@ public abstract class FilteredDocIdSetIterator extends DocIdSetIterator {
   public int docID() {
     return doc;
   }
-  
+
   @Override
   public int nextDoc() throws IOException {
     while ((doc = _innerIter.nextDoc()) != NO_MORE_DOCS) {
@@ -67,7 +67,7 @@ public abstract class FilteredDocIdSetIterator extends DocIdSetIterator {
     }
     return doc;
   }
-  
+
   @Override
   public int advance(int target) throws IOException {
     doc = _innerIter.advance(target);
diff --git a/lucene/core/src/java/org/apache/lucene/search/FuzzyAutomatonBuilder.java b/lucene/core/src/java/org/apache/lucene/search/FuzzyAutomatonBuilder.java
index 42e4b07..1fedbf7 100644
--- a/lucene/core/src/java/org/apache/lucene/search/FuzzyAutomatonBuilder.java
+++ b/lucene/core/src/java/org/apache/lucene/search/FuzzyAutomatonBuilder.java
@@ -23,9 +23,8 @@ import org.apache.lucene.util.automaton.LevenshteinAutomata;
 import org.apache.lucene.util.automaton.TooComplexToDeterminizeException;
 
 /**
- * Builds a set of CompiledAutomaton for fuzzy matching on a given term,
- * with specified maximum edit distance, fixed prefix and whether or not
- * to allow transpositions.
+ * Builds a set of CompiledAutomaton for fuzzy matching on a given term, with specified maximum edit
+ * distance, fixed prefix and whether or not to allow transpositions.
  */
 class FuzzyAutomatonBuilder {
 
@@ -37,7 +36,11 @@ class FuzzyAutomatonBuilder {
 
   FuzzyAutomatonBuilder(String term, int maxEdits, int prefixLength, boolean transpositions) {
     if (maxEdits < 0 || maxEdits > LevenshteinAutomata.MAXIMUM_SUPPORTED_DISTANCE) {
-      throw new IllegalArgumentException("max edits must be 0.." + LevenshteinAutomata.MAXIMUM_SUPPORTED_DISTANCE + ", inclusive; got: " + maxEdits);
+      throw new IllegalArgumentException(
+          "max edits must be 0.."
+              + LevenshteinAutomata.MAXIMUM_SUPPORTED_DISTANCE
+              + ", inclusive; got: "
+              + maxEdits);
     }
     if (prefixLength < 0) {
       throw new IllegalArgumentException("prefixLength cannot be less than 0");
@@ -58,8 +61,7 @@ class FuzzyAutomatonBuilder {
     for (int i = 0; i <= maxEdits; i++) {
       try {
         compiled[i] = new CompiledAutomaton(levBuilder.toAutomaton(i, prefix), true, false);
-      }
-      catch (TooComplexToDeterminizeException e) {
+      } catch (TooComplexToDeterminizeException e) {
         throw new FuzzyTermsEnum.FuzzyTermsException(term, e);
       }
     }
diff --git a/lucene/core/src/java/org/apache/lucene/search/FuzzyQuery.java b/lucene/core/src/java/org/apache/lucene/search/FuzzyQuery.java
index e1359ab..f0e9e28 100644
--- a/lucene/core/src/java/org/apache/lucene/search/FuzzyQuery.java
+++ b/lucene/core/src/java/org/apache/lucene/search/FuzzyQuery.java
@@ -16,10 +16,8 @@
  */
 package org.apache.lucene.search;
 
-
 import java.io.IOException;
 import java.util.Objects;
-
 import org.apache.lucene.index.SingleTermsEnum;
 import org.apache.lucene.index.Term;
 import org.apache.lucene.index.Terms;
@@ -28,64 +26,64 @@ import org.apache.lucene.util.AttributeSource;
 import org.apache.lucene.util.automaton.CompiledAutomaton;
 import org.apache.lucene.util.automaton.LevenshteinAutomata;
 
-/** Implements the fuzzy search query. The similarity measurement
- * is based on the Damerau-Levenshtein (optimal string alignment) algorithm,
- * though you can explicitly choose classic Levenshtein by passing <code>false</code>
- * to the <code>transpositions</code> parameter.
- * 
- * <p>This query uses {@link MultiTermQuery.TopTermsBlendedFreqScoringRewrite}
- * as default. So terms will be collected and scored according to their
- * edit distance. Only the top terms are used for building the {@link BooleanQuery}.
- * It is not recommended to change the rewrite mode for fuzzy queries.
- * 
- * <p>At most, this query will match terms up to 
- * {@value org.apache.lucene.util.automaton.LevenshteinAutomata#MAXIMUM_SUPPORTED_DISTANCE} edits. 
- * Higher distances (especially with transpositions enabled), are generally not useful and 
- * will match a significant amount of the term dictionary. If you really want this, consider
- * using an n-gram indexing technique (such as the SpellChecker in the 
- * <a href="{@docRoot}/../suggest/overview-summary.html">suggest module</a>) instead.
+/**
+ * Implements the fuzzy search query. The similarity measurement is based on the Damerau-Levenshtein
+ * (optimal string alignment) algorithm, though you can explicitly choose classic Levenshtein by
+ * passing <code>false</code> to the <code>transpositions</code> parameter.
+ *
+ * <p>This query uses {@link MultiTermQuery.TopTermsBlendedFreqScoringRewrite} as default. So terms
+ * will be collected and scored according to their edit distance. Only the top terms are used for
+ * building the {@link BooleanQuery}. It is not recommended to change the rewrite mode for fuzzy
+ * queries.
+ *
+ * <p>At most, this query will match terms up to {@value
+ * org.apache.lucene.util.automaton.LevenshteinAutomata#MAXIMUM_SUPPORTED_DISTANCE} edits. Higher
+ * distances (especially with transpositions enabled), are generally not useful and will match a
+ * significant amount of the term dictionary. If you really want this, consider using an n-gram
+ * indexing technique (such as the SpellChecker in the <a
+ * href="{@docRoot}/../suggest/overview-summary.html">suggest module</a>) instead.
  *
- * <p>NOTE: terms of length 1 or 2 will sometimes not match because of how the scaled
- * distance between two terms is computed.  For a term to match, the edit distance between
- * the terms must be less than the minimum length term (either the input term, or
- * the candidate term).  For example, FuzzyQuery on term "abcd" with maxEdits=2 will
- * not match an indexed term "ab", and FuzzyQuery on term "a" with maxEdits=2 will not
- * match an indexed term "abc".
+ * <p>NOTE: terms of length 1 or 2 will sometimes not match because of how the scaled distance
+ * between two terms is computed. For a term to match, the edit distance between the terms must be
+ * less than the minimum length term (either the input term, or the candidate term). For example,
+ * FuzzyQuery on term "abcd" with maxEdits=2 will not match an indexed term "ab", and FuzzyQuery on
+ * term "a" with maxEdits=2 will not match an indexed term "abc".
  */
 public class FuzzyQuery extends MultiTermQuery {
-  
-  public final static int defaultMaxEdits = LevenshteinAutomata.MAXIMUM_SUPPORTED_DISTANCE;
-  public final static int defaultPrefixLength = 0;
-  public final static int defaultMaxExpansions = 50;
-  public final static boolean defaultTranspositions = true;
-  
+
+  public static final int defaultMaxEdits = LevenshteinAutomata.MAXIMUM_SUPPORTED_DISTANCE;
+  public static final int defaultPrefixLength = 0;
+  public static final int defaultMaxExpansions = 50;
+  public static final boolean defaultTranspositions = true;
+
   private final int maxEdits;
   private final int maxExpansions;
   private final boolean transpositions;
   private final int prefixLength;
   private final Term term;
-  
+
   /**
-   * Create a new FuzzyQuery that will match terms with an edit distance 
-   * of at most <code>maxEdits</code> to <code>term</code>.
-   * If a <code>prefixLength</code> &gt; 0 is specified, a common prefix
-   * of that length is also required.
-   * 
+   * Create a new FuzzyQuery that will match terms with an edit distance of at most <code>maxEdits
+   * </code> to <code>term</code>. If a <code>prefixLength</code> &gt; 0 is specified, a common
+   * prefix of that length is also required.
+   *
    * @param term the term to search for
-   * @param maxEdits must be {@code >= 0} and {@code <=} {@link LevenshteinAutomata#MAXIMUM_SUPPORTED_DISTANCE}.
+   * @param maxEdits must be {@code >= 0} and {@code <=} {@link
+   *     LevenshteinAutomata#MAXIMUM_SUPPORTED_DISTANCE}.
    * @param prefixLength length of common (non-fuzzy) prefix
-   * @param maxExpansions the maximum number of terms to match. If this number is
-   *  greater than {@link IndexSearcher#getMaxClauseCount} when the query is rewritten,
-   *  then the maxClauseCount will be used instead.
-   * @param transpositions true if transpositions should be treated as a primitive
-   *        edit operation. If this is false, comparisons will implement the classic
-   *        Levenshtein algorithm.
+   * @param maxExpansions the maximum number of terms to match. If this number is greater than
+   *     {@link IndexSearcher#getMaxClauseCount} when the query is rewritten, then the
+   *     maxClauseCount will be used instead.
+   * @param transpositions true if transpositions should be treated as a primitive edit operation.
+   *     If this is false, comparisons will implement the classic Levenshtein algorithm.
    */
-  public FuzzyQuery(Term term, int maxEdits, int prefixLength, int maxExpansions, boolean transpositions) {
+  public FuzzyQuery(
+      Term term, int maxEdits, int prefixLength, int maxExpansions, boolean transpositions) {
     super(term.field());
-    
+
     if (maxEdits < 0 || maxEdits > LevenshteinAutomata.MAXIMUM_SUPPORTED_DISTANCE) {
-      throw new IllegalArgumentException("maxEdits must be between 0 and " + LevenshteinAutomata.MAXIMUM_SUPPORTED_DISTANCE);
+      throw new IllegalArgumentException(
+          "maxEdits must be between 0 and " + LevenshteinAutomata.MAXIMUM_SUPPORTED_DISTANCE);
     }
     if (prefixLength < 0) {
       throw new IllegalArgumentException("prefixLength cannot be negative.");
@@ -93,7 +91,7 @@ public class FuzzyQuery extends MultiTermQuery {
     if (maxExpansions <= 0) {
       throw new IllegalArgumentException("maxExpansions must be positive.");
     }
-    
+
     this.term = term;
     this.maxEdits = maxEdits;
     this.prefixLength = prefixLength;
@@ -101,58 +99,50 @@ public class FuzzyQuery extends MultiTermQuery {
     this.maxExpansions = maxExpansions;
     setRewriteMethod(new MultiTermQuery.TopTermsBlendedFreqScoringRewrite(maxExpansions));
   }
-  
+
   /**
-   * Calls {@link #FuzzyQuery(Term, int, int, int, boolean) 
-   * FuzzyQuery(term, maxEdits, prefixLength, defaultMaxExpansions, defaultTranspositions)}.
+   * Calls {@link #FuzzyQuery(Term, int, int, int, boolean) FuzzyQuery(term, maxEdits, prefixLength,
+   * defaultMaxExpansions, defaultTranspositions)}.
    */
   public FuzzyQuery(Term term, int maxEdits, int prefixLength) {
     this(term, maxEdits, prefixLength, defaultMaxExpansions, defaultTranspositions);
   }
-  
-  /**
-   * Calls {@link #FuzzyQuery(Term, int, int) FuzzyQuery(term, maxEdits, defaultPrefixLength)}.
-   */
+
+  /** Calls {@link #FuzzyQuery(Term, int, int) FuzzyQuery(term, maxEdits, defaultPrefixLength)}. */
   public FuzzyQuery(Term term, int maxEdits) {
     this(term, maxEdits, defaultPrefixLength);
   }
 
-  /**
-   * Calls {@link #FuzzyQuery(Term, int) FuzzyQuery(term, defaultMaxEdits)}.
-   */
+  /** Calls {@link #FuzzyQuery(Term, int) FuzzyQuery(term, defaultMaxEdits)}. */
   public FuzzyQuery(Term term) {
     this(term, defaultMaxEdits);
   }
-  
-  /**
-   * @return the maximum number of edit distances allowed for this query to match.
-   */
+
+  /** @return the maximum number of edit distances allowed for this query to match. */
   public int getMaxEdits() {
     return maxEdits;
   }
-    
+
   /**
-   * Returns the non-fuzzy prefix length. This is the number of characters at the start
-   * of a term that must be identical (not fuzzy) to the query term if the query
-   * is to match that term. 
+   * Returns the non-fuzzy prefix length. This is the number of characters at the start of a term
+   * that must be identical (not fuzzy) to the query term if the query is to match that term.
    */
   public int getPrefixLength() {
     return prefixLength;
   }
-  
+
   /**
-   * Returns true if transpositions should be treated as a primitive edit operation. 
-   * If this is false, comparisons will implement the classic Levenshtein algorithm.
+   * Returns true if transpositions should be treated as a primitive edit operation. If this is
+   * false, comparisons will implement the classic Levenshtein algorithm.
    */
   public boolean getTranspositions() {
     return transpositions;
   }
 
-  /**
-   * Returns the compiled automata used to match terms
-   */
+  /** Returns the compiled automata used to match terms */
   public CompiledAutomaton getAutomata() {
-    FuzzyAutomatonBuilder builder = new FuzzyAutomatonBuilder(term.text(), maxEdits, prefixLength, transpositions);
+    FuzzyAutomatonBuilder builder =
+        new FuzzyAutomatonBuilder(term.text(), maxEdits, prefixLength, transpositions);
     return builder.buildMaxEditAutomaton();
   }
 
@@ -171,19 +161,17 @@ public class FuzzyQuery extends MultiTermQuery {
     return new FuzzyTermsEnum(terms, atts, getTerm(), maxEdits, prefixLength, transpositions);
   }
 
-  /**
-   * Returns the pattern term.
-   */
+  /** Returns the pattern term. */
   public Term getTerm() {
     return term;
   }
-    
+
   @Override
   public String toString(String field) {
     final StringBuilder buffer = new StringBuilder();
     if (!term.field().equals(field)) {
-        buffer.append(term.field());
-        buffer.append(":");
+      buffer.append(term.field());
+      buffer.append(":");
     }
     buffer.append(term.text());
     buffer.append('~');
@@ -205,22 +193,20 @@ public class FuzzyQuery extends MultiTermQuery {
 
   @Override
   public boolean equals(Object obj) {
-    if (this == obj)
-      return true;
-    if (!super.equals(obj))
-      return false;
-    if (getClass() != obj.getClass())
-      return false;
+    if (this == obj) return true;
+    if (!super.equals(obj)) return false;
+    if (getClass() != obj.getClass()) return false;
     FuzzyQuery other = (FuzzyQuery) obj;
-    return Objects.equals(maxEdits, other.maxEdits) && Objects.equals(prefixLength, other.prefixLength)
-        && Objects.equals(maxExpansions, other.maxExpansions) && Objects.equals(transpositions, other.transpositions)
+    return Objects.equals(maxEdits, other.maxEdits)
+        && Objects.equals(prefixLength, other.prefixLength)
+        && Objects.equals(maxExpansions, other.maxExpansions)
+        && Objects.equals(transpositions, other.transpositions)
         && Objects.equals(term, other.term);
   }
 
   /**
-   * Helper function to convert from "minimumSimilarity" fractions
-   * to raw edit distances.
-   * 
+   * Helper function to convert from "minimumSimilarity" fractions to raw edit distances.
+   *
    * @param minimumSimilarity scaled similarity
    * @param termLen length (in unicode codepoints) of the term.
    * @return equivalent number of maxEdits
@@ -231,9 +217,9 @@ public class FuzzyQuery extends MultiTermQuery {
     } else if (minimumSimilarity == 0.0f) {
       return 0; // 0 means exact, not infinite # of edits!
     } else {
-      return Math.min((int) ((1D-minimumSimilarity) * termLen), 
-        LevenshteinAutomata.MAXIMUM_SUPPORTED_DISTANCE);
+      return Math.min(
+          (int) ((1D - minimumSimilarity) * termLen),
+          LevenshteinAutomata.MAXIMUM_SUPPORTED_DISTANCE);
     }
   }
-
 }
diff --git a/lucene/core/src/java/org/apache/lucene/search/FuzzyTermsEnum.java b/lucene/core/src/java/org/apache/lucene/search/FuzzyTermsEnum.java
index 4c49d8a..cfd6ed2 100644
--- a/lucene/core/src/java/org/apache/lucene/search/FuzzyTermsEnum.java
+++ b/lucene/core/src/java/org/apache/lucene/search/FuzzyTermsEnum.java
@@ -16,10 +16,8 @@
  */
 package org.apache.lucene.search;
 
-
 import java.io.IOException;
 import java.util.function.Supplier;
-
 import org.apache.lucene.index.ImpactsEnum;
 import org.apache.lucene.index.PostingsEnum;
 import org.apache.lucene.index.Term;
@@ -35,12 +33,11 @@ import org.apache.lucene.util.BytesRefBuilder;
 import org.apache.lucene.util.UnicodeUtil;
 import org.apache.lucene.util.automaton.CompiledAutomaton;
 
-/** Subclass of TermsEnum for enumerating all terms that are similar
- * to the specified filter term.
+/**
+ * Subclass of TermsEnum for enumerating all terms that are similar to the specified filter term.
  *
- * <p>Term enumerations are always ordered by
- * {@link BytesRef#compareTo}.  Each term in the enumeration is
- * greater than all that precede it.</p>
+ * <p>Term enumerations are always ordered by {@link BytesRef#compareTo}. Each term in the
+ * enumeration is greater than all that precede it.
  */
 public final class FuzzyTermsEnum extends TermsEnum {
 
@@ -48,38 +45,42 @@ public final class FuzzyTermsEnum extends TermsEnum {
   private TermsEnum actualEnum;
 
   private final AttributeSource atts;
-  
+
   // We use this to communicate the score (boost) of the current matched term we are on back to
-  // MultiTermQuery.TopTermsBlendedFreqScoringRewrite that is collecting the best (default 50) matched terms:
+  // MultiTermQuery.TopTermsBlendedFreqScoringRewrite that is collecting the best (default 50)
+  // matched terms:
   private final BoostAttribute boostAtt;
 
-  // MultiTermQuery.TopTermsBlendedFreqScoringRewrite tells us the worst boost still in its queue using this att,
-  // which we use to know when we can reduce the automaton from ed=2 to ed=1, or ed=0 if only single top term is collected:
+  // MultiTermQuery.TopTermsBlendedFreqScoringRewrite tells us the worst boost still in its queue
+  // using this att,
+  // which we use to know when we can reduce the automaton from ed=2 to ed=1, or ed=0 if only single
+  // top term is collected:
   private final MaxNonCompetitiveBoostAttribute maxBoostAtt;
 
   private final CompiledAutomaton[] automata;
   private final Terms terms;
   private final int termLength;
   private final Term term;
-  
+
   private float bottom;
   private BytesRef bottomTerm;
 
   private BytesRef queuedBottom;
 
-
-  // Maximum number of edits we will accept.  This is either 2 or 1 (or, degenerately, 0) passed by the user originally,
-  // but as we collect terms, we can lower this (e.g. from 2 to 1) if we detect that the term queue is full, and all
+  // Maximum number of edits we will accept.  This is either 2 or 1 (or, degenerately, 0) passed by
+  // the user originally,
+  // but as we collect terms, we can lower this (e.g. from 2 to 1) if we detect that the term queue
+  // is full, and all
   // collected terms are ed=1:
   private int maxEdits;
 
-
   /**
-   * Constructor for enumeration of all terms from specified <code>reader</code> which share a prefix of
-   * length <code>prefixLength</code> with <code>term</code> and which have at most {@code maxEdits} edits.
-   * <p>
-   * After calling the constructor the enumeration is already pointing to the first
-   * valid term if such a term exists.
+   * Constructor for enumeration of all terms from specified <code>reader</code> which share a
+   * prefix of length <code>prefixLength</code> with <code>term</code> and which have at most {@code
+   * maxEdits} edits.
+   *
+   * <p>After calling the constructor the enumeration is already pointing to the first valid term if
+   * such a term exists.
    *
    * @param terms Delivers terms.
    * @param term Pattern term.
@@ -88,16 +89,23 @@ public final class FuzzyTermsEnum extends TermsEnum {
    * @param transpositions whether transpositions should count as a single edit
    * @throws IOException if there is a low-level IO error
    */
-  public FuzzyTermsEnum(Terms terms, Term term, int maxEdits, int prefixLength, boolean transpositions) throws IOException {
-    this(terms, new AttributeSource(), term, () -> new FuzzyAutomatonBuilder(term.text(), maxEdits, prefixLength, transpositions));
+  public FuzzyTermsEnum(
+      Terms terms, Term term, int maxEdits, int prefixLength, boolean transpositions)
+      throws IOException {
+    this(
+        terms,
+        new AttributeSource(),
+        term,
+        () -> new FuzzyAutomatonBuilder(term.text(), maxEdits, prefixLength, transpositions));
   }
 
   /**
-   * Constructor for enumeration of all terms from specified <code>reader</code> which share a prefix of
-   * length <code>prefixLength</code> with <code>term</code> and which have at most {@code maxEdits} edits.
-   * <p>
-   * After calling the constructor the enumeration is already pointing to the first
-   * valid term if such a term exists.
+   * Constructor for enumeration of all terms from specified <code>reader</code> which share a
+   * prefix of length <code>prefixLength</code> with <code>term</code> and which have at most {@code
+   * maxEdits} edits.
+   *
+   * <p>After calling the constructor the enumeration is already pointing to the first valid term if
+   * such a term exists.
    *
    * @param terms Delivers terms.
    * @param atts An AttributeSource used to share automata between segments
@@ -107,11 +115,27 @@ public final class FuzzyTermsEnum extends TermsEnum {
    * @param transpositions whether transpositions should count as a single edit
    * @throws IOException if there is a low-level IO error
    */
-  FuzzyTermsEnum(Terms terms, AttributeSource atts, Term term, int maxEdits, int prefixLength, boolean transpositions) throws IOException {
-    this(terms, atts, term, () -> new FuzzyAutomatonBuilder(term.text(), maxEdits, prefixLength, transpositions));
+  FuzzyTermsEnum(
+      Terms terms,
+      AttributeSource atts,
+      Term term,
+      int maxEdits,
+      int prefixLength,
+      boolean transpositions)
+      throws IOException {
+    this(
+        terms,
+        atts,
+        term,
+        () -> new FuzzyAutomatonBuilder(term.text(), maxEdits, prefixLength, transpositions));
   }
 
-  private FuzzyTermsEnum(Terms terms, AttributeSource atts, Term term, Supplier<FuzzyAutomatonBuilder> automatonBuilder) throws IOException {
+  private FuzzyTermsEnum(
+      Terms terms,
+      AttributeSource atts,
+      Term term,
+      Supplier<FuzzyAutomatonBuilder> automatonBuilder)
+      throws IOException {
 
     this.terms = terms;
     this.atts = atts;
@@ -134,24 +158,19 @@ public final class FuzzyTermsEnum extends TermsEnum {
   }
 
   /**
-   * Sets the maximum non-competitive boost, which may allow switching to a
-   * lower max-edit automaton at run time
+   * Sets the maximum non-competitive boost, which may allow switching to a lower max-edit automaton
+   * at run time
    */
   public void setMaxNonCompetitiveBoost(float boost) {
     this.maxBoostAtt.setMaxNonCompetitiveBoost(boost);
   }
 
-  /**
-   * Gets the boost of the current term
-   */
+  /** Gets the boost of the current term */
   public float getBoost() {
     return boostAtt.getBoost();
   }
-  
-  /**
-   * return an automata-based enum for matching up to editDistance from
-   * lastTerm, if possible
-   */
+
+  /** return an automata-based enum for matching up to editDistance from lastTerm, if possible */
   private TermsEnum getAutomatonEnum(int editDistance, BytesRef lastTerm) throws IOException {
     assert editDistance < automata.length;
     final CompiledAutomaton compiled = automata[editDistance];
@@ -167,14 +186,16 @@ public final class FuzzyTermsEnum extends TermsEnum {
   }
 
   /**
-   * fired when the max non-competitive boost has changed. this is the hook to
-   * swap in a smarter actualEnum.
+   * fired when the max non-competitive boost has changed. this is the hook to swap in a smarter
+   * actualEnum.
    */
   private void bottomChanged(BytesRef lastTerm) throws IOException {
     int oldMaxEdits = maxEdits;
-    
-    // true if the last term encountered is lexicographically equal or after the bottom term in the PQ
-    boolean termAfter = bottomTerm == null || (lastTerm != null && lastTerm.compareTo(bottomTerm) >= 0);
+
+    // true if the last term encountered is lexicographically equal or after the bottom term in the
+    // PQ
+    boolean termAfter =
+        bottomTerm == null || (lastTerm != null && lastTerm.compareTo(bottomTerm) >= 0);
 
     // as long as the max non-competitive boost is >= the max boost
     // for some edit distance, keep dropping the max edit distance.
@@ -187,13 +208,15 @@ public final class FuzzyTermsEnum extends TermsEnum {
     }
 
     if (oldMaxEdits != maxEdits || lastTerm == null) {
-      // This is a very powerful optimization: the maximum edit distance has changed.  This happens because we collect only the top scoring
-      // N (= 50, by default) terms, and if e.g. maxEdits=2, and the queue is now full of matching terms, and we notice that the worst entry
+      // This is a very powerful optimization: the maximum edit distance has changed.  This happens
+      // because we collect only the top scoring
+      // N (= 50, by default) terms, and if e.g. maxEdits=2, and the queue is now full of matching
+      // terms, and we notice that the worst entry
       // in that queue is ed=1, then we can switch the automata here to ed=1 which is a big speedup.
       actualEnum = getAutomatonEnum(maxEdits, lastTerm);
     }
   }
-  
+
   @Override
   public BytesRef next() throws IOException {
 
@@ -201,7 +224,6 @@ public final class FuzzyTermsEnum extends TermsEnum {
       bottomChanged(queuedBottom);
       queuedBottom = null;
     }
-    
 
     BytesRef term;
 
@@ -212,7 +234,7 @@ public final class FuzzyTermsEnum extends TermsEnum {
     }
 
     int ed = maxEdits;
-      
+
     // we know the outer DFA always matches.
     // now compute exact edit distance
     while (ed > 0) {
@@ -222,7 +244,7 @@ public final class FuzzyTermsEnum extends TermsEnum {
         break;
       }
     }
-      
+
     if (ed == 0) { // exact match
       boostAtt.setBoost(1.0F);
     } else {
@@ -232,7 +254,7 @@ public final class FuzzyTermsEnum extends TermsEnum {
       float similarity = 1.0f - (float) ed / (float) minTermLength;
       boostAtt.setBoost(similarity);
     }
-      
+
     final float bottom = maxBoostAtt.getMaxNonCompetitiveBoost();
     final BytesRef bottomTerm = maxBoostAtt.getCompetitiveTerm();
     if (bottom != this.bottom || bottomTerm != this.bottomTerm) {
@@ -241,18 +263,21 @@ public final class FuzzyTermsEnum extends TermsEnum {
       // clone the term before potentially doing something with it
       // this is a rare but wonderful occurrence anyway
 
-      // We must delay bottomChanged until the next next() call otherwise we mess up docFreq(), etc., for the current term:
+      // We must delay bottomChanged until the next next() call otherwise we mess up docFreq(),
+      // etc., for the current term:
       queuedBottom = BytesRef.deepCopyOf(term);
     }
-    
+
     return term;
   }
 
   /** returns true if term is within k edits of the query term */
   private boolean matches(BytesRef termIn, int k) {
-    return k == 0 ? termIn.equals(term.bytes()) : automata[k].runAutomaton.run(termIn.bytes, termIn.offset, termIn.length);
+    return k == 0
+        ? termIn.equals(term.bytes())
+        : automata[k].runAutomaton.run(termIn.bytes, termIn.offset, termIn.length);
   }
-  
+
   // proxy all other enum calls to the actual enum
   @Override
   public int docFreq() throws IOException {
@@ -263,27 +288,27 @@ public final class FuzzyTermsEnum extends TermsEnum {
   public long totalTermFreq() throws IOException {
     return actualEnum.totalTermFreq();
   }
-  
+
   @Override
   public PostingsEnum postings(PostingsEnum reuse, int flags) throws IOException {
     return actualEnum.postings(reuse, flags);
   }
-  
+
   @Override
   public ImpactsEnum impacts(int flags) throws IOException {
     return actualEnum.impacts(flags);
   }
-  
+
   @Override
   public void seekExact(BytesRef term, TermState state) throws IOException {
     actualEnum.seekExact(term, state);
   }
-  
+
   @Override
   public TermState termState() throws IOException {
     return actualEnum.termState();
   }
-  
+
   @Override
   public long ord() throws IOException {
     return actualEnum.ord();
@@ -303,21 +328,21 @@ public final class FuzzyTermsEnum extends TermsEnum {
   public SeekStatus seekCeil(BytesRef text) throws IOException {
     return actualEnum.seekCeil(text);
   }
-  
+
   @Override
   public void seekExact(long ord) throws IOException {
     actualEnum.seekExact(ord);
   }
-  
+
   @Override
   public BytesRef term() throws IOException {
     return actualEnum.term();
   }
 
   /**
-   * Thrown to indicate that there was an issue creating a fuzzy query for a given term.
-   * Typically occurs with terms longer than 220 UTF-8 characters,
-   * but also possible with shorter terms consisting of UTF-32 code points.
+   * Thrown to indicate that there was an issue creating a fuzzy query for a given term. Typically
+   * occurs with terms longer than 220 UTF-8 characters, but also possible with shorter terms
+   * consisting of UTF-32 code points.
    */
   public static class FuzzyTermsException extends RuntimeException {
     FuzzyTermsException(String term, Throwable cause) {
@@ -328,15 +353,16 @@ public final class FuzzyTermsEnum extends TermsEnum {
   /**
    * Used for sharing automata between segments
    *
-   * Levenshtein automata are large and expensive to build; we don't want to build
-   * them directly on the query because this can blow up caches that use queries
-   * as keys; we also don't want to rebuild them for every segment.  This attribute
-   * allows the FuzzyTermsEnum to build the automata once for its first segment
-   * and then share them for subsequent segment calls.
+   * <p>Levenshtein automata are large and expensive to build; we don't want to build them directly
+   * on the query because this can blow up caches that use queries as keys; we also don't want to
+   * rebuild them for every segment. This attribute allows the FuzzyTermsEnum to build the automata
+   * once for its first segment and then share them for subsequent segment calls.
    */
   private interface AutomatonAttribute extends Attribute {
     CompiledAutomaton[] getAutomata();
+
     int getTermLength();
+
     void init(Supplier<FuzzyAutomatonBuilder> builder);
   }
 
@@ -380,5 +406,4 @@ public final class FuzzyTermsEnum extends TermsEnum {
       throw new UnsupportedOperationException();
     }
   }
-
 }
diff --git a/lucene/core/src/java/org/apache/lucene/search/HitQueue.java b/lucene/core/src/java/org/apache/lucene/search/HitQueue.java
index 6c569fe..9998452 100644
--- a/lucene/core/src/java/org/apache/lucene/search/HitQueue.java
+++ b/lucene/core/src/java/org/apache/lucene/search/HitQueue.java
@@ -16,70 +16,67 @@
  */
 package org.apache.lucene.search;
 
-
 import org.apache.lucene.util.PriorityQueue;
 
-/** Expert: Priority queue containing hit docs
+/**
+ * Expert: Priority queue containing hit docs
+ *
  * @lucene.internal
  */
 public final class HitQueue extends PriorityQueue<ScoreDoc> {
 
   /**
-   * Creates a new instance with <code>size</code> elements. If
-   * <code>prePopulate</code> is set to true, the queue will pre-populate itself
-   * with sentinel objects and set its {@link #size()} to <code>size</code>. In
-   * that case, you should not rely on {@link #size()} to get the number of
+   * Creates a new instance with <code>size</code> elements. If <code>prePopulate</code> is set to
+   * true, the queue will pre-populate itself with sentinel objects and set its {@link #size()} to
+   * <code>size</code>. In that case, you should not rely on {@link #size()} to get the number of
    * actual elements that were added to the queue, but keep track yourself.<br>
-   * <b>NOTE:</b> in case <code>prePopulate</code> is true, you should pop
-   * elements from the queue using the following code example:
-   * 
+   * <b>NOTE:</b> in case <code>prePopulate</code> is true, you should pop elements from the queue
+   * using the following code example:
+   *
    * <pre class="prettyprint">
    * PriorityQueue&lt;ScoreDoc&gt; pq = new HitQueue(10, true); // pre-populate.
    * ScoreDoc top = pq.top();
-   * 
+   *
    * // Add/Update one element.
    * top.score = 1.0f;
    * top.doc = 0;
    * top = (ScoreDoc) pq.updateTop();
    * int totalHits = 1;
-   * 
+   *
    * // Now pop only the elements that were *truly* inserted.
    * // First, pop all the sentinel elements (there are pq.size() - totalHits).
    * for (int i = pq.size() - totalHits; i &gt; 0; i--) pq.pop();
-   * 
+   *
    * // Now pop the truly added elements.
    * ScoreDoc[] results = new ScoreDoc[totalHits];
    * for (int i = totalHits - 1; i &gt;= 0; i--) {
    *   results[i] = (ScoreDoc) pq.pop();
    * }
    * </pre>
-   * 
-   * <p><b>NOTE</b>: This class pre-allocate a full array of
-   * length <code>size</code>.
-   * 
-   * @param size
-   *          the requested size of this queue.
-   * @param prePopulate
-   *          specifies whether to pre-populate the queue with sentinel values.
+   *
+   * <p><b>NOTE</b>: This class pre-allocate a full array of length <code>size</code>.
+   *
+   * @param size the requested size of this queue.
+   * @param prePopulate specifies whether to pre-populate the queue with sentinel values.
    */
   public HitQueue(int size, boolean prePopulate) {
-    super(size, () -> {
-      if (prePopulate) {
-        // Always set the doc Id to MAX_VALUE so that it won't be favored by
-        // lessThan. This generally should not happen since if score is not NEG_INF,
-        // TopScoreDocCollector will always add the object to the queue.
-        return new ScoreDoc(Integer.MAX_VALUE, Float.NEGATIVE_INFINITY);
-      } else {
-        return null;
-      }
-    });
+    super(
+        size,
+        () -> {
+          if (prePopulate) {
+            // Always set the doc Id to MAX_VALUE so that it won't be favored by
+            // lessThan. This generally should not happen since if score is not NEG_INF,
+            // TopScoreDocCollector will always add the object to the queue.
+            return new ScoreDoc(Integer.MAX_VALUE, Float.NEGATIVE_INFINITY);
+          } else {
+            return null;
+          }
+        });
   }
 
   @Override
   protected final boolean lessThan(ScoreDoc hitA, ScoreDoc hitB) {
-    if (hitA.score == hitB.score)
-      return hitA.doc > hitB.doc; 
-    else
-      return hitA.score < hitB.score;
+    if (hitA.score == hitB.score) return hitA.doc > hitB.doc;
+    else return hitA.score < hitB.score;
   }
 }
diff --git a/lucene/core/src/java/org/apache/lucene/search/HitsThresholdChecker.java b/lucene/core/src/java/org/apache/lucene/search/HitsThresholdChecker.java
index 2f8ffe9..9e42cd7 100644
--- a/lucene/core/src/java/org/apache/lucene/search/HitsThresholdChecker.java
+++ b/lucene/core/src/java/org/apache/lucene/search/HitsThresholdChecker.java
@@ -19,13 +19,9 @@ package org.apache.lucene.search;
 
 import java.util.concurrent.atomic.AtomicLong;
 
-/**
- * Used for defining custom algorithms to allow searches to early terminate
- */
+/** Used for defining custom algorithms to allow searches to early terminate */
 abstract class HitsThresholdChecker {
-  /**
-   * Implementation of HitsThresholdChecker which allows global hit counting
-   */
+  /** Implementation of HitsThresholdChecker which allows global hit counting */
   private static class GlobalHitsThresholdChecker extends HitsThresholdChecker {
     private final int totalHitsThreshold;
     private final AtomicLong globalHitCount;
@@ -33,7 +29,8 @@ abstract class HitsThresholdChecker {
     public GlobalHitsThresholdChecker(int totalHitsThreshold) {
 
       if (totalHitsThreshold < 0) {
-        throw new IllegalArgumentException("totalHitsThreshold must be >= 0, got " + totalHitsThreshold);
+        throw new IllegalArgumentException(
+            "totalHitsThreshold must be >= 0, got " + totalHitsThreshold);
       }
 
       this.totalHitsThreshold = totalHitsThreshold;
@@ -46,7 +43,7 @@ abstract class HitsThresholdChecker {
     }
 
     @Override
-    public boolean isThresholdReached(){
+    public boolean isThresholdReached() {
       return globalHitCount.getAcquire() > totalHitsThreshold;
     }
 
@@ -61,9 +58,7 @@ abstract class HitsThresholdChecker {
     }
   }
 
-  /**
-   * Default implementation of HitsThresholdChecker to be used for single threaded execution
-   */
+  /** Default implementation of HitsThresholdChecker to be used for single threaded execution */
   private static class LocalHitsThresholdChecker extends HitsThresholdChecker {
     private final int totalHitsThreshold;
     private int hitCount;
@@ -71,7 +66,8 @@ abstract class HitsThresholdChecker {
     public LocalHitsThresholdChecker(int totalHitsThreshold) {
 
       if (totalHitsThreshold < 0) {
-        throw new IllegalArgumentException("totalHitsThreshold must be >= 0, got " + totalHitsThreshold);
+        throw new IllegalArgumentException(
+            "totalHitsThreshold must be >= 0, got " + totalHitsThreshold);
       }
 
       this.totalHitsThreshold = totalHitsThreshold;
@@ -113,7 +109,10 @@ abstract class HitsThresholdChecker {
   }
 
   public abstract void incrementHitCount();
+
   public abstract ScoreMode scoreMode();
+
   public abstract int getHitsThreshold();
+
   public abstract boolean isThresholdReached();
 }
diff --git a/lucene/core/src/java/org/apache/lucene/search/ImpactsDISI.java b/lucene/core/src/java/org/apache/lucene/search/ImpactsDISI.java
index 0f978ed..843bb4a 100644
--- a/lucene/core/src/java/org/apache/lucene/search/ImpactsDISI.java
+++ b/lucene/core/src/java/org/apache/lucene/search/ImpactsDISI.java
@@ -17,16 +17,16 @@
 package org.apache.lucene.search;
 
 import java.io.IOException;
-
 import org.apache.lucene.index.Impacts;
 import org.apache.lucene.index.ImpactsEnum;
 import org.apache.lucene.index.ImpactsSource;
 import org.apache.lucene.search.similarities.Similarity.SimScorer;
 
 /**
- * {@link DocIdSetIterator} that skips non-competitive docs thanks to the
- * indexed impacts. Call {@link #setMinCompetitiveScore(float)} in order to
- * give this iterator the ability to skip low-scoring documents.
+ * {@link DocIdSetIterator} that skips non-competitive docs thanks to the indexed impacts. Call
+ * {@link #setMinCompetitiveScore(float)} in order to give this iterator the ability to skip
+ * low-scoring documents.
+ *
  * @lucene.internal
  */
 public final class ImpactsDISI extends DocIdSetIterator {
@@ -41,9 +41,10 @@ public final class ImpactsDISI extends DocIdSetIterator {
 
   /**
    * Sole constructor.
-   * @param in            wrapped iterator
+   *
+   * @param in wrapped iterator
    * @param impactsSource source of impacts
-   * @param scorer        scorer
+   * @param scorer scorer
    */
   public ImpactsDISI(DocIdSetIterator in, ImpactsSource impactsSource, SimScorer scorer) {
     this.in = in;
@@ -54,6 +55,7 @@ public final class ImpactsDISI extends DocIdSetIterator {
 
   /**
    * Set the minimum competitive score.
+   *
    * @see Scorer#setMinCompetitiveScore(float)
    */
   public void setMinCompetitiveScore(float minCompetitiveScore) {
@@ -68,8 +70,9 @@ public final class ImpactsDISI extends DocIdSetIterator {
   }
 
   /**
-   * Implement the contract of {@link Scorer#advanceShallow(int)} based on the
-   * wrapped {@link ImpactsEnum}.
+   * Implement the contract of {@link Scorer#advanceShallow(int)} based on the wrapped {@link
+   * ImpactsEnum}.
+   *
    * @see Scorer#advanceShallow(int)
    */
   public int advanceShallow(int target) throws IOException {
@@ -79,8 +82,9 @@ public final class ImpactsDISI extends DocIdSetIterator {
   }
 
   /**
-   * Implement the contract of {@link Scorer#getMaxScore(int)} based on the
-   * wrapped {@link ImpactsEnum} and {@link Scorer}.
+   * Implement the contract of {@link Scorer#getMaxScore(int)} based on the wrapped {@link
+   * ImpactsEnum} and {@link Scorer}.
+   *
    * @see Scorer#getMaxScore(int)
    */
   public float getMaxScore(int upTo) throws IOException {
@@ -145,5 +149,4 @@ public final class ImpactsDISI extends DocIdSetIterator {
   public long cost() {
     return in.cost();
   }
-
 }
diff --git a/lucene/core/src/java/org/apache/lucene/search/IndexOrDocValuesQuery.java b/lucene/core/src/java/org/apache/lucene/search/IndexOrDocValuesQuery.java
index a3a3a22..c9338b7 100644
--- a/lucene/core/src/java/org/apache/lucene/search/IndexOrDocValuesQuery.java
+++ b/lucene/core/src/java/org/apache/lucene/search/IndexOrDocValuesQuery.java
@@ -17,20 +17,19 @@
 package org.apache.lucene.search;
 
 import java.io.IOException;
-
 import org.apache.lucene.document.LongPoint;
 import org.apache.lucene.document.SortedNumericDocValuesField;
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.LeafReaderContext;
 
 /**
- * A query that uses either an index structure (points or terms) or doc values
- * in order to run a query, depending which one is more efficient. This is
- * typically useful for range queries, whose {@link Weight#scorer} is costly
- * to create since it usually needs to sort large lists of doc ids. For
- * instance, for a field that both indexed {@link LongPoint}s and
- * {@link SortedNumericDocValuesField}s with the same values, an efficient
- * range query could be created by doing:
+ * A query that uses either an index structure (points or terms) or doc values in order to run a
+ * query, depending which one is more efficient. This is typically useful for range queries, whose
+ * {@link Weight#scorer} is costly to create since it usually needs to sort large lists of doc ids.
+ * For instance, for a field that both indexed {@link LongPoint}s and {@link
+ * SortedNumericDocValuesField}s with the same values, an efficient range query could be created by
+ * doing:
+ *
  * <pre class="prettyprint">
  *   String field;
  *   long minValue, maxValue;
@@ -38,13 +37,15 @@ import org.apache.lucene.index.LeafReaderContext;
  *   Query dvQuery = SortedNumericDocValuesField.newSlowRangeQuery(field, minValue, maxValue);
  *   Query query = new IndexOrDocValuesQuery(pointQuery, dvQuery);
  * </pre>
- * The above query will be efficient as it will use points in the case that they
- * perform better, ie. when we need a good lead iterator that will be almost
- * entirely consumed; and doc values otherwise, ie. in the case that another
- * part of the query is already leading iteration but we still need the ability
- * to verify that some documents match.
- * <p><b>NOTE</b>This query currently only works well with point range/exact
- * queries and their equivalent doc values queries.
+ *
+ * The above query will be efficient as it will use points in the case that they perform better, ie.
+ * when we need a good lead iterator that will be almost entirely consumed; and doc values
+ * otherwise, ie. in the case that another part of the query is already leading iteration but we
+ * still need the ability to verify that some documents match.
+ *
+ * <p><b>NOTE</b>This query currently only works well with point range/exact queries and their
+ * equivalent doc values queries.
+ *
  * @lucene.experimental
  */
 public final class IndexOrDocValuesQuery extends Query {
@@ -52,25 +53,27 @@ public final class IndexOrDocValuesQuery extends Query {
   private final Query indexQuery, dvQuery;
 
   /**
-   * Create an {@link IndexOrDocValuesQuery}. Both provided queries must match
-   * the same documents and give the same scores.
+   * Create an {@link IndexOrDocValuesQuery}. Both provided queries must match the same documents
+   * and give the same scores.
+   *
    * @param indexQuery a query that has a good iterator but whose scorer may be costly to create
-   * @param dvQuery a query whose scorer is cheap to create that can quickly check whether a given document matches
+   * @param dvQuery a query whose scorer is cheap to create that can quickly check whether a given
+   *     document matches
    */
   public IndexOrDocValuesQuery(Query indexQuery, Query dvQuery) {
     this.indexQuery = indexQuery;
     this.dvQuery = dvQuery;
   }
 
-  /** Return the wrapped query that may be costly to initialize but has a good
-   *  iterator. */
+  /** Return the wrapped query that may be costly to initialize but has a good iterator. */
   public Query getIndexQuery() {
     return indexQuery;
   }
 
-  /** Return the wrapped query that may be slow at identifying all matching
-   *  documents, but which is cheap to initialize and can efficiently
-   *  verify that some documents match. */
+  /**
+   * Return the wrapped query that may be slow at identifying all matching documents, but which is
+   * cheap to initialize and can efficiently verify that some documents match.
+   */
   public Query getRandomAccessQuery() {
     return dvQuery;
   }
@@ -115,7 +118,8 @@ public final class IndexOrDocValuesQuery extends Query {
   }
 
   @Override
-  public Weight createWeight(IndexSearcher searcher, ScoreMode scoreMode, float boost) throws IOException {
+  public Weight createWeight(IndexSearcher searcher, ScoreMode scoreMode, float boost)
+      throws IOException {
     final Weight indexWeight = indexQuery.createWeight(searcher, scoreMode, boost);
     final Weight dvWeight = dvQuery.createWeight(searcher, scoreMode, boost);
     return new Weight(this) {
@@ -182,8 +186,6 @@ public final class IndexOrDocValuesQuery extends Query {
         // the index query's cachehelper here
         return indexWeight.isCacheable(ctx);
       }
-
     };
   }
-
 }
diff --git a/lucene/core/src/java/org/apache/lucene/search/IndexSearcher.java b/lucene/core/src/java/org/apache/lucene/search/IndexSearcher.java
index 1df656d..e44debb 100644
--- a/lucene/core/src/java/org/apache/lucene/search/IndexSearcher.java
+++ b/lucene/core/src/java/org/apache/lucene/search/IndexSearcher.java
@@ -16,7 +16,6 @@
  */
 package org.apache.lucene.search;
 
-
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -32,7 +31,6 @@ import java.util.concurrent.Future;
 import java.util.concurrent.FutureTask;
 import java.util.concurrent.ThreadPoolExecutor;
 import java.util.function.Supplier;
-
 import org.apache.lucene.document.Document;
 import org.apache.lucene.index.DirectoryReader;
 import org.apache.lucene.index.IndexReader;
@@ -50,48 +48,42 @@ import org.apache.lucene.util.Bits;
 import org.apache.lucene.util.ThreadInterruptedException;
 import org.apache.lucene.util.automaton.ByteRunAutomaton;
 
-/** Implements search over a single IndexReader.
+/**
+ * Implements search over a single IndexReader.
  *
- * <p>Applications usually need only call the inherited
- * {@link #search(Query,int)} method. For
- * performance reasons, if your index is unchanging, you
- * should share a single IndexSearcher instance across
- * multiple searches instead of creating a new one
- * per-search.  If your index has changed and you wish to
- * see the changes reflected in searching, you should
- * use {@link DirectoryReader#openIfChanged(DirectoryReader)}
- * to obtain a new reader and
- * then create a new IndexSearcher from that.  Also, for
- * low-latency turnaround it's best to use a near-real-time
- * reader ({@link DirectoryReader#open(IndexWriter)}).
- * Once you have a new {@link IndexReader}, it's relatively
- * cheap to create a new IndexSearcher from it.
+ * <p>Applications usually need only call the inherited {@link #search(Query,int)} method. For
+ * performance reasons, if your index is unchanging, you should share a single IndexSearcher
+ * instance across multiple searches instead of creating a new one per-search. If your index has
+ * changed and you wish to see the changes reflected in searching, you should use {@link
+ * DirectoryReader#openIfChanged(DirectoryReader)} to obtain a new reader and then create a new
+ * IndexSearcher from that. Also, for low-latency turnaround it's best to use a near-real-time
+ * reader ({@link DirectoryReader#open(IndexWriter)}). Once you have a new {@link IndexReader}, it's
+ * relatively cheap to create a new IndexSearcher from it.
  *
- * <p><b>NOTE</b>: The {@link #search} and {@link #searchAfter} methods are
- * configured to only count top hits accurately up to {@code 1,000} and may
- * return a {@link TotalHits.Relation lower bound} of the hit count if the
- * hit count is greater than or equal to {@code 1,000}. On queries that match
- * lots of documents, counting the number of hits may take much longer than
- * computing the top hits so this trade-off allows to get some minimal
- * information about the hit count without slowing down search too much. The
- * {@link TopDocs#scoreDocs} array is always accurate however. If this behavior
- * doesn't suit your needs, you should create collectors manually with either
- * {@link TopScoreDocCollector#create} or {@link TopFieldCollector#create} and
- * call {@link #search(Query, Collector)}.
+ * <p><b>NOTE</b>: The {@link #search} and {@link #searchAfter} methods are configured to only count
+ * top hits accurately up to {@code 1,000} and may return a {@link TotalHits.Relation lower bound}
+ * of the hit count if the hit count is greater than or equal to {@code 1,000}. On queries that
+ * match lots of documents, counting the number of hits may take much longer than computing the top
+ * hits so this trade-off allows to get some minimal information about the hit count without slowing
+ * down search too much. The {@link TopDocs#scoreDocs} array is always accurate however. If this
+ * behavior doesn't suit your needs, you should create collectors manually with either {@link
+ * TopScoreDocCollector#create} or {@link TopFieldCollector#create} and call {@link #search(Query,
+ * Collector)}.
  *
- * <a id="thread-safety"></a><p><b>NOTE</b>: <code>{@link
- * IndexSearcher}</code> instances are completely
- * thread safe, meaning multiple threads can call any of its
- * methods, concurrently.  If your application requires
- * external synchronization, you should <b>not</b>
- * synchronize on the <code>IndexSearcher</code> instance;
- * use your own (non-Lucene) objects instead.</p>
+ * <p><a id="thread-safety"></a>
+ *
+ * <p><b>NOTE</b>: <code>{@link
+ * IndexSearcher}</code> instances are completely thread safe, meaning multiple threads can call any
+ * of its methods, concurrently. If your application requires external synchronization, you should
+ * <b>not</b> synchronize on the <code>IndexSearcher</code> instance; use your own (non-Lucene)
+ * objects instead.
  */
 public class IndexSearcher {
 
   static int maxClauseCount = 1024;
   private static QueryCache DEFAULT_QUERY_CACHE;
   private static QueryCachingPolicy DEFAULT_CACHING_POLICY = new UsageTrackingQueryCachingPolicy();
+
   static {
     final int maxCachedQueries = 1000;
     // min of 32MB or 5% of the heap size
@@ -99,20 +91,21 @@ public class IndexSearcher {
     DEFAULT_QUERY_CACHE = new LRUQueryCache(maxCachedQueries, maxRamBytesUsed);
   }
   /**
-   * By default we count hits accurately up to 1000. This makes sure that we
-   * don't spend most time on computing hit counts
+   * By default we count hits accurately up to 1000. This makes sure that we don't spend most time
+   * on computing hit counts
    */
   private static final int TOTAL_HITS_THRESHOLD = 1000;
 
   /**
-   * Thresholds for index slice allocation logic. To change the default, extend
-   * <code> IndexSearcher</code> and use custom values
+   * Thresholds for index slice allocation logic. To change the default, extend <code> IndexSearcher
+   * </code> and use custom values
    */
   private static final int MAX_DOCS_PER_SLICE = 250_000;
+
   private static final int MAX_SEGMENTS_PER_SLICE = 5;
 
   final IndexReader reader; // package private for testing!
-  
+
   // NOTE: these members might change in incompatible ways
   // in the next release
   protected final IndexReaderContext readerContext;
@@ -134,10 +127,10 @@ public class IndexSearcher {
   private QueryCachingPolicy queryCachingPolicy = DEFAULT_CACHING_POLICY;
 
   /**
-   * Expert: returns a default Similarity instance.
-   * In general, this method is only called to initialize searchers and writers.
-   * User code and query implementations should respect
-   * {@link IndexSearcher#getSimilarity()}.
+   * Expert: returns a default Similarity instance. In general, this method is only called to
+   * initialize searchers and writers. User code and query implementations should respect {@link
+   * IndexSearcher#getSimilarity()}.
+   *
    * @lucene.internal
    */
   public static Similarity getDefaultSimilarity() {
@@ -146,6 +139,7 @@ public class IndexSearcher {
 
   /**
    * Expert: Get the default {@link QueryCache} or {@code null} if the cache is disabled.
+   *
    * @lucene.internal
    */
   public static QueryCache getDefaultQueryCache() {
@@ -154,6 +148,7 @@ public class IndexSearcher {
 
   /**
    * Expert: set the default {@link QueryCache} instance.
+   *
    * @lucene.internal
    */
   public static void setDefaultQueryCache(QueryCache defaultQueryCache) {
@@ -162,6 +157,7 @@ public class IndexSearcher {
 
   /**
    * Expert: Get the default {@link QueryCachingPolicy}.
+   *
    * @lucene.internal
    */
   public static QueryCachingPolicy getDefaultQueryCachingPolicy() {
@@ -170,6 +166,7 @@ public class IndexSearcher {
 
   /**
    * Expert: set the default {@link QueryCachingPolicy} instance.
+   *
    * @lucene.internal
    */
   public static void setDefaultQueryCachingPolicy(QueryCachingPolicy defaultQueryCachingPolicy) {
@@ -184,29 +181,27 @@ public class IndexSearcher {
     this(r, null);
   }
 
-  /** Runs searches for each segment separately, using the
-   *  provided Executor. NOTE:
-   *  if you are using {@link NIOFSDirectory}, do not use
-   *  the shutdownNow method of ExecutorService as this uses
-   *  Thread.interrupt under-the-hood which can silently
-   *  close file descriptors (see <a
-   *  href="https://issues.apache.org/jira/browse/LUCENE-2239">LUCENE-2239</a>).
-   * 
-   * @lucene.experimental */
+  /**
+   * Runs searches for each segment separately, using the provided Executor. NOTE: if you are using
+   * {@link NIOFSDirectory}, do not use the shutdownNow method of ExecutorService as this uses
+   * Thread.interrupt under-the-hood which can silently close file descriptors (see <a
+   * href="https://issues.apache.org/jira/browse/LUCENE-2239">LUCENE-2239</a>).
+   *
+   * @lucene.experimental
+   */
   public IndexSearcher(IndexReader r, Executor executor) {
     this(r.getContext(), executor);
   }
 
   /**
    * Creates a searcher searching the provided top-level {@link IndexReaderContext}.
-   * <p>
-   * Given a non-<code>null</code> {@link Executor} this method runs
-   * searches for each segment separately, using the provided Executor.
-   * NOTE: if you are using {@link NIOFSDirectory}, do not use the shutdownNow method of
-   * ExecutorService as this uses Thread.interrupt under-the-hood which can
-   * silently close file descriptors (see <a
+   *
+   * <p>Given a non-<code>null</code> {@link Executor} this method runs searches for each segment
+   * separately, using the provided Executor. NOTE: if you are using {@link NIOFSDirectory}, do not
+   * use the shutdownNow method of ExecutorService as this uses Thread.interrupt under-the-hood
+   * which can silently close file descriptors (see <a
    * href="https://issues.apache.org/jira/browse/LUCENE-2239">LUCENE-2239</a>).
-   * 
+   *
    * @see IndexReaderContext
    * @see IndexReader#getContext()
    * @lucene.experimental
@@ -217,8 +212,9 @@ public class IndexSearcher {
 
   // Package private for testing
   IndexSearcher(IndexReaderContext context, Executor executor, SliceExecutor sliceExecutor) {
-    assert context.isTopLevel: "IndexSearcher's ReaderContext must be topLevel for reader" + context.reader();
-    assert (sliceExecutor == null) == (executor==null);
+    assert context.isTopLevel
+        : "IndexSearcher's ReaderContext must be topLevel for reader" + context.reader();
+    assert (sliceExecutor == null) == (executor == null);
 
     reader = context.reader();
     this.executor = executor;
@@ -239,18 +235,18 @@ public class IndexSearcher {
     this(context, null);
   }
 
-  /** Return the maximum number of clauses permitted, 1024 by default.
-   * Attempts to add more than the permitted number of clauses cause {@link
-   * TooManyClauses} to be thrown.
+  /**
+   * Return the maximum number of clauses permitted, 1024 by default. Attempts to add more than the
+   * permitted number of clauses cause {@link TooManyClauses} to be thrown.
+   *
    * @see #setMaxClauseCount(int)
    */
-  public static int getMaxClauseCount() { return maxClauseCount; }
+  public static int getMaxClauseCount() {
+    return maxClauseCount;
+  }
 
-  /**
-   * Set the maximum number of clauses permitted per Query.
-   * Default value is 1024.
-   */
-  public static void setMaxClauseCount(int value)  {
+  /** Set the maximum number of clauses permitted per Query. Default value is 1024. */
+  public static void setMaxClauseCount(int value) {
     if (value < 1) {
       throw new IllegalArgumentException("maxClauseCount must be >= 1");
     }
@@ -258,12 +254,13 @@ public class IndexSearcher {
   }
 
   /**
-   * Set the {@link QueryCache} to use when scores are not needed.
-   * A value of {@code null} indicates that query matches should never be
-   * cached. This method should be called <b>before</b> starting using this
-   * {@link IndexSearcher}.
-   * <p>NOTE: When using a query cache, queries should not be modified after
-   * they have been passed to IndexSearcher.
+   * Set the {@link QueryCache} to use when scores are not needed. A value of {@code null} indicates
+   * that query matches should never be cached. This method should be called <b>before</b> starting
+   * using this {@link IndexSearcher}.
+   *
+   * <p>NOTE: When using a query cache, queries should not be modified after they have been passed
+   * to IndexSearcher.
+   *
    * @see QueryCache
    * @lucene.experimental
    */
@@ -272,10 +269,11 @@ public class IndexSearcher {
   }
 
   /**
-   * Return the query cache of this {@link IndexSearcher}. This will be either
-   * the {@link #getDefaultQueryCache() default query cache} or the query cache
-   * that was last set through {@link #setQueryCache(QueryCache)}. A return
-   * value of {@code null} indicates that caching is disabled.
+   * Return the query cache of this {@link IndexSearcher}. This will be either the {@link
+   * #getDefaultQueryCache() default query cache} or the query cache that was last set through
+   * {@link #setQueryCache(QueryCache)}. A return value of {@code null} indicates that caching is
+   * disabled.
+   *
    * @lucene.experimental
    */
   public QueryCache getQueryCache() {
@@ -283,9 +281,9 @@ public class IndexSearcher {
   }
 
   /**
-   * Set the {@link QueryCachingPolicy} to use for query caching.
-   * This method should be called <b>before</b> starting using this
-   * {@link IndexSearcher}.
+   * Set the {@link QueryCachingPolicy} to use for query caching. This method should be called
+   * <b>before</b> starting using this {@link IndexSearcher}.
+   *
    * @see QueryCachingPolicy
    * @lucene.experimental
    */
@@ -294,9 +292,10 @@ public class IndexSearcher {
   }
 
   /**
-   * Return the query cache of this {@link IndexSearcher}. This will be either
-   * the {@link #getDefaultQueryCachingPolicy() default policy} or the policy
-   * that was last set through {@link #setQueryCachingPolicy(QueryCachingPolicy)}.
+   * Return the query cache of this {@link IndexSearcher}. This will be either the {@link
+   * #getDefaultQueryCachingPolicy() default policy} or the policy that was last set through {@link
+   * #setQueryCachingPolicy(QueryCachingPolicy)}.
+   *
    * @lucene.experimental
    */
   public QueryCachingPolicy getQueryCachingPolicy() {
@@ -304,25 +303,23 @@ public class IndexSearcher {
   }
 
   /**
-   * Expert: Creates an array of leaf slices each holding a subset of the given leaves.
-   * Each {@link LeafSlice} is executed in a single thread. By default, segments with more than
+   * Expert: Creates an array of leaf slices each holding a subset of the given leaves. Each {@link
+   * LeafSlice} is executed in a single thread. By default, segments with more than
    * MAX_DOCS_PER_SLICE will get their own thread
    */
   protected LeafSlice[] slices(List<LeafReaderContext> leaves) {
     return slices(leaves, MAX_DOCS_PER_SLICE, MAX_SEGMENTS_PER_SLICE);
   }
 
-  /**
-   * Static method to segregate LeafReaderContexts amongst multiple slices
-   */
-  public static LeafSlice[] slices (List<LeafReaderContext> leaves, int maxDocsPerSlice,
-                                    int maxSegmentsPerSlice) {
+  /** Static method to segregate LeafReaderContexts amongst multiple slices */
+  public static LeafSlice[] slices(
+      List<LeafReaderContext> leaves, int maxDocsPerSlice, int maxSegmentsPerSlice) {
     // Make a copy so we can sort:
     List<LeafReaderContext> sortedLeaves = new ArrayList<>(leaves);
 
     // Sort by maxDoc, descending:
-    Collections.sort(sortedLeaves,
-        Collections.reverseOrder(Comparator.comparingInt(l -> l.reader().maxDoc())));
+    Collections.sort(
+        sortedLeaves, Collections.reverseOrder(Comparator.comparingInt(l -> l.reader().maxDoc())));
 
     final List<List<LeafReaderContext>> groupedLeaves = new ArrayList<>();
     long docSum = 0;
@@ -364,47 +361,48 @@ public class IndexSearcher {
     return reader;
   }
 
-  /** 
-   * Sugar for <code>.getIndexReader().document(docID)</code> 
-   * @see IndexReader#document(int) 
+  /**
+   * Sugar for <code>.getIndexReader().document(docID)</code>
+   *
+   * @see IndexReader#document(int)
    */
   public Document doc(int docID) throws IOException {
     return reader.document(docID);
   }
 
-  /** 
+  /**
    * Sugar for <code>.getIndexReader().document(docID, fieldVisitor)</code>
-   * @see IndexReader#document(int, StoredFieldVisitor) 
+   *
+   * @see IndexReader#document(int, StoredFieldVisitor)
    */
   public void doc(int docID, StoredFieldVisitor fieldVisitor) throws IOException {
     reader.document(docID, fieldVisitor);
   }
 
-  /** 
+  /**
    * Sugar for <code>.getIndexReader().document(docID, fieldsToLoad)</code>
-   * @see IndexReader#document(int, Set) 
+   *
+   * @see IndexReader#document(int, Set)
    */
   public Document doc(int docID, Set<String> fieldsToLoad) throws IOException {
     return reader.document(docID, fieldsToLoad);
   }
 
-  /** Expert: Set the Similarity implementation used by this IndexSearcher.
-   *
-   */
+  /** Expert: Set the Similarity implementation used by this IndexSearcher. */
   public void setSimilarity(Similarity similarity) {
     this.similarity = similarity;
   }
 
-  /** Expert: Get the {@link Similarity} to use to compute scores. This returns the
-   *  {@link Similarity} that has been set through {@link #setSimilarity(Similarity)}
-   *  or the default {@link Similarity} if none has been set explicitly. */
+  /**
+   * Expert: Get the {@link Similarity} to use to compute scores. This returns the {@link
+   * Similarity} that has been set through {@link #setSimilarity(Similarity)} or the default {@link
+   * Similarity} if none has been set explicitly.
+   */
   public Similarity getSimilarity() {
     return similarity;
   }
 
-  /**
-   * Count how many documents match the given query.
-   */
+  /** Count how many documents match the given query. */
   public int count(Query query) throws IOException {
     query = rewrite(query);
     while (true) {
@@ -429,169 +427,171 @@ public class IndexSearcher {
     }
 
     // general case: create a collector and count matches
-    final CollectorManager<TotalHitCountCollector, Integer> collectorManager = new CollectorManager<TotalHitCountCollector, Integer>() {
-
-      @Override
-      public TotalHitCountCollector newCollector() throws IOException {
-        return new TotalHitCountCollector();
-      }
-
-      @Override
-      public Integer reduce(Collection<TotalHitCountCollector> collectors) throws IOException {
-        int total = 0;
-        for (TotalHitCountCollector collector : collectors) {
-          total += collector.getTotalHits();
-        }
-        return total;
-      }
-
-    };
+    final CollectorManager<TotalHitCountCollector, Integer> collectorManager =
+        new CollectorManager<TotalHitCountCollector, Integer>() {
+
+          @Override
+          public TotalHitCountCollector newCollector() throws IOException {
+            return new TotalHitCountCollector();
+          }
+
+          @Override
+          public Integer reduce(Collection<TotalHitCountCollector> collectors) throws IOException {
+            int total = 0;
+            for (TotalHitCountCollector collector : collectors) {
+              total += collector.getTotalHits();
+            }
+            return total;
+          }
+        };
     return search(query, collectorManager);
   }
 
-  /** Returns the leaf slices used for concurrent searching, or null if no {@code Executor} was
-   *  passed to the constructor.
+  /**
+   * Returns the leaf slices used for concurrent searching, or null if no {@code Executor} was
+   * passed to the constructor.
    *
-   * @lucene.experimental */
+   * @lucene.experimental
+   */
   public LeafSlice[] getSlices() {
-      return leafSlices;
+    return leafSlices;
   }
-  
-  /** Finds the top <code>n</code>
-   * hits for <code>query</code> where all results are after a previous 
+
+  /**
+   * Finds the top <code>n</code> hits for <code>query</code> where all results are after a previous
    * result (<code>after</code>).
-   * <p>
-   * By passing the bottom result from a previous page as <code>after</code>,
-   * this method can be used for efficient 'deep-paging' across potentially
-   * large result sets.
    *
-   * @throws TooManyClauses If a query would exceed
-   *         {@link IndexSearcher#getMaxClauseCount()} clauses.
+   * <p>By passing the bottom result from a previous page as <code>after</code>, this method can be
+   * used for efficient 'deep-paging' across potentially large result sets.
+   *
+   * @throws TooManyClauses If a query would exceed {@link IndexSearcher#getMaxClauseCount()}
+   *     clauses.
    */
   public TopDocs searchAfter(ScoreDoc after, Query query, int numHits) throws IOException {
     final int limit = Math.max(1, reader.maxDoc());
     if (after != null && after.doc >= limit) {
-      throw new IllegalArgumentException("after.doc exceeds the number of documents in the reader: after.doc="
-          + after.doc + " limit=" + limit);
+      throw new IllegalArgumentException(
+          "after.doc exceeds the number of documents in the reader: after.doc="
+              + after.doc
+              + " limit="
+              + limit);
     }
 
     final int cappedNumHits = Math.min(numHits, limit);
 
-    final CollectorManager<TopScoreDocCollector, TopDocs> manager = new CollectorManager<TopScoreDocCollector, TopDocs>() {
-
-      private final HitsThresholdChecker hitsThresholdChecker = (executor == null || leafSlices.length <= 1) ? HitsThresholdChecker.create(Math.max(TOTAL_HITS_THRESHOLD, numHits)) :
-          HitsThresholdChecker.createShared(Math.max(TOTAL_HITS_THRESHOLD, numHits));
-
-      private final MaxScoreAccumulator minScoreAcc = (executor == null || leafSlices.length <= 1) ? null : new MaxScoreAccumulator();
-
-      @Override
-      public TopScoreDocCollector newCollector() throws IOException {
-        return TopScoreDocCollector.create(cappedNumHits, after, hitsThresholdChecker, minScoreAcc);
-      }
-
-      @Override
-      public TopDocs reduce(Collection<TopScoreDocCollector> collectors) throws IOException {
-        final TopDocs[] topDocs = new TopDocs[collectors.size()];
-        int i = 0;
-        for (TopScoreDocCollector collector : collectors) {
-          topDocs[i++] = collector.topDocs();
-        }
-        return TopDocs.merge(0, cappedNumHits, topDocs);
-      }
-
-    };
+    final CollectorManager<TopScoreDocCollector, TopDocs> manager =
+        new CollectorManager<TopScoreDocCollector, TopDocs>() {
+
+          private final HitsThresholdChecker hitsThresholdChecker =
+              (executor == null || leafSlices.length <= 1)
+                  ? HitsThresholdChecker.create(Math.max(TOTAL_HITS_THRESHOLD, numHits))
+                  : HitsThresholdChecker.createShared(Math.max(TOTAL_HITS_THRESHOLD, numHits));
+
+          private final MaxScoreAccumulator minScoreAcc =
+              (executor == null || leafSlices.length <= 1) ? null : new MaxScoreAccumulator();
+
+          @Override
+          public TopScoreDocCollector newCollector() throws IOException {
+            return TopScoreDocCollector.create(
+                cappedNumHits, after, hitsThresholdChecker, minScoreAcc);
+          }
+
+          @Override
+          public TopDocs reduce(Collection<TopScoreDocCollector> collectors) throws IOException {
+            final TopDocs[] topDocs = new TopDocs[collectors.size()];
+            int i = 0;
+            for (TopScoreDocCollector collector : collectors) {
+              topDocs[i++] = collector.topDocs();
+            }
+            return TopDocs.merge(0, cappedNumHits, topDocs);
+          }
+        };
 
     return search(query, manager);
   }
 
-  /** Finds the top <code>n</code>
-   * hits for <code>query</code>.
+  /**
+   * Finds the top <code>n</code> hits for <code>query</code>.
    *
-   * @throws TooManyClauses If a query would exceed
-   *         {@link IndexSearcher#getMaxClauseCount()} clauses.
+   * @throws TooManyClauses If a query would exceed {@link IndexSearcher#getMaxClauseCount()}
+   *     clauses.
    */
-  public TopDocs search(Query query, int n)
-    throws IOException {
+  public TopDocs search(Query query, int n) throws IOException {
     return searchAfter(null, query, n);
   }
 
-  /** Lower-level search API.
+  /**
+   * Lower-level search API.
    *
    * <p>{@link LeafCollector#collect(int)} is called for every matching document.
    *
-   * @throws TooManyClauses If a query would exceed
-   *         {@link IndexSearcher#getMaxClauseCount()} clauses.
+   * @throws TooManyClauses If a query would exceed {@link IndexSearcher#getMaxClauseCount()}
+   *     clauses.
    */
-  public void search(Query query, Collector results)
-    throws IOException {
+  public void search(Query query, Collector results) throws IOException {
     query = rewrite(query);
     search(leafContexts, createWeight(query, results.scoreMode(), 1), results);
   }
 
-  /** Search implementation with arbitrary sorting, plus
-   * control over whether hit scores and max score
-   * should be computed.  Finds
-   * the top <code>n</code> hits for <code>query</code>, and sorting
-   * the hits by the criteria in <code>sort</code>.
-   * If <code>doDocScores</code> is <code>true</code>
-   * then the score of each hit will be computed and
-   * returned.  If <code>doMaxScore</code> is
-   * <code>true</code> then the maximum score over all
-   * collected hits will be computed.
-   * 
-   * @throws TooManyClauses If a query would exceed
-   *         {@link IndexSearcher#getMaxClauseCount()} clauses.
-   */
-  public TopFieldDocs search(Query query, int n,
-      Sort sort, boolean doDocScores) throws IOException {
+  /**
+   * Search implementation with arbitrary sorting, plus control over whether hit scores and max
+   * score should be computed. Finds the top <code>n</code> hits for <code>query</code>, and sorting
+   * the hits by the criteria in <code>sort</code>. If <code>doDocScores</code> is <code>true</code>
+   * then the score of each hit will be computed and returned. If <code>doMaxScore</code> is <code>
+   * true</code> then the maximum score over all collected hits will be computed.
+   *
+   * @throws TooManyClauses If a query would exceed {@link IndexSearcher#getMaxClauseCount()}
+   *     clauses.
+   */
+  public TopFieldDocs search(Query query, int n, Sort sort, boolean doDocScores)
+      throws IOException {
     return searchAfter(null, query, n, sort, doDocScores);
   }
 
   /**
    * Search implementation with arbitrary sorting.
+   *
    * @param query The query to search for
    * @param n Return only the top n results
    * @param sort The {@link org.apache.lucene.search.Sort} object
-   * @return The top docs, sorted according to the supplied {@link org.apache.lucene.search.Sort} instance
+   * @return The top docs, sorted according to the supplied {@link org.apache.lucene.search.Sort}
+   *     instance
    * @throws IOException if there is a low-level I/O error
    */
   public TopFieldDocs search(Query query, int n, Sort sort) throws IOException {
     return searchAfter(null, query, n, sort, false);
   }
 
-  /** Finds the top <code>n</code>
-   * hits for <code>query</code> where all results are after a previous
+  /**
+   * Finds the top <code>n</code> hits for <code>query</code> where all results are after a previous
    * result (<code>after</code>).
-   * <p>
-   * By passing the bottom result from a previous page as <code>after</code>,
-   * this method can be used for efficient 'deep-paging' across potentially
-   * large result sets.
    *
-   * @throws TooManyClauses If a query would exceed
-   *         {@link IndexSearcher#getMaxClauseCount()} clauses.
+   * <p>By passing the bottom result from a previous page as <code>after</code>, this method can be
+   * used for efficient 'deep-paging' across potentially large result sets.
+   *
+   * @throws TooManyClauses If a query would exceed {@link IndexSearcher#getMaxClauseCount()}
+   *     clauses.
    */
   public TopDocs searchAfter(ScoreDoc after, Query query, int n, Sort sort) throws IOException {
     return searchAfter(after, query, n, sort, false);
   }
 
-  /** Finds the top <code>n</code>
-   * hits for <code>query</code> where all results are after a previous
-   * result (<code>after</code>), allowing control over
-   * whether hit scores and max score should be computed.
-   * <p>
-   * By passing the bottom result from a previous page as <code>after</code>,
-   * this method can be used for efficient 'deep-paging' across potentially
-   * large result sets.  If <code>doDocScores</code> is <code>true</code>
-   * then the score of each hit will be computed and
-   * returned.  If <code>doMaxScore</code> is
-   * <code>true</code> then the maximum score over all
-   * collected hits will be computed.
-   *
-   * @throws TooManyClauses If a query would exceed
-   *         {@link IndexSearcher#getMaxClauseCount()} clauses.
-   */
-  public TopFieldDocs searchAfter(ScoreDoc after, Query query, int numHits, Sort sort,
-      boolean doDocScores) throws IOException {
+  /**
+   * Finds the top <code>n</code> hits for <code>query</code> where all results are after a previous
+   * result (<code>after</code>), allowing control over whether hit scores and max score should be
+   * computed.
+   *
+   * <p>By passing the bottom result from a previous page as <code>after</code>, this method can be
+   * used for efficient 'deep-paging' across potentially large result sets. If <code>doDocScores
+   * </code> is <code>true</code> then the score of each hit will be computed and returned. If
+   * <code>doMaxScore</code> is <code>true</code> then the maximum score over all collected hits
+   * will be computed.
+   *
+   * @throws TooManyClauses If a query would exceed {@link IndexSearcher#getMaxClauseCount()}
+   *     clauses.
+   */
+  public TopFieldDocs searchAfter(
+      ScoreDoc after, Query query, int numHits, Sort sort, boolean doDocScores) throws IOException {
     if (after != null && !(after instanceof FieldDoc)) {
       // TODO: if we fix type safety of TopFieldDocs we can
       // remove this
@@ -600,40 +600,47 @@ public class IndexSearcher {
     return searchAfter((FieldDoc) after, query, numHits, sort, doDocScores);
   }
 
-  private TopFieldDocs searchAfter(FieldDoc after, Query query, int numHits, Sort sort,
-      boolean doDocScores) throws IOException {
+  private TopFieldDocs searchAfter(
+      FieldDoc after, Query query, int numHits, Sort sort, boolean doDocScores) throws IOException {
     final int limit = Math.max(1, reader.maxDoc());
     if (after != null && after.doc >= limit) {
-      throw new IllegalArgumentException("after.doc exceeds the number of documents in the reader: after.doc="
-          + after.doc + " limit=" + limit);
+      throw new IllegalArgumentException(
+          "after.doc exceeds the number of documents in the reader: after.doc="
+              + after.doc
+              + " limit="
+              + limit);
     }
     final int cappedNumHits = Math.min(numHits, limit);
     final Sort rewrittenSort = sort.rewrite(this);
 
-    final CollectorManager<TopFieldCollector, TopFieldDocs> manager = new CollectorManager<>() {
-
-      private final HitsThresholdChecker hitsThresholdChecker = (executor == null || leafSlices.length <= 1) ? HitsThresholdChecker.create(Math.max(TOTAL_HITS_THRESHOLD, numHits)) :
-          HitsThresholdChecker.createShared(Math.max(TOTAL_HITS_THRESHOLD, numHits));
-
-      private final MaxScoreAccumulator minScoreAcc = (executor == null || leafSlices.length <= 1) ? null : new MaxScoreAccumulator();
-
-      @Override
-      public TopFieldCollector newCollector() throws IOException {
-        // TODO: don't pay the price for accurate hit counts by default
-        return TopFieldCollector.create(rewrittenSort, cappedNumHits, after, hitsThresholdChecker, minScoreAcc);
-      }
-
-      @Override
-      public TopFieldDocs reduce(Collection<TopFieldCollector> collectors) throws IOException {
-        final TopFieldDocs[] topDocs = new TopFieldDocs[collectors.size()];
-        int i = 0;
-        for (TopFieldCollector collector : collectors) {
-          topDocs[i++] = collector.topDocs();
-        }
-        return TopDocs.merge(rewrittenSort, 0, cappedNumHits, topDocs);
-      }
-
-    };
+    final CollectorManager<TopFieldCollector, TopFieldDocs> manager =
+        new CollectorManager<>() {
+
+          private final HitsThresholdChecker hitsThresholdChecker =
+              (executor == null || leafSlices.length <= 1)
+                  ? HitsThresholdChecker.create(Math.max(TOTAL_HITS_THRESHOLD, numHits))
+                  : HitsThresholdChecker.createShared(Math.max(TOTAL_HITS_THRESHOLD, numHits));
+
+          private final MaxScoreAccumulator minScoreAcc =
+              (executor == null || leafSlices.length <= 1) ? null : new MaxScoreAccumulator();
+
+          @Override
+          public TopFieldCollector newCollector() throws IOException {
+            // TODO: don't pay the price for accurate hit counts by default
+            return TopFieldCollector.create(
+                rewrittenSort, cappedNumHits, after, hitsThresholdChecker, minScoreAcc);
+          }
+
+          @Override
+          public TopFieldDocs reduce(Collection<TopFieldCollector> collectors) throws IOException {
+            final TopFieldDocs[] topDocs = new TopFieldDocs[collectors.size()];
+            int i = 0;
+            for (TopFieldCollector collector : collectors) {
+              topDocs[i++] = collector.topDocs();
+            }
+            return TopDocs.merge(rewrittenSort, 0, cappedNumHits, topDocs);
+          }
+        };
 
     TopFieldDocs topDocs = search(query, manager);
     if (doDocScores) {
@@ -642,16 +649,16 @@ public class IndexSearcher {
     return topDocs;
   }
 
- /**
-  * Lower-level search API.
-  * Search all leaves using the given {@link CollectorManager}. In contrast
-  * to {@link #search(Query, Collector)}, this method will use the searcher's
-  * {@link Executor} in order to parallelize execution of the collection
-  * on the configured {@link #leafSlices}.
-  * @see CollectorManager
-  * @lucene.experimental
-  */
-  public <C extends Collector, T> T search(Query query, CollectorManager<C, T> collectorManager) throws IOException {
+  /**
+   * Lower-level search API. Search all leaves using the given {@link CollectorManager}. In contrast
+   * to {@link #search(Query, Collector)}, this method will use the searcher's {@link Executor} in
+   * order to parallelize execution of the collection on the configured {@link #leafSlices}.
+   *
+   * @see CollectorManager
+   * @lucene.experimental
+   */
+  public <C extends Collector, T> T search(Query query, CollectorManager<C, T> collectorManager)
+      throws IOException {
     if (executor == null || leafSlices.length <= 1) {
       final C collector = collectorManager.newCollector();
       search(query, collector);
@@ -665,7 +672,8 @@ public class IndexSearcher {
         if (scoreMode == null) {
           scoreMode = collector.scoreMode();
         } else if (scoreMode != collector.scoreMode()) {
-          throw new IllegalStateException("CollectorManager does not always produce collectors with the same score mode");
+          throw new IllegalStateException(
+              "CollectorManager does not always produce collectors with the same score mode");
         }
       }
       if (scoreMode == null) {
@@ -678,10 +686,12 @@ public class IndexSearcher {
       for (int i = 0; i < leafSlices.length; ++i) {
         final LeafReaderContext[] leaves = leafSlices[i].leaves;
         final C collector = collectors.get(i);
-        FutureTask<C> task = new FutureTask<>(() -> {
-          search(Arrays.asList(leaves), weight, collector);
-          return collector;
-        });
+        FutureTask<C> task =
+            new FutureTask<>(
+                () -> {
+                  search(Arrays.asList(leaves), weight, collector);
+                  return collector;
+                });
 
         listTasks.add(task);
       }
@@ -703,22 +713,17 @@ public class IndexSearcher {
 
   /**
    * Lower-level search API.
-   * 
-   * <p>
-   * {@link LeafCollector#collect(int)} is called for every document. <br>
-   * 
-   * <p>
-   * NOTE: this method executes the searches on all given leaves exclusively.
-   * To search across all the searchers leaves use {@link #leafContexts}.
-   * 
-   * @param leaves 
-   *          the searchers leaves to execute the searches on
-   * @param weight
-   *          to match documents
-   * @param collector
-   *          to receive hits
-   * @throws TooManyClauses If a query would exceed
-   *         {@link IndexSearcher#getMaxClauseCount()} clauses.
+   *
+   * <p>{@link LeafCollector#collect(int)} is called for every document. <br>
+   *
+   * <p>NOTE: this method executes the searches on all given leaves exclusively. To search across
+   * all the searchers leaves use {@link #leafContexts}.
+   *
+   * @param leaves the searchers leaves to execute the searches on
+   * @param weight to match documents
+   * @param collector to receive hits
+   * @throws TooManyClauses If a query would exceed {@link IndexSearcher#getMaxClauseCount()}
+   *     clauses.
    */
   protected void search(List<LeafReaderContext> leaves, Weight weight, Collector collector)
       throws IOException {
@@ -747,24 +752,27 @@ public class IndexSearcher {
     }
   }
 
-  /** Expert: called to re-write queries into primitive queries.
-   * @throws TooManyClauses If a query would exceed
-   *         {@link IndexSearcher#getMaxClauseCount()} clauses.
+  /**
+   * Expert: called to re-write queries into primitive queries.
+   *
+   * @throws TooManyClauses If a query would exceed {@link IndexSearcher#getMaxClauseCount()}
+   *     clauses.
    */
   public Query rewrite(Query original) throws IOException {
     Query query = original;
-    for (Query rewrittenQuery = query.rewrite(reader); rewrittenQuery != query;
-         rewrittenQuery = query.rewrite(reader)) {
+    for (Query rewrittenQuery = query.rewrite(reader);
+        rewrittenQuery != query;
+        rewrittenQuery = query.rewrite(reader)) {
       query = rewrittenQuery;
     }
     query.visit(getNumClausesCheckVisitor());
     return query;
   }
 
-  /** Returns a QueryVisitor which recursively checks the total
-   * number of clauses that a query and its children cumulatively
-   * have and validates that the total number does not exceed
-   * the specified limit
+  /**
+   * Returns a QueryVisitor which recursively checks the total number of clauses that a query and
+   * its children cumulatively have and validates that the total number does not exceed the
+   * specified limit
    */
   private static QueryVisitor getNumClausesCheckVisitor() {
     return new QueryVisitor() {
@@ -794,7 +802,8 @@ public class IndexSearcher {
       }
 
       @Override
-      public void consumeTermsMatching(Query query, String field, Supplier<ByteRunAutomaton> automaton) {
+      public void consumeTermsMatching(
+          Query query, String field, Supplier<ByteRunAutomaton> automaton) {
         if (numClauses > maxClauseCount) {
           throw new TooManyClauses();
         }
@@ -803,30 +812,30 @@ public class IndexSearcher {
     };
   }
 
-  /** Returns an Explanation that describes how <code>doc</code> scored against
-   * <code>query</code>.
+  /**
+   * Returns an Explanation that describes how <code>doc</code> scored against <code>query</code>.
    *
-   * <p>This is intended to be used in developing Similarity implementations,
-   * and, for good performance, should not be displayed with every hit.
-   * Computing an explanation is as expensive as executing the query over the
-   * entire index.
+   * <p>This is intended to be used in developing Similarity implementations, and, for good
+   * performance, should not be displayed with every hit. Computing an explanation is as expensive
+   * as executing the query over the entire index.
    */
   public Explanation explain(Query query, int doc) throws IOException {
     query = rewrite(query);
     return explain(createWeight(query, ScoreMode.COMPLETE, 1), doc);
   }
 
-  /** Expert: low-level implementation method
-   * Returns an Explanation that describes how <code>doc</code> scored against
-   * <code>weight</code>.
+  /**
+   * Expert: low-level implementation method Returns an Explanation that describes how <code>doc
+   * </code> scored against <code>weight</code>.
+   *
+   * <p>This is intended to be used in developing Similarity implementations, and, for good
+   * performance, should not be displayed with every hit. Computing an explanation is as expensive
+   * as executing the query over the entire index.
    *
-   * <p>This is intended to be used in developing Similarity implementations,
-   * and, for good performance, should not be displayed with every hit.
-   * Computing an explanation is as expensive as executing the query over the
-   * entire index.
    * <p>Applications should call {@link IndexSearcher#explain(Query, int)}.
-   * @throws TooManyClauses If a query would exceed
-   *         {@link IndexSearcher#getMaxClauseCount()} clauses.
+   *
+   * @throws TooManyClauses If a query would exceed {@link IndexSearcher#getMaxClauseCount()}
+   *     clauses.
    */
   protected Explanation explain(Weight weight, int doc) throws IOException {
     int n = ReaderUtil.subIndex(doc, leafContexts);
@@ -840,8 +849,9 @@ public class IndexSearcher {
   }
 
   /**
-   * Creates a {@link Weight} for the given query, potentially adding caching
-   * if possible and configured.
+   * Creates a {@link Weight} for the given query, potentially adding caching if possible and
+   * configured.
+   *
    * @lucene.experimental
    */
   public Weight createWeight(Query query, ScoreMode scoreMode, float boost) throws IOException {
@@ -855,6 +865,7 @@ public class IndexSearcher {
 
   /**
    * Returns this searchers the top-level {@link IndexReaderContext}.
+   *
    * @see IndexReader#getContext()
    */
   /* sugar for #getReader().getTopReaderContext() */
@@ -863,18 +874,20 @@ public class IndexSearcher {
   }
 
   /**
-   * A class holding a subset of the {@link IndexSearcher}s leaf contexts to be
-   * executed within a single thread.
-   * 
+   * A class holding a subset of the {@link IndexSearcher}s leaf contexts to be executed within a
+   * single thread.
+   *
    * @lucene.experimental
    */
   public static class LeafSlice {
 
-    /** The leaves that make up this slice.
+    /**
+     * The leaves that make up this slice.
      *
-     *  @lucene.experimental */
+     * @lucene.experimental
+     */
     public final LeafReaderContext[] leaves;
-    
+
     public LeafSlice(List<LeafReaderContext> leavesList) {
       Collections.sort(leavesList, Comparator.comparingInt(l -> l.docBase));
       this.leaves = leavesList.toArray(new LeafReaderContext[0]);
@@ -883,32 +896,39 @@ public class IndexSearcher {
 
   @Override
   public String toString() {
-    return "IndexSearcher(" + reader + "; executor=" + executor + "; sliceExecutionControlPlane " + sliceExecutor + ")";
+    return "IndexSearcher("
+        + reader
+        + "; executor="
+        + executor
+        + "; sliceExecutionControlPlane "
+        + sliceExecutor
+        + ")";
   }
-  
+
   /**
    * Returns {@link TermStatistics} for a term.
-   * 
-   * This can be overridden for example, to return a term's statistics
-   * across a distributed collection.
+   *
+   * <p>This can be overridden for example, to return a term's statistics across a distributed
+   * collection.
    *
    * @param docFreq The document frequency of the term. It must be greater or equal to 1.
    * @param totalTermFreq The total term frequency.
    * @return A {@link TermStatistics} (never null).
-   *
    * @lucene.experimental
    */
-  public TermStatistics termStatistics(Term term, int docFreq, long totalTermFreq) throws IOException {
+  public TermStatistics termStatistics(Term term, int docFreq, long totalTermFreq)
+      throws IOException {
     // This constructor will throw an exception if docFreq <= 0.
     return new TermStatistics(term.bytes(), docFreq, totalTermFreq);
   }
-  
+
   /**
-   * Returns {@link CollectionStatistics} for a field, or {@code null} if
-   * the field does not exist (has no indexed terms)
-   * 
-   * This can be overridden for example, to return a field's statistics
-   * across a distributed collection.
+   * Returns {@link CollectionStatistics} for a field, or {@code null} if the field does not exist
+   * (has no indexed terms)
+   *
+   * <p>This can be overridden for example, to return a field's statistics across a distributed
+   * collection.
+   *
    * @lucene.experimental
    */
   public CollectionStatistics collectionStatistics(String field) throws IOException {
@@ -931,17 +951,15 @@ public class IndexSearcher {
     return new CollectionStatistics(field, reader.maxDoc(), docCount, sumTotalTermFreq, sumDocFreq);
   }
 
-  /**
-   * Returns this searchers executor or <code>null</code> if no executor was provided
-   */
+  /** Returns this searchers executor or <code>null</code> if no executor was provided */
   public Executor getExecutor() {
     return executor;
   }
 
-  /** Thrown when an attempt is made to add more than {@link
-   * #getMaxClauseCount()} clauses. This typically happens if
-   * a PrefixQuery, FuzzyQuery, WildcardQuery, or TermRangeQuery
-   * is expanded to many terms during search.
+  /**
+   * Thrown when an attempt is made to add more than {@link #getMaxClauseCount()} clauses. This
+   * typically happens if a PrefixQuery, FuzzyQuery, WildcardQuery, or TermRangeQuery is expanded to
+   * many terms during search.
    */
   public static class TooManyClauses extends RuntimeException {
     public TooManyClauses() {
@@ -949,9 +967,7 @@ public class IndexSearcher {
     }
   }
 
-  /**
-   * Return the SliceExecutionControlPlane instance to be used for this IndexSearcher instance
-   */
+  /** Return the SliceExecutionControlPlane instance to be used for this IndexSearcher instance */
   private static SliceExecutor getSliceExecutionControlPlane(Executor executor) {
     if (executor == null) {
       return null;
diff --git a/lucene/core/src/java/org/apache/lucene/search/LRUQueryCache.java b/lucene/core/src/java/org/apache/lucene/search/LRUQueryCache.java
index 2656071..1592836 100644
--- a/lucene/core/src/java/org/apache/lucene/search/LRUQueryCache.java
+++ b/lucene/core/src/java/org/apache/lucene/search/LRUQueryCache.java
@@ -16,6 +16,9 @@
  */
 package org.apache.lucene.search;
 
+import static org.apache.lucene.util.RamUsageEstimator.HASHTABLE_RAM_BYTES_PER_ENTRY;
+import static org.apache.lucene.util.RamUsageEstimator.LINKED_HASHTABLE_RAM_BYTES_PER_ENTRY;
+import static org.apache.lucene.util.RamUsageEstimator.QUERY_DEFAULT_RAM_BYTES_USED;
 
 import java.io.IOException;
 import java.util.ArrayList;
@@ -31,7 +34,6 @@ import java.util.Set;
 import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.locks.ReentrantLock;
 import java.util.function.Predicate;
-
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.IndexReaderContext;
 import org.apache.lucene.index.LeafReaderContext;
@@ -43,24 +45,19 @@ import org.apache.lucene.util.BitDocIdSet;
 import org.apache.lucene.util.FixedBitSet;
 import org.apache.lucene.util.RoaringDocIdSet;
 
-import static org.apache.lucene.util.RamUsageEstimator.HASHTABLE_RAM_BYTES_PER_ENTRY;
-import static org.apache.lucene.util.RamUsageEstimator.LINKED_HASHTABLE_RAM_BYTES_PER_ENTRY;
-import static org.apache.lucene.util.RamUsageEstimator.QUERY_DEFAULT_RAM_BYTES_USED;
-
 /**
- * A {@link QueryCache} that evicts queries using a LRU (least-recently-used)
- * eviction policy in order to remain under a given maximum size and number of
- * bytes used.
+ * A {@link QueryCache} that evicts queries using a LRU (least-recently-used) eviction policy in
+ * order to remain under a given maximum size and number of bytes used.
  *
- * This class is thread-safe.
+ * <p>This class is thread-safe.
  *
- * Note that query eviction runs in linear time with the total number of
- * segments that have cache entries so this cache works best with
- * {@link QueryCachingPolicy caching policies} that only cache on "large"
- * segments, and it is advised to not share this cache across too many indices.
+ * <p>Note that query eviction runs in linear time with the total number of segments that have cache
+ * entries so this cache works best with {@link QueryCachingPolicy caching policies} that only cache
+ * on "large" segments, and it is advised to not share this cache across too many indices.
+ *
+ * <p>A default query cache and policy instance is used in IndexSearcher. If you want to replace
+ * those defaults it is typically done like this:
  *
- * A default query cache and policy instance is used in IndexSearcher. If you want to replace those defaults
- * it is typically done like this:
  * <pre class="prettyprint">
  *   final int maxNumberOfCachedQueries = 256;
  *   final long maxRamBytesUsed = 50 * 1024L * 1024L; // 50MB
@@ -72,17 +69,15 @@ import static org.apache.lucene.util.RamUsageEstimator.QUERY_DEFAULT_RAM_BYTES_U
  *   indexSearcher.setQueryCachingPolicy(defaultCachingPolicy);
  * </pre>
  *
- * This cache exposes some global statistics ({@link #getHitCount() hit count},
- * {@link #getMissCount() miss count}, {@link #getCacheSize() number of cache
- * entries}, {@link #getCacheCount() total number of DocIdSets that have ever
- * been cached}, {@link #getEvictionCount() number of evicted entries}). In
- * case you would like to have more fine-grained statistics, such as per-index
- * or per-query-class statistics, it is possible to override various callbacks:
- * {@link #onHit}, {@link #onMiss},
- * {@link #onQueryCache}, {@link #onQueryEviction},
- * {@link #onDocIdSetCache}, {@link #onDocIdSetEviction} and {@link #onClear}.
- * It is better to not perform heavy computations in these methods though since
- * they are called synchronously and under a lock.
+ * This cache exposes some global statistics ({@link #getHitCount() hit count}, {@link
+ * #getMissCount() miss count}, {@link #getCacheSize() number of cache entries}, {@link
+ * #getCacheCount() total number of DocIdSets that have ever been cached}, {@link
+ * #getEvictionCount() number of evicted entries}). In case you would like to have more fine-grained
+ * statistics, such as per-index or per-query-class statistics, it is possible to override various
+ * callbacks: {@link #onHit}, {@link #onMiss}, {@link #onQueryCache}, {@link #onQueryEviction},
+ * {@link #onDocIdSetCache}, {@link #onDocIdSetEviction} and {@link #onClear}. It is better to not
+ * perform heavy computations in these methods though since they are called synchronously and under
+ * a lock.
  *
  * @see QueryCachingPolicy
  * @lucene.experimental
@@ -112,20 +107,24 @@ public class LRUQueryCache implements QueryCache, Accountable {
   private volatile long cacheSize;
 
   /**
-   * Expert: Create a new instance that will cache at most <code>maxSize</code>
-   * queries with at most <code>maxRamBytesUsed</code> bytes of memory, only on
-   * leaves that satisfy {@code leavesToCache}.
+   * Expert: Create a new instance that will cache at most <code>maxSize</code> queries with at most
+   * <code>maxRamBytesUsed</code> bytes of memory, only on leaves that satisfy {@code
+   * leavesToCache}.
    *
-   * Also, clauses whose cost is {@code skipCacheFactor} times more than the cost of the top-level query
-   * will not be cached in order to not slow down queries too much.
+   * <p>Also, clauses whose cost is {@code skipCacheFactor} times more than the cost of the
+   * top-level query will not be cached in order to not slow down queries too much.
    */
-  public LRUQueryCache(int maxSize, long maxRamBytesUsed,
-                       Predicate<LeafReaderContext> leavesToCache, float skipCacheFactor) {
+  public LRUQueryCache(
+      int maxSize,
+      long maxRamBytesUsed,
+      Predicate<LeafReaderContext> leavesToCache,
+      float skipCacheFactor) {
     this.maxSize = maxSize;
     this.maxRamBytesUsed = maxRamBytesUsed;
     this.leavesToCache = leavesToCache;
     if (skipCacheFactor >= 1 == false) { // NaN >= 1 evaluates false
-      throw new IllegalArgumentException("skipCacheFactor must be no less than 1, get " + skipCacheFactor);
+      throw new IllegalArgumentException(
+          "skipCacheFactor must be no less than 1, get " + skipCacheFactor);
     }
     this.skipCacheFactor = skipCacheFactor;
 
@@ -137,17 +136,14 @@ public class LRUQueryCache implements QueryCache, Accountable {
   }
 
   /**
-   * Create a new instance that will cache at most <code>maxSize</code> queries
-   * with at most <code>maxRamBytesUsed</code> bytes of memory. Queries will
-   * only be cached on leaves that have more than 10k documents and have more
-   * than 3% of the total number of documents in the index.
-   * This should guarantee that all leaves from the upper
-   * {@link TieredMergePolicy tier} will be cached while ensuring that at most
-   * <code>33</code> leaves can make it to the cache (very likely less than 10 in
-   * practice), which is useful for this implementation since some operations
-   * perform in linear time with the number of cached leaves.
-   * Only clauses whose cost is at most 100x the cost of the top-level query will
-   * be cached in order to not hurt latency too much because of caching.
+   * Create a new instance that will cache at most <code>maxSize</code> queries with at most <code>
+   * maxRamBytesUsed</code> bytes of memory. Queries will only be cached on leaves that have more
+   * than 10k documents and have more than 3% of the total number of documents in the index. This
+   * should guarantee that all leaves from the upper {@link TieredMergePolicy tier} will be cached
+   * while ensuring that at most <code>33</code> leaves can make it to the cache (very likely less
+   * than 10 in practice), which is useful for this implementation since some operations perform in
+   * linear time with the number of cached leaves. Only clauses whose cost is at most 100x the cost
+   * of the top-level query will be cached in order to not hurt latency too much because of caching.
    */
   public LRUQueryCache(int maxSize, long maxRamBytesUsed) {
     this(maxSize, maxRamBytesUsed, new MinSegmentSizePredicate(10000, .03f), 250);
@@ -176,9 +172,9 @@ public class LRUQueryCache implements QueryCache, Accountable {
   }
 
   /**
-   * Expert: callback when there is a cache hit on a given query.
-   * Implementing this method is typically useful in order to compute more
-   * fine-grained statistics about the query cache.
+   * Expert: callback when there is a cache hit on a given query. Implementing this method is
+   * typically useful in order to compute more fine-grained statistics about the query cache.
+   *
    * @see #onMiss
    * @lucene.experimental
    */
@@ -189,6 +185,7 @@ public class LRUQueryCache implements QueryCache, Accountable {
 
   /**
    * Expert: callback when there is a cache miss on a given query.
+   *
    * @see #onHit
    * @lucene.experimental
    */
@@ -199,9 +196,9 @@ public class LRUQueryCache implements QueryCache, Accountable {
   }
 
   /**
-   * Expert: callback when a query is added to this cache.
-   * Implementing this method is typically useful in order to compute more
-   * fine-grained statistics about the query cache.
+   * Expert: callback when a query is added to this cache. Implementing this method is typically
+   * useful in order to compute more fine-grained statistics about the query cache.
+   *
    * @see #onQueryEviction
    * @lucene.experimental
    */
@@ -212,6 +209,7 @@ public class LRUQueryCache implements QueryCache, Accountable {
 
   /**
    * Expert: callback when a query is evicted from this cache.
+   *
    * @see #onQueryCache
    * @lucene.experimental
    */
@@ -221,9 +219,9 @@ public class LRUQueryCache implements QueryCache, Accountable {
   }
 
   /**
-   * Expert: callback when a {@link DocIdSet} is added to this cache.
-   * Implementing this method is typically useful in order to compute more
-   * fine-grained statistics about the query cache.
+   * Expert: callback when a {@link DocIdSet} is added to this cache. Implementing this method is
+   * typically useful in order to compute more fine-grained statistics about the query cache.
+   *
    * @see #onDocIdSetEviction
    * @lucene.experimental
    */
@@ -235,8 +233,8 @@ public class LRUQueryCache implements QueryCache, Accountable {
   }
 
   /**
-   * Expert: callback when one or more {@link DocIdSet}s are removed from this
-   * cache.
+   * Expert: callback when one or more {@link DocIdSet}s are removed from this cache.
+   *
    * @see #onDocIdSetCache
    * @lucene.experimental
    */
@@ -248,6 +246,7 @@ public class LRUQueryCache implements QueryCache, Accountable {
 
   /**
    * Expert: callback when the cache is completely cleared.
+   *
    * @lucene.experimental
    */
   protected void onClear() {
@@ -334,19 +333,21 @@ public class LRUQueryCache implements QueryCache, Accountable {
         if (size == mostRecentlyUsedQueries.size()) {
           // size did not decrease, because the hash of the query changed since it has been
           // put into the cache
-          throw new ConcurrentModificationException("Removal from the cache failed! This " +
-              "is probably due to a query which has been modified after having been put into " +
-              " the cache or a badly implemented clone(). Query class: [" + query.getClass() +
-              "], query: [" + query + "]");
+          throw new ConcurrentModificationException(
+              "Removal from the cache failed! This "
+                  + "is probably due to a query which has been modified after having been put into "
+                  + " the cache or a badly implemented clone(). Query class: ["
+                  + query.getClass()
+                  + "], query: ["
+                  + query
+                  + "]");
         }
         onEviction(query);
       } while (iterator.hasNext() && requiresEviction());
     }
   }
 
-  /**
-   * Remove all cache entries for the given core cache key.
-   */
+  /** Remove all cache entries for the given core cache key. */
   public void clearCoreCacheKey(Object coreKey) {
     lock.lock();
     try {
@@ -366,9 +367,7 @@ public class LRUQueryCache implements QueryCache, Accountable {
     }
   }
 
-  /**
-   * Remove all cache entries for the given query.
-   */
+  /** Remove all cache entries for the given query. */
   public void clearQuery(Query query) {
     lock.lock();
     try {
@@ -389,14 +388,13 @@ public class LRUQueryCache implements QueryCache, Accountable {
     }
   }
 
-  /**
-   * Clear the content of this cache.
-   */
+  /** Clear the content of this cache. */
   public void clear() {
     lock.lock();
     try {
       cache.clear();
-      // Note that this also clears the uniqueQueries map since mostRecentlyUsedQueries is the uniqueQueries.keySet view:
+      // Note that this also clears the uniqueQueries map since mostRecentlyUsedQueries is the
+      // uniqueQueries.keySet view:
       mostRecentlyUsedQueries.clear();
       onClear();
     } finally {
@@ -409,20 +407,28 @@ public class LRUQueryCache implements QueryCache, Accountable {
     lock.lock();
     try {
       if (requiresEviction()) {
-        throw new AssertionError("requires evictions: size=" + mostRecentlyUsedQueries.size()
-            + ", maxSize=" + maxSize + ", ramBytesUsed=" + ramBytesUsed() + ", maxRamBytesUsed=" + maxRamBytesUsed);
+        throw new AssertionError(
+            "requires evictions: size="
+                + mostRecentlyUsedQueries.size()
+                + ", maxSize="
+                + maxSize
+                + ", ramBytesUsed="
+                + ramBytesUsed()
+                + ", maxRamBytesUsed="
+                + maxRamBytesUsed);
       }
       for (LeafCache leafCache : cache.values()) {
         Set<Query> keys = Collections.newSetFromMap(new IdentityHashMap<>());
         keys.addAll(leafCache.cache.keySet());
         keys.removeAll(mostRecentlyUsedQueries);
         if (!keys.isEmpty()) {
-          throw new AssertionError("One leaf cache contains more keys than the top-level cache: " + keys);
+          throw new AssertionError(
+              "One leaf cache contains more keys than the top-level cache: " + keys);
         }
       }
       long recomputedRamBytesUsed =
-            HASHTABLE_RAM_BYTES_PER_ENTRY * cache.size()
-          + LINKED_HASHTABLE_RAM_BYTES_PER_ENTRY * uniqueQueries.size();
+          HASHTABLE_RAM_BYTES_PER_ENTRY * cache.size()
+              + LINKED_HASHTABLE_RAM_BYTES_PER_ENTRY * uniqueQueries.size();
       recomputedRamBytesUsed += mostRecentlyUsedQueries.size() * QUERY_DEFAULT_RAM_BYTES_USED;
       for (LeafCache leafCache : cache.values()) {
         recomputedRamBytesUsed += HASHTABLE_RAM_BYTES_PER_ENTRY * leafCache.cache.size();
@@ -431,7 +437,8 @@ public class LRUQueryCache implements QueryCache, Accountable {
         }
       }
       if (recomputedRamBytesUsed != ramBytesUsed) {
-        throw new AssertionError("ramBytesUsed mismatch : " + ramBytesUsed + " != " + recomputedRamBytesUsed);
+        throw new AssertionError(
+            "ramBytesUsed mismatch : " + ramBytesUsed + " != " + recomputedRamBytesUsed);
       }
 
       long recomputedCacheSize = 0;
@@ -439,7 +446,8 @@ public class LRUQueryCache implements QueryCache, Accountable {
         recomputedCacheSize += leafCache.cache.size();
       }
       if (recomputedCacheSize != getCacheSize()) {
-        throw new AssertionError("cacheSize mismatch : " + getCacheSize() + " != " + recomputedCacheSize);
+        throw new AssertionError(
+            "cacheSize mismatch : " + getCacheSize() + " != " + recomputedCacheSize);
       }
     } finally {
       lock.unlock();
@@ -482,9 +490,8 @@ public class LRUQueryCache implements QueryCache, Accountable {
   }
 
   /**
-   * Default cache implementation: uses {@link RoaringDocIdSet} for sets that
-   * have a density &lt; 1% and a {@link BitDocIdSet} over a {@link FixedBitSet}
-   * otherwise.
+   * Default cache implementation: uses {@link RoaringDocIdSet} for sets that have a density &lt; 1%
+   * and a {@link BitDocIdSet} over a {@link FixedBitSet} otherwise.
    */
   protected DocIdSet cacheImpl(BulkScorer scorer, int maxDoc) throws IOException {
     if (scorer.cost() * 100 >= maxDoc) {
@@ -499,44 +506,47 @@ public class LRUQueryCache implements QueryCache, Accountable {
   private static DocIdSet cacheIntoBitSet(BulkScorer scorer, int maxDoc) throws IOException {
     final FixedBitSet bitSet = new FixedBitSet(maxDoc);
     long cost[] = new long[1];
-    scorer.score(new LeafCollector() {
+    scorer.score(
+        new LeafCollector() {
 
-      @Override
-      public void setScorer(Scorable scorer) throws IOException {}
-
-      @Override
-      public void collect(int doc) throws IOException {
-        cost[0]++;
-        bitSet.set(doc);
-      }
+          @Override
+          public void setScorer(Scorable scorer) throws IOException {}
 
-    }, null);
+          @Override
+          public void collect(int doc) throws IOException {
+            cost[0]++;
+            bitSet.set(doc);
+          }
+        },
+        null);
     return new BitDocIdSet(bitSet, cost[0]);
   }
 
-  private static DocIdSet cacheIntoRoaringDocIdSet(BulkScorer scorer, int maxDoc) throws IOException {
+  private static DocIdSet cacheIntoRoaringDocIdSet(BulkScorer scorer, int maxDoc)
+      throws IOException {
     RoaringDocIdSet.Builder builder = new RoaringDocIdSet.Builder(maxDoc);
-    scorer.score(new LeafCollector() {
-
-      @Override
-      public void setScorer(Scorable scorer) throws IOException {}
+    scorer.score(
+        new LeafCollector() {
 
-      @Override
-      public void collect(int doc) throws IOException {
-        builder.add(doc);
-      }
+          @Override
+          public void setScorer(Scorable scorer) throws IOException {}
 
-    }, null);
+          @Override
+          public void collect(int doc) throws IOException {
+            builder.add(doc);
+          }
+        },
+        null);
     return builder.build();
   }
 
   /**
-   * Return the total number of times that a {@link Query} has been looked up
-   * in this {@link QueryCache}. Note that this number is incremented once per
-   * segment so running a cached query only once will increment this counter
-   * by the number of segments that are wrapped by the searcher.
-   * Note that by definition, {@link #getTotalCount()} is the sum of
-   * {@link #getHitCount()} and {@link #getMissCount()}.
+   * Return the total number of times that a {@link Query} has been looked up in this {@link
+   * QueryCache}. Note that this number is incremented once per segment so running a cached query
+   * only once will increment this counter by the number of segments that are wrapped by the
+   * searcher. Note that by definition, {@link #getTotalCount()} is the sum of {@link
+   * #getHitCount()} and {@link #getMissCount()}.
+   *
    * @see #getHitCount()
    * @see #getMissCount()
    */
@@ -545,9 +555,9 @@ public class LRUQueryCache implements QueryCache, Accountable {
   }
 
   /**
-   * Over the {@link #getTotalCount() total} number of times that a query has
-   * been looked up, return how many times a cached {@link DocIdSet} has been
-   * found and returned.
+   * Over the {@link #getTotalCount() total} number of times that a query has been looked up, return
+   * how many times a cached {@link DocIdSet} has been found and returned.
+   *
    * @see #getTotalCount()
    * @see #getMissCount()
    */
@@ -556,9 +566,9 @@ public class LRUQueryCache implements QueryCache, Accountable {
   }
 
   /**
-   * Over the {@link #getTotalCount() total} number of times that a query has
-   * been looked up, return how many times this query was not contained in the
-   * cache.
+   * Over the {@link #getTotalCount() total} number of times that a query has been looked up, return
+   * how many times this query was not contained in the cache.
+   *
    * @see #getTotalCount()
    * @see #getHitCount()
    */
@@ -567,8 +577,8 @@ public class LRUQueryCache implements QueryCache, Accountable {
   }
 
   /**
-   * Return the total number of {@link DocIdSet}s which are currently stored
-   * in the cache.
+   * Return the total number of {@link DocIdSet}s which are currently stored in the cache.
+   *
    * @see #getCacheCount()
    * @see #getEvictionCount()
    */
@@ -577,11 +587,11 @@ public class LRUQueryCache implements QueryCache, Accountable {
   }
 
   /**
-   * Return the total number of cache entries that have been generated and put
-   * in the cache. It is highly desirable to have a {@link #getHitCount() hit
-   * count} that is much higher than the {@link #getCacheCount() cache count}
-   * as the opposite would indicate that the query cache makes efforts in order
-   * to cache queries but then they do not get reused.
+   * Return the total number of cache entries that have been generated and put in the cache. It is
+   * highly desirable to have a {@link #getHitCount() hit count} that is much higher than the {@link
+   * #getCacheCount() cache count} as the opposite would indicate that the query cache makes efforts
+   * in order to cache queries but then they do not get reused.
+   *
    * @see #getCacheSize()
    * @see #getEvictionCount()
    */
@@ -590,12 +600,12 @@ public class LRUQueryCache implements QueryCache, Accountable {
   }
 
   /**
-   * Return the number of cache entries that have been removed from the cache
-   * either in order to stay under the maximum configured size/ram usage, or
-   * because a segment has been closed. High numbers of evictions might mean
-   * that queries are not reused or that the {@link QueryCachingPolicy
-   * caching policy} caches too aggressively on NRT segments which get merged
+   * Return the number of cache entries that have been removed from the cache either in order to
+   * stay under the maximum configured size/ram usage, or because a segment has been closed. High
+   * numbers of evictions might mean that queries are not reused or that the {@link
+   * QueryCachingPolicy caching policy} caches too aggressively on NRT segments which get merged
    * early.
+   *
    * @see #getCacheCount()
    * @see #getCacheSize()
    */
@@ -654,7 +664,6 @@ public class LRUQueryCache implements QueryCache, Accountable {
     public long ramBytesUsed() {
       return ramBytesUsed;
     }
-
   }
 
   private class CachingWrapperWeight extends ConstantScoreWeight {
@@ -700,7 +709,8 @@ public class LRUQueryCache implements QueryCache, Accountable {
 
     /** Check whether this segment is eligible for caching, regardless of the query. */
     private boolean shouldCache(LeafReaderContext context) throws IOException {
-      return cacheEntryHasReasonableWorstCaseSize(ReaderUtil.getTopLevelContext(context).reader().maxDoc())
+      return cacheEntryHasReasonableWorstCaseSize(
+              ReaderUtil.getTopLevelContext(context).reader().maxDoc())
           && leavesToCache.test(context);
     }
 
@@ -757,15 +767,18 @@ public class LRUQueryCache implements QueryCache, Accountable {
               }
 
               Scorer scorer = supplier.get(Long.MAX_VALUE);
-              DocIdSet docIdSet = cacheImpl(new DefaultBulkScorer(scorer), context.reader().maxDoc());
+              DocIdSet docIdSet =
+                  cacheImpl(new DefaultBulkScorer(scorer), context.reader().maxDoc());
               putIfAbsent(in.getQuery(), docIdSet, cacheHelper);
               DocIdSetIterator disi = docIdSet.iterator();
               if (disi == null) {
-                // docIdSet.iterator() is allowed to return null when empty but we want a non-null iterator here
+                // docIdSet.iterator() is allowed to return null when empty but we want a non-null
+                // iterator here
                 disi = DocIdSetIterator.empty();
               }
 
-              return new ConstantScoreScorer(CachingWrapperWeight.this, 0f, ScoreMode.COMPLETE_NO_SCORES, disi);
+              return new ConstantScoreScorer(
+                  CachingWrapperWeight.this, 0f, ScoreMode.COMPLETE_NO_SCORES, disi);
             }
 
             @Override
@@ -790,7 +803,8 @@ public class LRUQueryCache implements QueryCache, Accountable {
       return new ScorerSupplier() {
         @Override
         public Scorer get(long LeadCost) throws IOException {
-          return new ConstantScoreScorer(CachingWrapperWeight.this, 0f, ScoreMode.COMPLETE_NO_SCORES, disi);
+          return new ConstantScoreScorer(
+              CachingWrapperWeight.this, 0f, ScoreMode.COMPLETE_NO_SCORES, disi);
         }
 
         @Override
@@ -798,7 +812,6 @@ public class LRUQueryCache implements QueryCache, Accountable {
           return disi.cost();
         }
       };
-
     }
 
     @Override
@@ -868,8 +881,8 @@ public class LRUQueryCache implements QueryCache, Accountable {
         return null;
       }
 
-      return new DefaultBulkScorer(new ConstantScoreScorer(this, 0f, ScoreMode.COMPLETE_NO_SCORES, disi));
+      return new DefaultBulkScorer(
+          new ConstantScoreScorer(this, 0f, ScoreMode.COMPLETE_NO_SCORES, disi));
     }
-
   }
 }
diff --git a/lucene/core/src/java/org/apache/lucene/search/LeafCollector.java b/lucene/core/src/java/org/apache/lucene/search/LeafCollector.java
index 82f78ee..983e5bb 100644
--- a/lucene/core/src/java/org/apache/lucene/search/LeafCollector.java
+++ b/lucene/core/src/java/org/apache/lucene/search/LeafCollector.java
@@ -16,28 +16,20 @@
  */
 package org.apache.lucene.search;
 
-
 import java.io.IOException;
 
 /**
- * <p>Collector decouples the score from the collected doc:
- * the score computation is skipped entirely if it's not
- * needed.  Collectors that do need the score should
- * implement the {@link #setScorer} method, to hold onto the
- * passed {@link Scorer} instance, and call {@link
- * Scorer#score()} within the collect method to compute the
- * current hit's score.  If your collector may request the
- * score for a single hit multiple times, you should use
- * {@link ScoreCachingWrappingScorer}. </p>
- * 
- * <p><b>NOTE:</b> The doc that is passed to the collect
- * method is relative to the current reader. If your
- * collector needs to resolve this to the docID space of the
- * Multi*Reader, you must re-base it by recording the
- * docBase from the most recent setNextReader call.  Here's
- * a simple example showing how to collect docIDs into a
- * BitSet:</p>
- * 
+ * Collector decouples the score from the collected doc: the score computation is skipped entirely
+ * if it's not needed. Collectors that do need the score should implement the {@link #setScorer}
+ * method, to hold onto the passed {@link Scorer} instance, and call {@link Scorer#score()} within
+ * the collect method to compute the current hit's score. If your collector may request the score
+ * for a single hit multiple times, you should use {@link ScoreCachingWrappingScorer}.
+ *
+ * <p><b>NOTE:</b> The doc that is passed to the collect method is relative to the current reader.
+ * If your collector needs to resolve this to the docID space of the Multi*Reader, you must re-base
+ * it by recording the docBase from the most recent setNextReader call. Here's a simple example
+ * showing how to collect docIDs into a BitSet:
+ *
  * <pre class="prettyprint">
  * IndexSearcher searcher = new IndexSearcher(indexReader);
  * final BitSet bits = new BitSet(indexReader.maxDoc());
@@ -62,47 +54,45 @@ import java.io.IOException;
  * });
  * </pre>
  *
- * <p>Not all collectors will need to rebase the docID.  For
- * example, a collector that simply counts the total number
- * of hits would skip it.</p>
+ * <p>Not all collectors will need to rebase the docID. For example, a collector that simply counts
+ * the total number of hits would skip it.
  *
  * @lucene.experimental
  */
 public interface LeafCollector {
 
   /**
-   * Called before successive calls to {@link #collect(int)}. Implementations
-   * that need the score of the current document (passed-in to
-   * {@link #collect(int)}), should save the passed-in Scorer and call
-   * scorer.score() when needed.
+   * Called before successive calls to {@link #collect(int)}. Implementations that need the score of
+   * the current document (passed-in to {@link #collect(int)}), should save the passed-in Scorer and
+   * call scorer.score() when needed.
    */
   void setScorer(Scorable scorer) throws IOException;
-  
+
   /**
-   * Called once for every document matching a query, with the unbased document
-   * number.
-   * <p>Note: The collection of the current segment can be terminated by throwing
-   * a {@link CollectionTerminatedException}. In this case, the last docs of the
-   * current {@link org.apache.lucene.index.LeafReaderContext} will be skipped and {@link IndexSearcher}
-   * will swallow the exception and continue collection with the next leaf.
-   * <p>
-   * Note: This is called in an inner search loop. For good search performance,
-   * implementations of this method should not call {@link IndexSearcher#doc(int)} or
-   * {@link org.apache.lucene.index.IndexReader#document(int)} on every hit.
-   * Doing so can slow searches by an order of magnitude or more.
+   * Called once for every document matching a query, with the unbased document number.
+   *
+   * <p>Note: The collection of the current segment can be terminated by throwing a {@link
+   * CollectionTerminatedException}. In this case, the last docs of the current {@link
+   * org.apache.lucene.index.LeafReaderContext} will be skipped and {@link IndexSearcher} will
+   * swallow the exception and continue collection with the next leaf.
+   *
+   * <p>Note: This is called in an inner search loop. For good search performance, implementations
+   * of this method should not call {@link IndexSearcher#doc(int)} or {@link
+   * org.apache.lucene.index.IndexReader#document(int)} on every hit. Doing so can slow searches by
+   * an order of magnitude or more.
    */
   void collect(int doc) throws IOException;
 
   /**
    * Optionally returns an iterator over competitive documents.
    *
-   * Collectors should delegate this method to their comparators if
-   * their comparators provide the skipping functionality over non-competitive docs.
+   * <p>Collectors should delegate this method to their comparators if their comparators provide the
+   * skipping functionality over non-competitive docs.
    *
-   * The default is to return {@code null} which is interpreted as the collector provide any competitive iterator.
+   * <p>The default is to return {@code null} which is interpreted as the collector provide any
+   * competitive iterator.
    */
   default DocIdSetIterator competitiveIterator() throws IOException {
     return null;
   }
-
 }
diff --git a/lucene/core/src/java/org/apache/lucene/search/LeafFieldComparator.java b/lucene/core/src/java/org/apache/lucene/search/LeafFieldComparator.java
index 6a93658..594d882 100644
--- a/lucene/core/src/java/org/apache/lucene/search/LeafFieldComparator.java
+++ b/lucene/core/src/java/org/apache/lucene/search/LeafFieldComparator.java
@@ -16,36 +16,25 @@
  */
 package org.apache.lucene.search;
 
-
 import java.io.IOException;
 
 /**
- * Expert: comparator that gets instantiated on each leaf
- * from a top-level {@link FieldComparator} instance.
+ * Expert: comparator that gets instantiated on each leaf from a top-level {@link FieldComparator}
+ * instance.
  *
- * <p>A leaf comparator must define these functions:</p>
+ * <p>A leaf comparator must define these functions:
  *
  * <ul>
- *
- *  <li> {@link #setBottom} This method is called by
- *       {@link FieldValueHitQueue} to notify the
- *       FieldComparator of the current weakest ("bottom")
- *       slot.  Note that this slot may not hold the weakest
- *       value according to your comparator, in cases where
- *       your comparator is not the primary one (ie, is only
- *       used to break ties from the comparators before it).
- *
- *  <li> {@link #compareBottom} Compare a new hit (docID)
- *       against the "weakest" (bottom) entry in the queue.
- *
- *  <li> {@link #compareTop} Compare a new hit (docID)
- *       against the top value previously set by a call to
- *       {@link FieldComparator#setTopValue}.
- *
- *  <li> {@link #copy} Installs a new hit into the
- *       priority queue.  The {@link FieldValueHitQueue}
+ *   <li>{@link #setBottom} This method is called by {@link FieldValueHitQueue} to notify the
+ *       FieldComparator of the current weakest ("bottom") slot. Note that this slot may not hold
+ *       the weakest value according to your comparator, in cases where your comparator is not the
+ *       primary one (ie, is only used to break ties from the comparators before it).
+ *   <li>{@link #compareBottom} Compare a new hit (docID) against the "weakest" (bottom) entry in
+ *       the queue.
+ *   <li>{@link #compareTop} Compare a new hit (docID) against the top value previously set by a
+ *       call to {@link FieldComparator#setTopValue}.
+ *   <li>{@link #copy} Installs a new hit into the priority queue. The {@link FieldValueHitQueue}
  *       calls this method when a new hit is competitive.
- *
  * </ul>
  *
  * @see FieldComparator
@@ -54,82 +43,72 @@ import java.io.IOException;
 public interface LeafFieldComparator {
 
   /**
-   * Set the bottom slot, ie the "weakest" (sorted last)
-   * entry in the queue.  When {@link #compareBottom} is
-   * called, you should compare against this slot.  This
-   * will always be called before {@link #compareBottom}.
-   * 
+   * Set the bottom slot, ie the "weakest" (sorted last) entry in the queue. When {@link
+   * #compareBottom} is called, you should compare against this slot. This will always be called
+   * before {@link #compareBottom}.
+   *
    * @param slot the currently weakest (sorted last) slot in the queue
    */
   void setBottom(final int slot) throws IOException;
 
   /**
-   * Compare the bottom of the queue with this doc.  This will
-   * only invoked after setBottom has been called.  This
-   * should return the same result as {@link
-   * FieldComparator#compare(int,int)}} as if bottom were slot1 and the new
-   * document were slot 2.
-   *    
-   * <p>For a search that hits many results, this method
-   * will be the hotspot (invoked by far the most
-   * frequently).</p>
-   * 
+   * Compare the bottom of the queue with this doc. This will only invoked after setBottom has been
+   * called. This should return the same result as {@link FieldComparator#compare(int,int)}} as if
+   * bottom were slot1 and the new document were slot 2.
+   *
+   * <p>For a search that hits many results, this method will be the hotspot (invoked by far the
+   * most frequently).
+   *
    * @param doc that was hit
-   * @return any {@code N < 0} if the doc's value is sorted after
-   * the bottom entry (not competitive), any {@code N > 0} if the
-   * doc's value is sorted before the bottom entry and {@code 0} if
-   * they are equal.
+   * @return any {@code N < 0} if the doc's value is sorted after the bottom entry (not
+   *     competitive), any {@code N > 0} if the doc's value is sorted before the bottom entry and
+   *     {@code 0} if they are equal.
    */
   int compareBottom(int doc) throws IOException;
 
   /**
-   * Compare the top value with this doc.  This will
-   * only invoked after setTopValue has been called.  This
-   * should return the same result as {@link
-   * FieldComparator#compare(int,int)}} as if topValue were slot1 and the new
-   * document were slot 2.  This is only called for searches that
-   * use searchAfter (deep paging).
-   *    
+   * Compare the top value with this doc. This will only invoked after setTopValue has been called.
+   * This should return the same result as {@link FieldComparator#compare(int,int)}} as if topValue
+   * were slot1 and the new document were slot 2. This is only called for searches that use
+   * searchAfter (deep paging).
+   *
    * @param doc that was hit
-   * @return any {@code N < 0} if the doc's value is sorted after
-   * the top entry (not competitive), any {@code N > 0} if the
-   * doc's value is sorted before the top entry and {@code 0} if
-   * they are equal.
+   * @return any {@code N < 0} if the doc's value is sorted after the top entry (not competitive),
+   *     any {@code N > 0} if the doc's value is sorted before the top entry and {@code 0} if they
+   *     are equal.
    */
   int compareTop(int doc) throws IOException;
 
   /**
-   * This method is called when a new hit is competitive.
-   * You should copy any state associated with this document
-   * that will be required for future comparisons, into the
-   * specified slot.
-   * 
+   * This method is called when a new hit is competitive. You should copy any state associated with
+   * this document that will be required for future comparisons, into the specified slot.
+   *
    * @param slot which slot to copy the hit to
    * @param doc docID relative to current reader
    */
   void copy(int slot, int doc) throws IOException;
 
-  /** Sets the Scorer to use in case a document's score is
-   *  needed.
-   * 
-   * @param scorer Scorer instance that you should use to
-   * obtain the current hit's score, if necessary. */
+  /**
+   * Sets the Scorer to use in case a document's score is needed.
+   *
+   * @param scorer Scorer instance that you should use to obtain the current hit's score, if
+   *     necessary.
+   */
   void setScorer(Scorable scorer) throws IOException;
 
   /**
    * Returns a competitive iterator
-   * @return an iterator over competitive docs that are stronger than already collected docs
-   * or {@code null} if such an iterator is not available for the current comparator or segment.
+   *
+   * @return an iterator over competitive docs that are stronger than already collected docs or
+   *     {@code null} if such an iterator is not available for the current comparator or segment.
    */
   default DocIdSetIterator competitiveIterator() throws IOException {
     return null;
   }
 
   /**
-   * Informs this leaf comparator that hits threshold is reached.
-   * This method is called from a collector when hits threshold is reached.
+   * Informs this leaf comparator that hits threshold is reached. This method is called from a
+   * collector when hits threshold is reached.
    */
-  default void setHitsThresholdReached() throws IOException{
-  }
-  
+  default void setHitsThresholdReached() throws IOException {}
 }
diff --git a/lucene/core/src/java/org/apache/lucene/search/LeafSimScorer.java b/lucene/core/src/java/org/apache/lucene/search/LeafSimScorer.java
index b65d538..5d8d2e9 100644
--- a/lucene/core/src/java/org/apache/lucene/search/LeafSimScorer.java
+++ b/lucene/core/src/java/org/apache/lucene/search/LeafSimScorer.java
@@ -18,23 +18,19 @@ package org.apache.lucene.search;
 
 import java.io.IOException;
 import java.util.Objects;
-
 import org.apache.lucene.index.LeafReader;
 import org.apache.lucene.index.NumericDocValues;
 import org.apache.lucene.search.similarities.Similarity.SimScorer;
 
-/**
- * {@link SimScorer} on a specific {@link LeafReader}.
- */
+/** {@link SimScorer} on a specific {@link LeafReader}. */
 public final class LeafSimScorer {
 
   private final SimScorer scorer;
   private final NumericDocValues norms;
 
-  /**
-   * Sole constructor: Score documents of {@code reader} with {@code scorer}.
-   */
-  public LeafSimScorer(SimScorer scorer, LeafReader reader, String field, boolean needsScores) throws IOException {
+  /** Sole constructor: Score documents of {@code reader} with {@code scorer}. */
+  public LeafSimScorer(SimScorer scorer, LeafReader reader, String field, boolean needsScores)
+      throws IOException {
     this.scorer = Objects.requireNonNull(scorer);
     norms = needsScores ? reader.getNormValues(field) : null;
   }
@@ -54,18 +50,23 @@ public final class LeafSimScorer {
     }
   }
 
-  /** Score the provided document assuming the given term document frequency.
-   *  This method must be called on non-decreasing sequences of doc ids.
-   *  @see SimScorer#score(float, long) */
+  /**
+   * Score the provided document assuming the given term document frequency. This method must be
+   * called on non-decreasing sequences of doc ids.
+   *
+   * @see SimScorer#score(float, long)
+   */
   public float score(int doc, float freq) throws IOException {
     return scorer.score(freq, getNormValue(doc));
   }
 
-  /** Explain the score for the provided document assuming the given term document frequency.
-   *  This method must be called on non-decreasing sequences of doc ids.
-   *  @see SimScorer#explain(Explanation, long) */
+  /**
+   * Explain the score for the provided document assuming the given term document frequency. This
+   * method must be called on non-decreasing sequences of doc ids.
+   *
... 61855 lines suppressed ...


[lucene-solr] 01/11: Add remaining Lucene modules so that it's known how much work is left.

Posted by dw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

dweiss pushed a commit to branch jira/LUCENE-9570
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git

commit ef62fbad2a51d186bb165ca1f4411a3ab04fe496
Author: Dawid Weiss <da...@carrotsearch.com>
AuthorDate: Wed Dec 23 10:13:46 2020 +0100

    Add remaining Lucene modules so that it's known how much work is left.
---
 gradle/validation/spotless.gradle | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/gradle/validation/spotless.gradle b/gradle/validation/spotless.gradle
index 06a1176..084b3e5 100644
--- a/gradle/validation/spotless.gradle
+++ b/gradle/validation/spotless.gradle
@@ -25,6 +25,8 @@ allprojects { prj ->
   plugins.withType(JavaPlugin) {
     prj.apply plugin: 'com.diffplug.spotless'
 
+    println "case \"" + prj.path + '"'
+
     spotless {
       java {
         // TODO: work out how to have multiple different header files (we have
@@ -73,6 +75,36 @@ allprojects { prj ->
             break
 
           // All others - disable reformatting/ checks for now.
+          case ":lucene:analysis:icu":
+          case ":lucene:analysis:kuromoji":
+          case ":lucene:analysis:morfologik":
+          case ":lucene:analysis:nori":
+          case ":lucene:analysis:opennlp":
+          case ":lucene:analysis:phonetic":
+          case ":lucene:analysis:smartcn":
+          case ":lucene:analysis:stempel":
+          case ":lucene:backward-codecs":
+          case ":lucene:benchmark":
+          case ":lucene:classification":
+          case ":lucene:codecs":
+          case ":lucene:demo":
+          case ":lucene:expressions":
+          case ":lucene:facet":
+          case ":lucene:grouping":
+          case ":lucene:join":
+          case ":lucene:luke":
+          case ":lucene:memory":
+          case ":lucene:misc":
+          case ":lucene:monitor":
+          case ":lucene:queries":
+          case ":lucene:queryparser":
+          case ":lucene:replicator":
+          case ":lucene:sandbox":
+          case ":lucene:spatial3d":
+          case ":lucene:spatial-extras":
+          case ":lucene:suggest":
+          case ":lucene:test-framework":
+
           default:
             target 'non-existing/**'
             break


[lucene-solr] 04/11: :lucene:core - src/**

Posted by dw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

dweiss pushed a commit to branch jira/LUCENE-9570
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git

commit 5bbe1f01811efbc11d984bcbddda47fe84febaac
Author: Dawid Weiss <da...@carrotsearch.com>
AuthorDate: Wed Dec 23 11:17:15 2020 +0100

    :lucene:core - src/**
---
 gradle/validation/spotless.gradle                  |   18 +-
 .../lucene50/Lucene50SkipWriter.java               |    3 +-
 .../org/apache/lucene/codecs/BlockTermState.java   |   20 +-
 .../src/java/org/apache/lucene/codecs/Codec.java   |  104 +-
 .../java/org/apache/lucene/codecs/CodecUtil.java   |  504 +++++----
 .../codecs/CompetitiveImpactAccumulator.java       |   41 +-
 .../apache/lucene/codecs/CompoundDirectory.java    |   35 +-
 .../org/apache/lucene/codecs/CompoundFormat.java   |   18 +-
 .../apache/lucene/codecs/DocValuesConsumer.java    | 1035 ++++++++---------
 .../org/apache/lucene/codecs/DocValuesFormat.java  |  106 +-
 .../apache/lucene/codecs/DocValuesProducer.java    |   74 +-
 .../org/apache/lucene/codecs/FieldInfosFormat.java |   26 +-
 .../org/apache/lucene/codecs/FieldsConsumer.java   |   78 +-
 .../org/apache/lucene/codecs/FieldsProducer.java   |   37 +-
 .../java/org/apache/lucene/codecs/FilterCodec.java |   28 +-
 .../org/apache/lucene/codecs/LiveDocsFormat.java   |   31 +-
 .../lucene/codecs/MultiLevelSkipListReader.java    |  123 +-
 .../lucene/codecs/MultiLevelSkipListWriter.java    |   78 +-
 .../apache/lucene/codecs/MutablePointValues.java   |   10 +-
 .../org/apache/lucene/codecs/NormsConsumer.java    |  228 ++--
 .../java/org/apache/lucene/codecs/NormsFormat.java |   30 +-
 .../org/apache/lucene/codecs/NormsProducer.java    |   41 +-
 .../org/apache/lucene/codecs/PointsFormat.java     |   80 +-
 .../org/apache/lucene/codecs/PointsReader.java     |   25 +-
 .../org/apache/lucene/codecs/PointsWriter.java     |   89 +-
 .../org/apache/lucene/codecs/PostingsFormat.java   |  105 +-
 .../apache/lucene/codecs/PostingsReaderBase.java   |   63 +-
 .../apache/lucene/codecs/PostingsWriterBase.java   |   61 +-
 .../lucene/codecs/PushPostingsWriterBase.java      |   78 +-
 .../apache/lucene/codecs/SegmentInfoFormat.java    |   25 +-
 .../apache/lucene/codecs/StoredFieldsFormat.java   |   24 +-
 .../apache/lucene/codecs/StoredFieldsReader.java   |   38 +-
 .../apache/lucene/codecs/StoredFieldsWriter.java   |   99 +-
 .../java/org/apache/lucene/codecs/TermStats.java   |   11 +-
 .../apache/lucene/codecs/TermVectorsFormat.java    |   25 +-
 .../apache/lucene/codecs/TermVectorsReader.java    |   48 +-
 .../apache/lucene/codecs/TermVectorsWriter.java    |  184 +--
 .../org/apache/lucene/codecs/VectorFormat.java     |   57 +-
 .../org/apache/lucene/codecs/VectorReader.java     |   22 +-
 .../org/apache/lucene/codecs/VectorWriter.java     |   49 +-
 .../codecs/blocktree/BlockTreeTermsReader.java     |  175 ++-
 .../codecs/blocktree/BlockTreeTermsWriter.java     |  559 +++++----
 .../codecs/blocktree/CompressionAlgorithm.java     |   15 +-
 .../lucene/codecs/blocktree/FieldReader.java       |   82 +-
 .../codecs/blocktree/IntersectTermsEnum.java       |  104 +-
 .../codecs/blocktree/IntersectTermsEnumFrame.java  |   21 +-
 .../lucene/codecs/blocktree/SegmentTermsEnum.java  |  462 +++++---
 .../codecs/blocktree/SegmentTermsEnumFrame.java    |  180 +--
 .../org/apache/lucene/codecs/blocktree/Stats.java  |  137 ++-
 .../lucene/codecs/blocktree/package-info.java      |   20 +-
 .../compressing/CompressingStoredFieldsFormat.java |  141 ++-
 .../compressing/CompressingStoredFieldsReader.java |  267 +++--
 .../compressing/CompressingStoredFieldsWriter.java |  323 +++---
 .../compressing/CompressingTermVectorsFormat.java  |   79 +-
 .../compressing/CompressingTermVectorsReader.java  |  375 ++++--
 .../compressing/CompressingTermVectorsWriter.java  |  249 ++--
 .../lucene/codecs/compressing/CompressionMode.java |  209 ++--
 .../lucene/codecs/compressing/Compressor.java      |   13 +-
 .../lucene/codecs/compressing/Decompressor.java    |   21 +-
 .../lucene/codecs/compressing/FieldsIndex.java     |    2 -
 .../codecs/compressing/FieldsIndexReader.java      |   46 +-
 .../codecs/compressing/FieldsIndexWriter.java      |   45 +-
 .../compressing/LegacyFieldsIndexReader.java       |   38 +-
 .../lucene/codecs/compressing/MatchingReaders.java |   23 +-
 .../lucene/codecs/compressing/package-info.java    |    6 +-
 .../codecs/lucene50/Lucene50CompoundFormat.java    |   76 +-
 .../codecs/lucene50/Lucene50CompoundReader.java    |  101 +-
 .../codecs/lucene50/Lucene50LiveDocsFormat.java    |   81 +-
 .../codecs/lucene50/Lucene50TermVectorsFormat.java |  208 ++--
 .../lucene/codecs/lucene50/package-info.java       |    5 +-
 .../codecs/lucene60/Lucene60FieldInfosFormat.java  |  304 ++---
 .../lucene/codecs/lucene60/package-info.java       |    4 +-
 .../apache/lucene/codecs/lucene80/IndexedDISI.java |  369 +++---
 .../codecs/lucene80/Lucene80DocValuesConsumer.java |  319 ++++--
 .../codecs/lucene80/Lucene80DocValuesFormat.java   |  177 +--
 .../codecs/lucene80/Lucene80DocValuesProducer.java |  327 ++++--
 .../codecs/lucene80/Lucene80NormsConsumer.java     |   37 +-
 .../codecs/lucene80/Lucene80NormsFormat.java       |   95 +-
 .../codecs/lucene80/Lucene80NormsProducer.java     |  103 +-
 .../lucene/codecs/lucene80/package-info.java       |    5 +-
 .../lucene/codecs/lucene84/ForDeltaUtil.java       |   21 +-
 .../org/apache/lucene/codecs/lucene84/ForUtil.java | 1197 ++++++++++----------
 .../codecs/lucene84/Lucene84PostingsFormat.java    |  635 +++++------
 .../codecs/lucene84/Lucene84PostingsReader.java    |  486 ++++----
 .../codecs/lucene84/Lucene84PostingsWriter.java    |  128 ++-
 .../codecs/lucene84/Lucene84ScoreSkipReader.java   |   59 +-
 .../lucene/codecs/lucene84/Lucene84SkipReader.java |   66 +-
 .../lucene/codecs/lucene84/Lucene84SkipWriter.java |   69 +-
 .../apache/lucene/codecs/lucene84/PForUtil.java    |   35 +-
 .../lucene/codecs/lucene84/package-info.java       |    4 +-
 .../codecs/lucene86/Lucene86PointsFormat.java      |   29 +-
 .../codecs/lucene86/Lucene86PointsReader.java      |   49 +-
 .../codecs/lucene86/Lucene86PointsWriter.java      |  156 +--
 .../codecs/lucene86/Lucene86SegmentInfoFormat.java |  107 +-
 .../lucene/codecs/lucene86/package-info.java       |    4 +-
 .../codecs/lucene87/BugfixDeflater_JDK8252739.java |  216 ++--
 .../DeflateWithPresetDictCompressionMode.java      |   32 +-
 .../lucene87/LZ4WithPresetDictCompressionMode.java |   15 +-
 .../lucene87/Lucene87StoredFieldsFormat.java       |  146 +--
 .../lucene/codecs/lucene87/package-info.java       |    4 +-
 .../lucene/codecs/lucene90/Lucene90Codec.java      |   83 +-
 .../codecs/lucene90/Lucene90FieldInfosFormat.java  |  329 +++---
 .../codecs/lucene90/Lucene90VectorFormat.java      |    5 +-
 .../codecs/lucene90/Lucene90VectorReader.java      |  126 ++-
 .../codecs/lucene90/Lucene90VectorWriter.java      |   81 +-
 .../lucene/codecs/lucene90/package-info.java       |  526 +++++----
 .../org/apache/lucene/codecs/package-info.java     |   74 +-
 .../codecs/perfield/PerFieldDocValuesFormat.java   |  124 +-
 .../lucene/codecs/perfield/PerFieldMergeState.java |   46 +-
 .../codecs/perfield/PerFieldPostingsFormat.java    |  155 +--
 .../lucene/codecs/perfield/package-info.java       |    4 +-
 .../lucene/codecs/TestCodecLoadingDeadlock.java    |  167 +--
 .../org/apache/lucene/codecs/TestCodecUtil.java    |  275 +++--
 .../codecs/TestCompetitiveFreqNormAccumulator.java |   11 +-
 .../compressing/AbstractTestCompressionMode.java   |   40 +-
 .../compressing/TestFastCompressionMode.java       |    1 -
 .../compressing/TestFastDecompressionMode.java     |    1 -
 .../compressing/TestHighCompressionMode.java       |    2 -
 .../lucene50/TestLucene50CompoundFormat.java       |    3 +-
 .../lucene50/TestLucene50LiveDocsFormat.java       |    1 -
 .../lucene50/TestLucene50TermVectorsFormat.java    |    1 -
 .../lucene50/TestLucene60FieldInfoFormat.java      |    5 +-
 .../BaseLucene80DocValuesFormatTestCase.java       |  176 +--
 ...TestBestCompressionLucene80DocValuesFormat.java |   12 +-
 .../TestBestSpeedLucene80DocValuesFormat.java      |    9 +-
 .../lucene/codecs/lucene80/TestIndexedDISI.java    |  236 ++--
 .../codecs/lucene80/TestLucene80NormsFormat.java   |    7 +-
 .../TestLucene80NormsFormatMergeInstance.java      |    5 +-
 .../lucene/codecs/lucene84/TestForDeltaUtil.java   |   16 +-
 .../apache/lucene/codecs/lucene84/TestForUtil.java |   15 +-
 .../lucene84/TestLucene84PostingsFormat.java       |   23 +-
 .../lucene/codecs/lucene84/TestPForUtil.java       |   15 +-
 .../codecs/lucene86/TestLucene86PointsFormat.java  |  240 ++--
 .../lucene86/TestLucene86SegmentInfoFormat.java    |    3 +-
 ...tLucene87StoredFieldsFormatHighCompression.java |   31 +-
 ...estLucene87StoredFieldsFormatMergeInstance.java |    5 +-
 .../perfield/TestPerFieldDocValuesFormat.java      |  106 +-
 .../perfield/TestPerFieldPostingsFormat.java       |    6 +-
 .../perfield/TestPerFieldPostingsFormat2.java      |  154 +--
 139 files changed, 9022 insertions(+), 7109 deletions(-)

diff --git a/gradle/validation/spotless.gradle b/gradle/validation/spotless.gradle
index bc8e10f..318a2c9 100644
--- a/gradle/validation/spotless.gradle
+++ b/gradle/validation/spotless.gradle
@@ -39,22 +39,15 @@ allprojects { prj ->
           // These modules are complete - all sources scanned.
           case ":lucene:highlighter":
             target "src/**"
-            targetExclude "**/resources/**", "**/CambridgeMA.utf8", "**/overview.html"
+            targetExclude "**/resources/**", "**/overview.html", "**/CambridgeMA.utf8"
             break
 
           // Partially complete.
           case ":lucene:core":
-            target "src/**/org/apache/lucene/*.java",
-                   "src/**/org/apache/lucene/analysis/**",
-                   // "src/**/org/apache/lucene/codecs/**",
-                   "src/**/org/apache/lucene/document/**",
-                   "src/**/org/apache/lucene/geo/**",
-                   "src/**/org/apache/lucene/index/**",
-                   "src/**/org/apache/lucene/search/**",
-                   "src/**/org/apache/lucene/store/**",
-                   "src/**/org/apache/lucene/util/**"
-
+            target "src/java/**", "src/test/**"
             targetExclude "**/resources/**",
+                "**/overview.html",
+                "**/META-INF/**",
                 "**/StandardTokenizerImpl.jflex",
                 "**/StandardTokenizerImpl.java",
                 "**/createLevAutomata.py",
@@ -63,7 +56,8 @@ allprojects { prj ->
                 "**/gen_Packed64SingleBlock.py",
                 "**/makeEuroparlLineFile.py",
                 "**/wordliststopwords.txt",
-                "**/wordliststopwords_nocomment.txt"
+                "**/wordliststopwords_nocomment.txt",
+                "**/gen_ForUtil.py"
             break
 
           case ":lucene:analysis:common":
diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene50/Lucene50SkipWriter.java b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene50/Lucene50SkipWriter.java
index 5316f78..fec3be5 100644
--- a/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene50/Lucene50SkipWriter.java
+++ b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene50/Lucene50SkipWriter.java
@@ -32,10 +32,11 @@ import org.apache.lucene.store.IndexOutput;
  * Write skip lists with multiple levels, and support skip within block ints.
  *
  * Assume that docFreq = 28, skipInterval = blockSize = 12
- *
+ * <pre>
  *  |       block#0       | |      block#1        | |vInts|
  *  d d d d d d d d d d d d d d d d d d d d d d d d d d d d (posting list)
  *                          ^                       ^       (level 0 skip point)
+ * </pre>
  *
  * Note that skipWriter will ignore first document in block#0, since 
  * it is useless as a skip point.  Also, we'll never skip into the vInts
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/BlockTermState.java b/lucene/core/src/java/org/apache/lucene/codecs/BlockTermState.java
index c317668..06508e7 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/BlockTermState.java
+++ b/lucene/core/src/java/org/apache/lucene/codecs/BlockTermState.java
@@ -20,9 +20,8 @@ import org.apache.lucene.index.OrdTermState;
 import org.apache.lucene.index.TermState;
 
 /**
- * Holds all state required for {@link PostingsReaderBase}
- * to produce a {@link org.apache.lucene.index.PostingsEnum} without re-seeking the
- * terms dict.
+ * Holds all state required for {@link PostingsReaderBase} to produce a {@link
+ * org.apache.lucene.index.PostingsEnum} without re-seeking the terms dict.
  *
  * @lucene.internal
  */
@@ -38,10 +37,8 @@ public class BlockTermState extends OrdTermState {
   // TODO: update BTR to nuke this
   public long blockFilePointer;
 
-  /** Sole constructor. (For invocation by subclass 
-   *  constructors, typically implicit.) */
-  protected BlockTermState() {
-  }
+  /** Sole constructor. (For invocation by subclass constructors, typically implicit.) */
+  protected BlockTermState() {}
 
   @Override
   public void copyFrom(TermState _other) {
@@ -56,6 +53,13 @@ public class BlockTermState extends OrdTermState {
 
   @Override
   public String toString() {
-    return "docFreq=" + docFreq + " totalTermFreq=" + totalTermFreq + " termBlockOrd=" + termBlockOrd + " blockFP=" + blockFilePointer;
+    return "docFreq="
+        + docFreq
+        + " totalTermFreq="
+        + totalTermFreq
+        + " termBlockOrd="
+        + termBlockOrd
+        + " blockFP="
+        + blockFilePointer;
   }
 }
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/Codec.java b/lucene/core/src/java/org/apache/lucene/codecs/Codec.java
index 3a2bc3f..24abcb4 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/Codec.java
+++ b/lucene/core/src/java/org/apache/lucene/codecs/Codec.java
@@ -16,46 +16,45 @@
  */
 package org.apache.lucene.codecs;
 
-
 import java.util.Objects;
 import java.util.ServiceLoader; // javadocs
 import java.util.Set;
-
 import org.apache.lucene.index.IndexWriterConfig; // javadocs
 import org.apache.lucene.util.NamedSPILoader;
 
 /**
  * Encodes/decodes an inverted index segment.
- * <p>
- * Note, when extending this class, the name ({@link #getName}) is 
- * written into the index. In order for the segment to be read, the
- * name must resolve to your implementation via {@link #forName(String)}.
- * This method uses Java's 
- * {@link ServiceLoader Service Provider Interface} (SPI) to resolve codec names.
- * <p>
- * If you implement your own codec, make sure that it has a no-arg constructor
- * so SPI can load it.
+ *
+ * <p>Note, when extending this class, the name ({@link #getName}) is written into the index. In
+ * order for the segment to be read, the name must resolve to your implementation via {@link
+ * #forName(String)}. This method uses Java's {@link ServiceLoader Service Provider Interface} (SPI)
+ * to resolve codec names.
+ *
+ * <p>If you implement your own codec, make sure that it has a no-arg constructor so SPI can load
+ * it.
+ *
  * @see ServiceLoader
  */
 public abstract class Codec implements NamedSPILoader.NamedSPI {
 
   /**
-   * This static holder class prevents classloading deadlock by delaying
-   * init of default codecs and available codecs until needed.
+   * This static holder class prevents classloading deadlock by delaying init of default codecs and
+   * available codecs until needed.
    */
   private static final class Holder {
     private static final NamedSPILoader<Codec> LOADER = new NamedSPILoader<>(Codec.class);
-    
+
     private Holder() {}
-    
+
     static NamedSPILoader<Codec> getLoader() {
       if (LOADER == null) {
-        throw new IllegalStateException("You tried to lookup a Codec by name before all Codecs could be initialized. "+
-          "This likely happens if you call Codec#forName from a Codec's ctor.");
+        throw new IllegalStateException(
+            "You tried to lookup a Codec by name before all Codecs could be initialized. "
+                + "This likely happens if you call Codec#forName from a Codec's ctor.");
       }
       return LOADER;
     }
-    
+
     static Codec defaultCodec = LOADER.lookup("Lucene90");
   }
 
@@ -63,47 +62,48 @@ public abstract class Codec implements NamedSPILoader.NamedSPI {
 
   /**
    * Creates a new codec.
-   * <p>
-   * The provided name will be written into the index segment: in order to
-   * for the segment to be read this class should be registered with Java's
-   * SPI mechanism (registered in META-INF/ of your jar file, etc).
+   *
+   * <p>The provided name will be written into the index segment: in order to for the segment to be
+   * read this class should be registered with Java's SPI mechanism (registered in META-INF/ of your
+   * jar file, etc).
+   *
    * @param name must be all ascii alphanumeric, and less than 128 characters in length.
    */
   protected Codec(String name) {
     NamedSPILoader.checkServiceName(name);
     this.name = name;
   }
-  
+
   /** Returns this codec's name */
   @Override
   public final String getName() {
     return name;
   }
-  
+
   /** Encodes/decodes postings */
   public abstract PostingsFormat postingsFormat();
 
   /** Encodes/decodes docvalues */
   public abstract DocValuesFormat docValuesFormat();
-  
+
   /** Encodes/decodes stored fields */
   public abstract StoredFieldsFormat storedFieldsFormat();
-  
+
   /** Encodes/decodes term vectors */
   public abstract TermVectorsFormat termVectorsFormat();
-  
+
   /** Encodes/decodes field infos file */
   public abstract FieldInfosFormat fieldInfosFormat();
-  
+
   /** Encodes/decodes segment info file */
   public abstract SegmentInfoFormat segmentInfoFormat();
-  
+
   /** Encodes/decodes document normalization values */
   public abstract NormsFormat normsFormat();
 
   /** Encodes/decodes live docs */
   public abstract LiveDocsFormat liveDocsFormat();
-  
+
   /** Encodes/decodes compound files */
   public abstract CompoundFormat compoundFormat();
 
@@ -112,53 +112,47 @@ public abstract class Codec implements NamedSPILoader.NamedSPI {
 
   /** Encodes/decodes numeric vector fields */
   public abstract VectorFormat vectorFormat();
-  
+
   /** looks up a codec by name */
   public static Codec forName(String name) {
     return Holder.getLoader().lookup(name);
   }
-  
+
   /** returns a list of all available codec names */
   public static Set<String> availableCodecs() {
     return Holder.getLoader().availableServices();
   }
-  
-  /** 
-   * Reloads the codec list from the given {@link ClassLoader}.
-   * Changes to the codecs are visible after the method ends, all
-   * iterators ({@link #availableCodecs()},...) stay consistent. 
-   * 
-   * <p><b>NOTE:</b> Only new codecs are added, existing ones are
-   * never removed or replaced.
-   * 
-   * <p><em>This method is expensive and should only be called for discovery
-   * of new codecs on the given classpath/classloader!</em>
+
+  /**
+   * Reloads the codec list from the given {@link ClassLoader}. Changes to the codecs are visible
+   * after the method ends, all iterators ({@link #availableCodecs()},...) stay consistent.
+   *
+   * <p><b>NOTE:</b> Only new codecs are added, existing ones are never removed or replaced.
+   *
+   * <p><em>This method is expensive and should only be called for discovery of new codecs on the
+   * given classpath/classloader!</em>
    */
   public static void reloadCodecs(ClassLoader classloader) {
     Holder.getLoader().reload(classloader);
   }
-    
-  /** expert: returns the default codec used for newly created
-   *  {@link IndexWriterConfig}s.
-   */
+
+  /** expert: returns the default codec used for newly created {@link IndexWriterConfig}s. */
   public static Codec getDefault() {
     if (Holder.defaultCodec == null) {
-      throw new IllegalStateException("You tried to lookup the default Codec before all Codecs could be initialized. "+
-        "This likely happens if you try to get it from a Codec's ctor.");
+      throw new IllegalStateException(
+          "You tried to lookup the default Codec before all Codecs could be initialized. "
+              + "This likely happens if you try to get it from a Codec's ctor.");
     }
     return Holder.defaultCodec;
   }
-  
-  /** expert: sets the default codec used for newly created
-   *  {@link IndexWriterConfig}s.
-   */
+
+  /** expert: sets the default codec used for newly created {@link IndexWriterConfig}s. */
   public static void setDefault(Codec codec) {
     Holder.defaultCodec = Objects.requireNonNull(codec);
   }
 
   /**
-   * returns the codec's name. Subclasses can override to provide
-   * more detail (such as parameters).
+   * returns the codec's name. Subclasses can override to provide more detail (such as parameters).
    */
   @Override
   public String toString() {
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/CodecUtil.java b/lucene/core/src/java/org/apache/lucene/codecs/CodecUtil.java
index 8c40e2a..3dc46de 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/CodecUtil.java
+++ b/lucene/core/src/java/org/apache/lucene/codecs/CodecUtil.java
@@ -16,11 +16,9 @@
  */
 package org.apache.lucene.codecs;
 
-
 import java.io.IOException;
 import java.nio.charset.StandardCharsets;
 import java.util.Arrays;
-
 import org.apache.lucene.index.CorruptIndexException;
 import org.apache.lucene.index.IndexFormatTooNewException;
 import org.apache.lucene.index.IndexFormatTooOldException;
@@ -36,97 +34,91 @@ import org.apache.lucene.util.StringHelper;
 
 /**
  * Utility class for reading and writing versioned headers.
- * <p>
- * Writing codec headers is useful to ensure that a file is in 
- * the format you think it is.
- * 
+ *
+ * <p>Writing codec headers is useful to ensure that a file is in the format you think it is.
+ *
  * @lucene.experimental
  */
-
 public final class CodecUtil {
   private CodecUtil() {} // no instance
 
-  /**
-   * Constant to identify the start of a codec header.
-   */
-  public final static int CODEC_MAGIC = 0x3fd76c17;
-  /**
-   * Constant to identify the start of a codec footer.
-   */
-  public final static int FOOTER_MAGIC = ~CODEC_MAGIC;
+  /** Constant to identify the start of a codec header. */
+  public static final int CODEC_MAGIC = 0x3fd76c17;
+  /** Constant to identify the start of a codec footer. */
+  public static final int FOOTER_MAGIC = ~CODEC_MAGIC;
 
   /**
-   * Writes a codec header, which records both a string to
-   * identify the file and a version number. This header can
-   * be parsed and validated with 
-   * {@link #checkHeader(DataInput, String, int, int) checkHeader()}.
-   * <p>
-   * CodecHeader --&gt; Magic,CodecName,Version
+   * Writes a codec header, which records both a string to identify the file and a version number.
+   * This header can be parsed and validated with {@link #checkHeader(DataInput, String, int, int)
+   * checkHeader()}.
+   *
+   * <p>CodecHeader --&gt; Magic,CodecName,Version
+   *
    * <ul>
-   *    <li>Magic --&gt; {@link DataOutput#writeInt Uint32}. This
-   *        identifies the start of the header. It is always {@value #CODEC_MAGIC}.
-   *    <li>CodecName --&gt; {@link DataOutput#writeString String}. This
-   *        is a string to identify this file.
-   *    <li>Version --&gt; {@link DataOutput#writeInt Uint32}. Records
-   *        the version of the file.
+   *   <li>Magic --&gt; {@link DataOutput#writeInt Uint32}. This identifies the start of the header.
+   *       It is always {@value #CODEC_MAGIC}.
+   *   <li>CodecName --&gt; {@link DataOutput#writeString String}. This is a string to identify this
+   *       file.
+   *   <li>Version --&gt; {@link DataOutput#writeInt Uint32}. Records the version of the file.
    * </ul>
-   * <p>
-   * Note that the length of a codec header depends only upon the
-   * name of the codec, so this length can be computed at any time
-   * with {@link #headerLength(String)}.
-   * 
+   *
+   * <p>Note that the length of a codec header depends only upon the name of the codec, so this
+   * length can be computed at any time with {@link #headerLength(String)}.
+   *
    * @param out Output stream
-   * @param codec String to identify this file. It should be simple ASCII, 
-   *              less than 128 characters in length.
+   * @param codec String to identify this file. It should be simple ASCII, less than 128 characters
+   *     in length.
    * @param version Version number
    * @throws IOException If there is an I/O error writing to the underlying medium.
-   * @throws IllegalArgumentException If the codec name is not simple ASCII, or is more than 127 characters in length
+   * @throws IllegalArgumentException If the codec name is not simple ASCII, or is more than 127
+   *     characters in length
    */
   public static void writeHeader(DataOutput out, String codec, int version) throws IOException {
     BytesRef bytes = new BytesRef(codec);
     if (bytes.length != codec.length() || bytes.length >= 128) {
-      throw new IllegalArgumentException("codec must be simple ASCII, less than 128 characters in length [got " + codec + "]");
+      throw new IllegalArgumentException(
+          "codec must be simple ASCII, less than 128 characters in length [got " + codec + "]");
     }
     out.writeInt(CODEC_MAGIC);
     out.writeString(codec);
     out.writeInt(version);
   }
-  
+
   /**
-   * Writes a codec header for an index file, which records both a string to
-   * identify the format of the file, a version number, and data to identify
-   * the file instance (ID and auxiliary suffix such as generation).
-   * <p>
-   * This header can be parsed and validated with 
-   * {@link #checkIndexHeader(DataInput, String, int, int, byte[], String) checkIndexHeader()}.
-   * <p>
-   * IndexHeader --&gt; CodecHeader,ObjectID,ObjectSuffix
+   * Writes a codec header for an index file, which records both a string to identify the format of
+   * the file, a version number, and data to identify the file instance (ID and auxiliary suffix
+   * such as generation).
+   *
+   * <p>This header can be parsed and validated with {@link #checkIndexHeader(DataInput, String,
+   * int, int, byte[], String) checkIndexHeader()}.
+   *
+   * <p>IndexHeader --&gt; CodecHeader,ObjectID,ObjectSuffix
+   *
    * <ul>
-   *    <li>CodecHeader   --&gt; {@link #writeHeader}
-   *    <li>ObjectID     --&gt; {@link DataOutput#writeByte byte}<sup>16</sup>
-   *    <li>ObjectSuffix --&gt; SuffixLength,SuffixBytes
-   *    <li>SuffixLength  --&gt; {@link DataOutput#writeByte byte}
-   *    <li>SuffixBytes   --&gt; {@link DataOutput#writeByte byte}<sup>SuffixLength</sup>
+   *   <li>CodecHeader --&gt; {@link #writeHeader}
+   *   <li>ObjectID --&gt; {@link DataOutput#writeByte byte}<sup>16</sup>
+   *   <li>ObjectSuffix --&gt; SuffixLength,SuffixBytes
+   *   <li>SuffixLength --&gt; {@link DataOutput#writeByte byte}
+   *   <li>SuffixBytes --&gt; {@link DataOutput#writeByte byte}<sup>SuffixLength</sup>
    * </ul>
-   * <p>
-   * Note that the length of an index header depends only upon the
-   * name of the codec and suffix, so this length can be computed at any time
-   * with {@link #indexHeaderLength(String,String)}.
-   * 
+   *
+   * <p>Note that the length of an index header depends only upon the name of the codec and suffix,
+   * so this length can be computed at any time with {@link #indexHeaderLength(String,String)}.
+   *
    * @param out Output stream
-   * @param codec String to identify the format of this file. It should be simple ASCII, 
-   *              less than 128 characters in length.
+   * @param codec String to identify the format of this file. It should be simple ASCII, less than
+   *     128 characters in length.
    * @param id Unique identifier for this particular file instance.
-   * @param suffix auxiliary suffix information for the file. It should be simple ASCII,
-   *              less than 256 characters in length.
+   * @param suffix auxiliary suffix information for the file. It should be simple ASCII, less than
+   *     256 characters in length.
    * @param version Version number
    * @throws IOException If there is an I/O error writing to the underlying medium.
-   * @throws IllegalArgumentException If the codec name is not simple ASCII, or 
-   *         is more than 127 characters in length, or if id is invalid,
-   *         or if the suffix is not simple ASCII, or more than 255 characters
-   *         in length.
+   * @throws IllegalArgumentException If the codec name is not simple ASCII, or is more than 127
+   *     characters in length, or if id is invalid, or if the suffix is not simple ASCII, or more
+   *     than 255 characters in length.
    */
-  public static void writeIndexHeader(DataOutput out, String codec, int version, byte[] id, String suffix) throws IOException {
+  public static void writeIndexHeader(
+      DataOutput out, String codec, int version, byte[] id, String suffix) throws IOException {
     if (id.length != StringHelper.ID_LENGTH) {
       throw new IllegalArgumentException("Invalid id: " + StringHelper.idToString(id));
     }
@@ -134,7 +126,8 @@ public final class CodecUtil {
     out.writeBytes(id, 0, id.length);
     BytesRef suffixBytes = new BytesRef(suffix);
     if (suffixBytes.length != suffix.length() || suffixBytes.length >= 256) {
-      throw new IllegalArgumentException("suffix must be simple ASCII, less than 256 characters in length [got " + suffix + "]");
+      throw new IllegalArgumentException(
+          "suffix must be simple ASCII, less than 256 characters in length [got " + suffix + "]");
     }
     out.writeByte((byte) suffixBytes.length);
     out.writeBytes(suffixBytes.bytes, suffixBytes.offset, suffixBytes.length);
@@ -142,18 +135,18 @@ public final class CodecUtil {
 
   /**
    * Computes the length of a codec header.
-   * 
+   *
    * @param codec Codec name.
    * @return length of the entire codec header.
    * @see #writeHeader(DataOutput, String, int)
    */
   public static int headerLength(String codec) {
-    return 9+codec.length();
+    return 9 + codec.length();
   }
-  
+
   /**
    * Computes the length of an index header.
-   * 
+   *
    * @param codec Codec name.
    * @return length of the entire index header.
    * @see #writeIndexHeader(DataOutput, String, int, byte[], String)
@@ -163,49 +156,53 @@ public final class CodecUtil {
   }
 
   /**
-   * Reads and validates a header previously written with 
-   * {@link #writeHeader(DataOutput, String, int)}.
-   * <p>
-   * When reading a file, supply the expected <code>codec</code> and
-   * an expected version range (<code>minVersion to maxVersion</code>).
-   * 
-   * @param in Input stream, positioned at the point where the
-   *        header was previously written. Typically this is located
-   *        at the beginning of the file.
+   * Reads and validates a header previously written with {@link #writeHeader(DataOutput, String,
+   * int)}.
+   *
+   * <p>When reading a file, supply the expected <code>codec</code> and an expected version range (
+   * <code>minVersion to maxVersion</code>).
+   *
+   * @param in Input stream, positioned at the point where the header was previously written.
+   *     Typically this is located at the beginning of the file.
    * @param codec The expected codec name.
    * @param minVersion The minimum supported expected version number.
    * @param maxVersion The maximum supported expected version number.
-   * @return The actual version found, when a valid header is found 
-   *         that matches <code>codec</code>, with an actual version 
-   *         where {@code minVersion <= actual <= maxVersion}.
-   *         Otherwise an exception is thrown.
-   * @throws CorruptIndexException If the first four bytes are not
-   *         {@link #CODEC_MAGIC}, or if the actual codec found is
-   *         not <code>codec</code>.
-   * @throws IndexFormatTooOldException If the actual version is less 
-   *         than <code>minVersion</code>.
-   * @throws IndexFormatTooNewException If the actual version is greater 
-   *         than <code>maxVersion</code>.
+   * @return The actual version found, when a valid header is found that matches <code>codec</code>,
+   *     with an actual version where {@code minVersion <= actual <= maxVersion}. Otherwise an
+   *     exception is thrown.
+   * @throws CorruptIndexException If the first four bytes are not {@link #CODEC_MAGIC}, or if the
+   *     actual codec found is not <code>codec</code>.
+   * @throws IndexFormatTooOldException If the actual version is less than <code>minVersion</code>.
+   * @throws IndexFormatTooNewException If the actual version is greater than <code>maxVersion
+   *     </code>.
    * @throws IOException If there is an I/O error reading from the underlying medium.
    * @see #writeHeader(DataOutput, String, int)
    */
-  public static int checkHeader(DataInput in, String codec, int minVersion, int maxVersion) throws IOException {
+  public static int checkHeader(DataInput in, String codec, int minVersion, int maxVersion)
+      throws IOException {
     // Safety to guard against reading a bogus string:
     final int actualHeader = in.readInt();
     if (actualHeader != CODEC_MAGIC) {
-      throw new CorruptIndexException("codec header mismatch: actual header=" + actualHeader + " vs expected header=" + CODEC_MAGIC, in);
+      throw new CorruptIndexException(
+          "codec header mismatch: actual header="
+              + actualHeader
+              + " vs expected header="
+              + CODEC_MAGIC,
+          in);
     }
     return checkHeaderNoMagic(in, codec, minVersion, maxVersion);
   }
 
-  /** Like {@link
-   *  #checkHeader(DataInput,String,int,int)} except this
-   *  version assumes the first int has already been read
-   *  and validated from the input. */
-  public static int checkHeaderNoMagic(DataInput in, String codec, int minVersion, int maxVersion) throws IOException {
+  /**
+   * Like {@link #checkHeader(DataInput,String,int,int)} except this version assumes the first int
+   * has already been read and validated from the input.
+   */
+  public static int checkHeaderNoMagic(DataInput in, String codec, int minVersion, int maxVersion)
+      throws IOException {
     final String actualCodec = in.readString();
     if (!actualCodec.equals(codec)) {
-      throw new CorruptIndexException("codec mismatch: actual codec=" + actualCodec + " vs expected codec=" + codec, in);
+      throw new CorruptIndexException(
+          "codec mismatch: actual codec=" + actualCodec + " vs expected codec=" + codec, in);
     }
 
     final int actualVersion = in.readInt();
@@ -218,40 +215,41 @@ public final class CodecUtil {
 
     return actualVersion;
   }
-  
+
   /**
-   * Reads and validates a header previously written with 
-   * {@link #writeIndexHeader(DataOutput, String, int, byte[], String)}.
-   * <p>
-   * When reading a file, supply the expected <code>codec</code>,
-   * expected version range (<code>minVersion to maxVersion</code>),
-   * and object ID and suffix.
-   * 
-   * @param in Input stream, positioned at the point where the
-   *        header was previously written. Typically this is located
-   *        at the beginning of the file.
+   * Reads and validates a header previously written with {@link #writeIndexHeader(DataOutput,
+   * String, int, byte[], String)}.
+   *
+   * <p>When reading a file, supply the expected <code>codec</code>, expected version range (<code>
+   * minVersion to maxVersion</code>), and object ID and suffix.
+   *
+   * @param in Input stream, positioned at the point where the header was previously written.
+   *     Typically this is located at the beginning of the file.
    * @param codec The expected codec name.
    * @param minVersion The minimum supported expected version number.
    * @param maxVersion The maximum supported expected version number.
    * @param expectedID The expected object identifier for this file.
    * @param expectedSuffix The expected auxiliary suffix for this file.
-   * @return The actual version found, when a valid header is found 
-   *         that matches <code>codec</code>, with an actual version 
-   *         where {@code minVersion <= actual <= maxVersion}, 
-   *         and matching <code>expectedID</code> and <code>expectedSuffix</code>
-   *         Otherwise an exception is thrown.
-   * @throws CorruptIndexException If the first four bytes are not
-   *         {@link #CODEC_MAGIC}, or if the actual codec found is
-   *         not <code>codec</code>, or if the <code>expectedID</code>
-   *         or <code>expectedSuffix</code> do not match.
-   * @throws IndexFormatTooOldException If the actual version is less 
-   *         than <code>minVersion</code>.
-   * @throws IndexFormatTooNewException If the actual version is greater 
-   *         than <code>maxVersion</code>.
+   * @return The actual version found, when a valid header is found that matches <code>codec</code>,
+   *     with an actual version where {@code minVersion <= actual <= maxVersion}, and matching
+   *     <code>expectedID</code> and <code>expectedSuffix</code> Otherwise an exception is thrown.
+   * @throws CorruptIndexException If the first four bytes are not {@link #CODEC_MAGIC}, or if the
+   *     actual codec found is not <code>codec</code>, or if the <code>expectedID</code> or <code>
+   *     expectedSuffix</code> do not match.
+   * @throws IndexFormatTooOldException If the actual version is less than <code>minVersion</code>.
+   * @throws IndexFormatTooNewException If the actual version is greater than <code>maxVersion
+   *     </code>.
    * @throws IOException If there is an I/O error reading from the underlying medium.
    * @see #writeIndexHeader(DataOutput, String, int, byte[],String)
    */
-  public static int checkIndexHeader(DataInput in, String codec, int minVersion, int maxVersion, byte[] expectedID, String expectedSuffix) throws IOException {
+  public static int checkIndexHeader(
+      DataInput in,
+      String codec,
+      int minVersion,
+      int maxVersion,
+      byte[] expectedID,
+      String expectedSuffix)
+      throws IOException {
     int version = checkHeader(in, codec, minVersion, maxVersion);
     checkIndexHeaderID(in, expectedID);
     checkIndexHeaderSuffix(in, expectedSuffix);
@@ -259,32 +257,38 @@ public final class CodecUtil {
   }
 
   /**
-   * Expert: verifies the incoming {@link IndexInput} has an index header
-   * and that its segment ID matches the expected one, and then copies
-   * that index header into the provided {@link DataOutput}.  This is
-   * useful when building compound files.
+   * Expert: verifies the incoming {@link IndexInput} has an index header and that its segment ID
+   * matches the expected one, and then copies that index header into the provided {@link
+   * DataOutput}. This is useful when building compound files.
    *
-   * @param in Input stream, positioned at the point where the
-   *        index header was previously written. Typically this is located
-   *        at the beginning of the file.
+   * @param in Input stream, positioned at the point where the index header was previously written.
+   *     Typically this is located at the beginning of the file.
    * @param out Output stream, where the header will be copied to.
    * @param expectedID Expected segment ID
-   * @throws CorruptIndexException If the first four bytes are not
-   *         {@link #CODEC_MAGIC}, or if the <code>expectedID</code>
-   *         does not match.
+   * @throws CorruptIndexException If the first four bytes are not {@link #CODEC_MAGIC}, or if the
+   *     <code>expectedID</code> does not match.
    * @throws IOException If there is an I/O error reading from the underlying medium.
-   *
-   * @lucene.internal 
+   * @lucene.internal
    */
-  public static void verifyAndCopyIndexHeader(IndexInput in, DataOutput out, byte[] expectedID) throws IOException {
+  public static void verifyAndCopyIndexHeader(IndexInput in, DataOutput out, byte[] expectedID)
+      throws IOException {
     // make sure it's large enough to have a header and footer
     if (in.length() < footerLength() + headerLength("")) {
-      throw new CorruptIndexException("compound sub-files must have a valid codec header and footer: file is too small (" + in.length() + " bytes)", in);
+      throw new CorruptIndexException(
+          "compound sub-files must have a valid codec header and footer: file is too small ("
+              + in.length()
+              + " bytes)",
+          in);
     }
 
     int actualHeader = in.readInt();
     if (actualHeader != CODEC_MAGIC) {
-      throw new CorruptIndexException("compound sub-files must have a valid codec header and footer: codec header mismatch: actual header=" + actualHeader + " vs expected header=" + CodecUtil.CODEC_MAGIC, in);
+      throw new CorruptIndexException(
+          "compound sub-files must have a valid codec header and footer: codec header mismatch: actual header="
+              + actualHeader
+              + " vs expected header="
+              + CodecUtil.CODEC_MAGIC,
+          in);
     }
 
     // we can't verify these, so we pass-through:
@@ -308,15 +312,20 @@ public final class CodecUtil {
     out.writeBytes(suffixBytes, 0, suffixLength);
   }
 
-
-  /** Retrieves the full index header from the provided {@link IndexInput}.
-   *  This throws {@link CorruptIndexException} if this file does
-   * not appear to be an index file. */
+  /**
+   * Retrieves the full index header from the provided {@link IndexInput}. This throws {@link
+   * CorruptIndexException} if this file does not appear to be an index file.
+   */
   public static byte[] readIndexHeader(IndexInput in) throws IOException {
     in.seek(0);
     final int actualHeader = in.readInt();
     if (actualHeader != CODEC_MAGIC) {
-      throw new CorruptIndexException("codec header mismatch: actual header=" + actualHeader + " vs expected header=" + CODEC_MAGIC, in);
+      throw new CorruptIndexException(
+          "codec header mismatch: actual header="
+              + actualHeader
+              + " vs expected header="
+              + CODEC_MAGIC,
+          in);
     }
     String codec = in.readString();
     in.readInt();
@@ -328,11 +337,18 @@ public final class CodecUtil {
     return bytes;
   }
 
-  /** Retrieves the full footer from the provided {@link IndexInput}.  This throws
-   *  {@link CorruptIndexException} if this file does not have a valid footer. */
+  /**
+   * Retrieves the full footer from the provided {@link IndexInput}. This throws {@link
+   * CorruptIndexException} if this file does not have a valid footer.
+   */
   public static byte[] readFooter(IndexInput in) throws IOException {
     if (in.length() < footerLength()) {
-      throw new CorruptIndexException("misplaced codec footer (file truncated?): length=" + in.length() + " but footerLength==" + footerLength(), in);
+      throw new CorruptIndexException(
+          "misplaced codec footer (file truncated?): length="
+              + in.length()
+              + " but footerLength=="
+              + footerLength(),
+          in);
     }
     in.seek(in.length() - footerLength());
     validateFooter(in);
@@ -341,49 +357,51 @@ public final class CodecUtil {
     in.readBytes(bytes, 0, bytes.length);
     return bytes;
   }
-  
+
   /** Expert: just reads and verifies the object ID of an index header */
   public static byte[] checkIndexHeaderID(DataInput in, byte[] expectedID) throws IOException {
     byte id[] = new byte[StringHelper.ID_LENGTH];
     in.readBytes(id, 0, id.length);
     if (!Arrays.equals(id, expectedID)) {
-      throw new CorruptIndexException("file mismatch, expected id=" + StringHelper.idToString(expectedID) 
-                                                         + ", got=" + StringHelper.idToString(id), in);
+      throw new CorruptIndexException(
+          "file mismatch, expected id="
+              + StringHelper.idToString(expectedID)
+              + ", got="
+              + StringHelper.idToString(id),
+          in);
     }
     return id;
   }
-  
+
   /** Expert: just reads and verifies the suffix of an index header */
-  public static String checkIndexHeaderSuffix(DataInput in, String expectedSuffix) throws IOException {
+  public static String checkIndexHeaderSuffix(DataInput in, String expectedSuffix)
+      throws IOException {
     int suffixLength = in.readByte() & 0xFF;
     byte suffixBytes[] = new byte[suffixLength];
     in.readBytes(suffixBytes, 0, suffixBytes.length);
     String suffix = new String(suffixBytes, 0, suffixBytes.length, StandardCharsets.UTF_8);
     if (!suffix.equals(expectedSuffix)) {
-      throw new CorruptIndexException("file mismatch, expected suffix=" + expectedSuffix
-                                                             + ", got=" + suffix, in);
+      throw new CorruptIndexException(
+          "file mismatch, expected suffix=" + expectedSuffix + ", got=" + suffix, in);
     }
     return suffix;
   }
-  
+
   /**
-   * Writes a codec footer, which records both a checksum
-   * algorithm ID and a checksum. This footer can
-   * be parsed and validated with 
-   * {@link #checkFooter(ChecksumIndexInput) checkFooter()}.
-   * <p>
-   * CodecFooter --&gt; Magic,AlgorithmID,Checksum
+   * Writes a codec footer, which records both a checksum algorithm ID and a checksum. This footer
+   * can be parsed and validated with {@link #checkFooter(ChecksumIndexInput) checkFooter()}.
+   *
+   * <p>CodecFooter --&gt; Magic,AlgorithmID,Checksum
+   *
    * <ul>
-   *    <li>Magic --&gt; {@link DataOutput#writeInt Uint32}. This
-   *        identifies the start of the footer. It is always {@value #FOOTER_MAGIC}.
-   *    <li>AlgorithmID --&gt; {@link DataOutput#writeInt Uint32}. This
-   *        indicates the checksum algorithm used. Currently this is always 0,
-   *        for zlib-crc32.
-   *    <li>Checksum --&gt; {@link DataOutput#writeLong Uint64}. The
-   *        actual checksum value for all previous bytes in the stream, including
-   *        the bytes from Magic and AlgorithmID.
+   *   <li>Magic --&gt; {@link DataOutput#writeInt Uint32}. This identifies the start of the footer.
+   *       It is always {@value #FOOTER_MAGIC}.
+   *   <li>AlgorithmID --&gt; {@link DataOutput#writeInt Uint32}. This indicates the checksum
+   *       algorithm used. Currently this is always 0, for zlib-crc32.
+   *   <li>Checksum --&gt; {@link DataOutput#writeLong Uint64}. The actual checksum value for all
+   *       previous bytes in the stream, including the bytes from Magic and AlgorithmID.
    * </ul>
-   * 
+   *
    * @param out Output stream
    * @throws IOException If there is an I/O error writing to the underlying medium.
    */
@@ -392,49 +410,54 @@ public final class CodecUtil {
     out.writeInt(0);
     writeCRC(out);
   }
-  
+
   /**
    * Computes the length of a codec footer.
-   * 
+   *
    * @return length of the entire codec footer.
    * @see #writeFooter(IndexOutput)
    */
   public static int footerLength() {
     return 16;
   }
-  
-  /** 
-   * Validates the codec footer previously written by {@link #writeFooter}. 
+
+  /**
+   * Validates the codec footer previously written by {@link #writeFooter}.
+   *
    * @return actual checksum value
-   * @throws IOException if the footer is invalid, if the checksum does not match, 
-   *                     or if {@code in} is not properly positioned before the footer
-   *                     at the end of the stream.
+   * @throws IOException if the footer is invalid, if the checksum does not match, or if {@code in}
+   *     is not properly positioned before the footer at the end of the stream.
    */
   public static long checkFooter(ChecksumIndexInput in) throws IOException {
     validateFooter(in);
     long actualChecksum = in.getChecksum();
     long expectedChecksum = readCRC(in);
     if (expectedChecksum != actualChecksum) {
-      throw new CorruptIndexException("checksum failed (hardware problem?) : expected=" + Long.toHexString(expectedChecksum) +  
-                                                       " actual=" + Long.toHexString(actualChecksum), in);
+      throw new CorruptIndexException(
+          "checksum failed (hardware problem?) : expected="
+              + Long.toHexString(expectedChecksum)
+              + " actual="
+              + Long.toHexString(actualChecksum),
+          in);
     }
     return actualChecksum;
   }
-  
-  /** 
-   * Validates the codec footer previously written by {@link #writeFooter}, optionally
-   * passing an unexpected exception that has already occurred.
-   * <p>
-   * When a {@code priorException} is provided, this method will add a suppressed exception 
-   * indicating whether the checksum for the stream passes, fails, or cannot be computed, and 
+
+  /**
+   * Validates the codec footer previously written by {@link #writeFooter}, optionally passing an
+   * unexpected exception that has already occurred.
+   *
+   * <p>When a {@code priorException} is provided, this method will add a suppressed exception
+   * indicating whether the checksum for the stream passes, fails, or cannot be computed, and
    * rethrow it. Otherwise it behaves the same as {@link #checkFooter(ChecksumIndexInput)}.
-   * <p>
-   * Example usage:
+   *
+   * <p>Example usage:
+   *
    * <pre class="prettyprint">
    * try (ChecksumIndexInput input = ...) {
    *   Throwable priorE = null;
    *   try {
-   *     // ... read a bunch of stuff ... 
+   *     // ... read a bunch of stuff ...
    *   } catch (Throwable exception) {
    *     priorE = exception;
    *   } finally {
@@ -443,7 +466,8 @@ public final class CodecUtil {
    * }
    * </pre>
    */
-  public static void checkFooter(ChecksumIndexInput in, Throwable priorException) throws IOException {
+  public static void checkFooter(ChecksumIndexInput in, Throwable priorException)
+      throws IOException {
     if (priorException == null) {
       checkFooter(in);
     } else {
@@ -455,44 +479,60 @@ public final class CodecUtil {
         long remaining = in.length() - in.getFilePointer();
         if (remaining < footerLength()) {
           // corruption caused us to read into the checksum footer already: we can't proceed
-          throw new CorruptIndexException("checksum status indeterminate: remaining=" + remaining +
-                                          "; please run checkindex for more details", in);
+          throw new CorruptIndexException(
+              "checksum status indeterminate: remaining="
+                  + remaining
+                  + "; please run checkindex for more details",
+              in);
         } else {
           // otherwise, skip any unread bytes.
           in.skipBytes(remaining - footerLength());
-          
+
           // now check the footer
           long checksum = checkFooter(in);
-          priorException.addSuppressed(new CorruptIndexException("checksum passed (" + Long.toHexString(checksum) +
-                                                                 "). possibly transient resource issue, or a Lucene or JVM bug", in));
+          priorException.addSuppressed(
+              new CorruptIndexException(
+                  "checksum passed ("
+                      + Long.toHexString(checksum)
+                      + "). possibly transient resource issue, or a Lucene or JVM bug",
+                  in));
         }
       } catch (CorruptIndexException corruptException) {
         corruptException.addSuppressed(priorException);
         throw corruptException;
       } catch (Throwable t) {
         // catch-all for things that shouldn't go wrong (e.g. OOM during readInt) but could...
-        priorException.addSuppressed(new CorruptIndexException("checksum status indeterminate: unexpected exception", in, t));
+        priorException.addSuppressed(
+            new CorruptIndexException(
+                "checksum status indeterminate: unexpected exception", in, t));
       }
       throw IOUtils.rethrowAlways(priorException);
     }
   }
-  
-  /** 
+
+  /**
    * Returns (but does not validate) the checksum previously written by {@link #checkFooter}.
+   *
    * @return actual checksum value
    * @throws IOException if the footer is invalid
    */
   public static long retrieveChecksum(IndexInput in) throws IOException {
     if (in.length() < footerLength()) {
-      throw new CorruptIndexException("misplaced codec footer (file truncated?): length=" + in.length() + " but footerLength==" + footerLength(), in);
+      throw new CorruptIndexException(
+          "misplaced codec footer (file truncated?): length="
+              + in.length()
+              + " but footerLength=="
+              + footerLength(),
+          in);
     }
     in.seek(in.length() - footerLength());
     validateFooter(in);
     return readCRC(in);
   }
 
-  /** 
+  /**
    * Returns (but does not validate) the checksum previously written by {@link #checkFooter}.
+   *
    * @return actual checksum value
    * @throws IOException if the footer is invalid
    */
@@ -501,9 +541,11 @@ public final class CodecUtil {
       throw new IllegalArgumentException("expectedLength cannot be less than the footer length");
     }
     if (in.length() < expectedLength) {
-      throw new CorruptIndexException("truncated file: length=" + in.length() + " but expectedLength==" + expectedLength, in);
+      throw new CorruptIndexException(
+          "truncated file: length=" + in.length() + " but expectedLength==" + expectedLength, in);
     } else if (in.length() > expectedLength) {
-      throw new CorruptIndexException("file too long: length=" + in.length() + " but expectedLength==" + expectedLength, in);
+      throw new CorruptIndexException(
+          "file too long: length=" + in.length() + " but expectedLength==" + expectedLength, in);
     }
 
     return retrieveChecksum(in);
@@ -513,27 +555,47 @@ public final class CodecUtil {
     long remaining = in.length() - in.getFilePointer();
     long expected = footerLength();
     if (remaining < expected) {
-      throw new CorruptIndexException("misplaced codec footer (file truncated?): remaining=" + remaining + ", expected=" + expected + ", fp=" + in.getFilePointer(), in);
+      throw new CorruptIndexException(
+          "misplaced codec footer (file truncated?): remaining="
+              + remaining
+              + ", expected="
+              + expected
+              + ", fp="
+              + in.getFilePointer(),
+          in);
     } else if (remaining > expected) {
-      throw new CorruptIndexException("misplaced codec footer (file extended?): remaining=" + remaining + ", expected=" + expected + ", fp=" + in.getFilePointer(), in);
+      throw new CorruptIndexException(
+          "misplaced codec footer (file extended?): remaining="
+              + remaining
+              + ", expected="
+              + expected
+              + ", fp="
+              + in.getFilePointer(),
+          in);
     }
-    
+
     final int magic = in.readInt();
     if (magic != FOOTER_MAGIC) {
-      throw new CorruptIndexException("codec footer mismatch (file truncated?): actual footer=" + magic + " vs expected footer=" + FOOTER_MAGIC, in);
+      throw new CorruptIndexException(
+          "codec footer mismatch (file truncated?): actual footer="
+              + magic
+              + " vs expected footer="
+              + FOOTER_MAGIC,
+          in);
     }
-    
+
     final int algorithmID = in.readInt();
     if (algorithmID != 0) {
-      throw new CorruptIndexException("codec footer mismatch: unknown algorithmID: " + algorithmID, in);
+      throw new CorruptIndexException(
+          "codec footer mismatch: unknown algorithmID: " + algorithmID, in);
     }
   }
-  
-  /** 
-   * Clones the provided input, reads all bytes from the file, and calls {@link #checkFooter} 
-   * <p>
-   * Note that this method may be slow, as it must process the entire file.
-   * If you just need to extract the checksum value, call {@link #retrieveChecksum}.
+
+  /**
+   * Clones the provided input, reads all bytes from the file, and calls {@link #checkFooter}
+   *
+   * <p>Note that this method may be slow, as it must process the entire file. If you just need to
+   * extract the checksum value, call {@link #retrieveChecksum}.
    */
   public static long checksumEntireFile(IndexInput input) throws IOException {
     IndexInput clone = input.clone();
@@ -541,14 +603,20 @@ public final class CodecUtil {
     ChecksumIndexInput in = new BufferedChecksumIndexInput(clone);
     assert in.getFilePointer() == 0;
     if (in.length() < footerLength()) {
-      throw new CorruptIndexException("misplaced codec footer (file truncated?): length=" + in.length() + " but footerLength==" + footerLength(), input);
+      throw new CorruptIndexException(
+          "misplaced codec footer (file truncated?): length="
+              + in.length()
+              + " but footerLength=="
+              + footerLength(),
+          input);
     }
     in.seek(in.length() - footerLength());
     return checkFooter(in);
   }
-  
+
   /**
    * Reads CRC32 value as a 64-bit long from the input.
+   *
    * @throws CorruptIndexException if CRC is formatted incorrectly (wrong bits set)
    * @throws IOException if an i/o error occurs
    */
@@ -559,16 +627,18 @@ public final class CodecUtil {
     }
     return value;
   }
-  
+
   /**
    * Writes CRC32 value as a 64-bit long to the output.
+   *
    * @throws IllegalStateException if CRC is formatted incorrectly (wrong bits set)
    * @throws IOException if an i/o error occurs
    */
   static void writeCRC(IndexOutput output) throws IOException {
     long value = output.getChecksum();
     if ((value & 0xFFFFFFFF00000000L) != 0) {
-      throw new IllegalStateException("Illegal CRC-32 checksum: " + value + " (resource=" + output + ")");
+      throw new IllegalStateException(
+          "Illegal CRC-32 checksum: " + value + " (resource=" + output + ")");
     }
     output.writeLong(value);
   }
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/CompetitiveImpactAccumulator.java b/lucene/core/src/java/org/apache/lucene/codecs/CompetitiveImpactAccumulator.java
index fca6455..247cd17 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/CompetitiveImpactAccumulator.java
+++ b/lucene/core/src/java/org/apache/lucene/codecs/CompetitiveImpactAccumulator.java
@@ -24,12 +24,9 @@ import java.util.Comparator;
 import java.util.Iterator;
 import java.util.List;
 import java.util.TreeSet;
-
 import org.apache.lucene.index.Impact;
 
-/**
- * This class accumulates the (freq, norm) pairs that may produce competitive scores.
- */
+/** This class accumulates the (freq, norm) pairs that may produce competitive scores. */
 public final class CompetitiveImpactAccumulator {
 
   // We speed up accumulation for common norm values with this array that maps
@@ -44,18 +41,19 @@ public final class CompetitiveImpactAccumulator {
   /** Sole constructor. */
   public CompetitiveImpactAccumulator() {
     maxFreqs = new int[256];
-    Comparator<Impact> comparator = new Comparator<Impact>() {
-      @Override
-      public int compare(Impact o1, Impact o2) {
-        // greater freqs compare greater
-        int cmp = Integer.compare(o1.freq, o2.freq);
-        if (cmp == 0) {
-          // greater norms compare lower
-          cmp = Long.compareUnsigned(o2.norm, o1.norm);
-        }
-        return cmp;
-      }
-    };
+    Comparator<Impact> comparator =
+        new Comparator<Impact>() {
+          @Override
+          public int compare(Impact o1, Impact o2) {
+            // greater freqs compare greater
+            int cmp = Integer.compare(o1.freq, o2.freq);
+            if (cmp == 0) {
+              // greater norms compare lower
+              cmp = Long.compareUnsigned(o2.norm, o1.norm);
+            }
+            return cmp;
+          }
+        };
     otherFreqNormPairs = new TreeSet<>(comparator);
   }
 
@@ -66,12 +64,14 @@ public final class CompetitiveImpactAccumulator {
     assert assertConsistent();
   }
 
-  /** Accumulate a (freq,norm) pair, updating this structure if there is no
-   *  equivalent or more competitive entry already. */
+  /**
+   * Accumulate a (freq,norm) pair, updating this structure if there is no equivalent or more
+   * competitive entry already.
+   */
   public void add(int freq, long norm) {
     if (norm >= Byte.MIN_VALUE && norm <= Byte.MAX_VALUE) {
       int index = Byte.toUnsignedInt((byte) norm);
-      maxFreqs[index] = Math.max(maxFreqs[index], freq); 
+      maxFreqs[index] = Math.max(maxFreqs[index], freq);
     } else {
       add(new Impact(freq, norm), otherFreqNormPairs);
     }
@@ -131,7 +131,8 @@ public final class CompetitiveImpactAccumulator {
       freqNormPairs.add(newEntry);
     }
 
-    for (Iterator<Impact> it = freqNormPairs.headSet(newEntry, false).descendingIterator(); it.hasNext(); ) {
+    for (Iterator<Impact> it = freqNormPairs.headSet(newEntry, false).descendingIterator();
+        it.hasNext(); ) {
       Impact entry = it.next();
       if (Long.compareUnsigned(entry.norm, newEntry.norm) >= 0) {
         // less competitive
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/CompoundDirectory.java b/lucene/core/src/java/org/apache/lucene/codecs/CompoundDirectory.java
index f063a12..362b5b3 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/CompoundDirectory.java
+++ b/lucene/core/src/java/org/apache/lucene/codecs/CompoundDirectory.java
@@ -18,7 +18,6 @@ package org.apache.lucene.codecs;
 
 import java.io.IOException;
 import java.util.Collection;
-
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.store.IOContext;
 import org.apache.lucene.store.IndexOutput;
@@ -26,6 +25,7 @@ import org.apache.lucene.store.Lock;
 
 /**
  * A read-only {@link Directory} that consists of a view over a compound file.
+ *
  * @see CompoundFormat
  * @lucene.experimental
  */
@@ -36,29 +36,34 @@ public abstract class CompoundDirectory extends Directory {
 
   /**
    * Checks consistency of this directory.
-   * <p>
-   * Note that this may be costly in terms of I/O, e.g.
-   * may involve computing a checksum value against large data files.
+   *
+   * <p>Note that this may be costly in terms of I/O, e.g. may involve computing a checksum value
+   * against large data files.
    */
   public abstract void checkIntegrity() throws IOException;
 
-  /** Not implemented
-   * @throws UnsupportedOperationException always: not supported by CFS */
+  /**
+   * Not implemented
+   *
+   * @throws UnsupportedOperationException always: not supported by CFS
+   */
   @Override
   public final void deleteFile(String name) {
     throw new UnsupportedOperationException();
   }
-  
-  /** Not implemented
-   * @throws UnsupportedOperationException always: not supported by CFS */
+
+  /**
+   * Not implemented
+   *
+   * @throws UnsupportedOperationException always: not supported by CFS
+   */
   @Override
   public final void rename(String from, String to) {
     throw new UnsupportedOperationException();
   }
 
   @Override
-  public final void syncMetaData() {
-  }
+  public final void syncMetaData() {}
 
   @Override
   public final IndexOutput createOutput(String name, IOContext context) throws IOException {
@@ -66,18 +71,18 @@ public abstract class CompoundDirectory extends Directory {
   }
 
   @Override
-  public final IndexOutput createTempOutput(String prefix, String suffix, IOContext context) throws IOException {
+  public final IndexOutput createTempOutput(String prefix, String suffix, IOContext context)
+      throws IOException {
     throw new UnsupportedOperationException();
   }
-  
+
   @Override
   public final void sync(Collection<String> names) {
     throw new UnsupportedOperationException();
   }
-  
+
   @Override
   public final Lock obtainLock(String name) {
     throw new UnsupportedOperationException();
   }
-
 }
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/CompoundFormat.java b/lucene/core/src/java/org/apache/lucene/codecs/CompoundFormat.java
index d74eced..371e192 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/CompoundFormat.java
+++ b/lucene/core/src/java/org/apache/lucene/codecs/CompoundFormat.java
@@ -16,15 +16,14 @@
  */
 package org.apache.lucene.codecs;
 
-
 import java.io.IOException;
-
 import org.apache.lucene.index.SegmentInfo;
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.store.IOContext;
 
 /**
  * Encodes/decodes compound files
+ *
  * @lucene.experimental
  */
 public abstract class CompoundFormat {
@@ -34,16 +33,15 @@ public abstract class CompoundFormat {
 
   // TODO: this is very minimal. If we need more methods,
   // we can add 'producer' classes.
-  
-  /**
-   * Returns a Directory view (read-only) for the compound files in this segment
-   */
-  public abstract CompoundDirectory getCompoundReader(Directory dir, SegmentInfo si, IOContext context) throws IOException;
+
+  /** Returns a Directory view (read-only) for the compound files in this segment */
+  public abstract CompoundDirectory getCompoundReader(
+      Directory dir, SegmentInfo si, IOContext context) throws IOException;
 
   /**
-   * Packs the provided segment's files into a compound format.  All files referenced
-   * by the provided {@link SegmentInfo} must have {@link CodecUtil#writeIndexHeader}
-   * and {@link CodecUtil#writeFooter}.
+   * Packs the provided segment's files into a compound format. All files referenced by the provided
+   * {@link SegmentInfo} must have {@link CodecUtil#writeIndexHeader} and {@link
+   * CodecUtil#writeFooter}.
    */
   public abstract void write(Directory dir, SegmentInfo si, IOContext context) throws IOException;
 }
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/DocValuesConsumer.java b/lucene/core/src/java/org/apache/lucene/codecs/DocValuesConsumer.java
index c4bae5c..6320f97 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/DocValuesConsumer.java
+++ b/lucene/core/src/java/org/apache/lucene/codecs/DocValuesConsumer.java
@@ -16,12 +16,13 @@
  */
 package org.apache.lucene.codecs;
 
+import static org.apache.lucene.search.DocIdSetIterator.NO_MORE_DOCS;
+
 import java.io.Closeable;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
-
 import org.apache.lucene.index.BinaryDocValues;
 import org.apache.lucene.index.DocIDMerger;
 import org.apache.lucene.index.DocValues;
@@ -47,86 +48,88 @@ import org.apache.lucene.util.LongBitSet;
 import org.apache.lucene.util.LongValues;
 import org.apache.lucene.util.packed.PackedInts;
 
-import static org.apache.lucene.search.DocIdSetIterator.NO_MORE_DOCS;
-
-/** 
- * Abstract API that consumes numeric, binary and
- * sorted docvalues.  Concrete implementations of this
- * actually do "something" with the docvalues (write it into
- * the index in a specific format).
- * <p>
- * The lifecycle is:
+/**
+ * Abstract API that consumes numeric, binary and sorted docvalues. Concrete implementations of this
+ * actually do "something" with the docvalues (write it into the index in a specific format).
+ *
+ * <p>The lifecycle is:
+ *
  * <ol>
- *   <li>DocValuesConsumer is created by 
- *       {@link NormsFormat#normsConsumer(SegmentWriteState)}.
- *   <li>{@link #addNumericField}, {@link #addBinaryField},
- *       {@link #addSortedField}, {@link #addSortedSetField},
- *       or {@link #addSortedNumericField} are called for each Numeric,
- *       Binary, Sorted, SortedSet, or SortedNumeric docvalues field. 
- *       The API is a "pull" rather than "push", and the implementation 
- *       is free to iterate over the values multiple times 
- *       ({@link Iterable#iterator()}).
+ *   <li>DocValuesConsumer is created by {@link NormsFormat#normsConsumer(SegmentWriteState)}.
+ *   <li>{@link #addNumericField}, {@link #addBinaryField}, {@link #addSortedField}, {@link
+ *       #addSortedSetField}, or {@link #addSortedNumericField} are called for each Numeric, Binary,
+ *       Sorted, SortedSet, or SortedNumeric docvalues field. The API is a "pull" rather than
+ *       "push", and the implementation is free to iterate over the values multiple times ({@link
+ *       Iterable#iterator()}).
  *   <li>After all fields are added, the consumer is {@link #close}d.
  * </ol>
  *
  * @lucene.experimental
  */
 public abstract class DocValuesConsumer implements Closeable {
-  
-  /** Sole constructor. (For invocation by subclass 
-   *  constructors, typically implicit.) */
+
+  /** Sole constructor. (For invocation by subclass constructors, typically implicit.) */
   protected DocValuesConsumer() {}
 
   /**
    * Writes numeric docvalues for a field.
+   *
    * @param field field information
    * @param valuesProducer Numeric values to write.
    * @throws IOException if an I/O error occurred.
    */
-  public abstract void addNumericField(FieldInfo field, DocValuesProducer valuesProducer) throws IOException;    
+  public abstract void addNumericField(FieldInfo field, DocValuesProducer valuesProducer)
+      throws IOException;
 
   /**
    * Writes binary docvalues for a field.
+   *
    * @param field field information
    * @param valuesProducer Binary values to write.
    * @throws IOException if an I/O error occurred.
    */
-  public abstract void addBinaryField(FieldInfo field, DocValuesProducer valuesProducer) throws IOException;
+  public abstract void addBinaryField(FieldInfo field, DocValuesProducer valuesProducer)
+      throws IOException;
 
   /**
    * Writes pre-sorted binary docvalues for a field.
+   *
    * @param field field information
    * @param valuesProducer produces the values and ordinals to write
    * @throws IOException if an I/O error occurred.
    */
-  public abstract void addSortedField(FieldInfo field, DocValuesProducer valuesProducer) throws IOException;
-  
+  public abstract void addSortedField(FieldInfo field, DocValuesProducer valuesProducer)
+      throws IOException;
+
   /**
    * Writes pre-sorted numeric docvalues for a field
+   *
    * @param field field information
    * @param valuesProducer produces the values to write
    * @throws IOException if an I/O error occurred.
    */
-  public abstract void addSortedNumericField(FieldInfo field, DocValuesProducer valuesProducer) throws IOException;
+  public abstract void addSortedNumericField(FieldInfo field, DocValuesProducer valuesProducer)
+      throws IOException;
 
   /**
    * Writes pre-sorted set docvalues for a field
+   *
    * @param field field information
    * @param valuesProducer produces the values to write
    * @throws IOException if an I/O error occurred.
    */
-  public abstract void addSortedSetField(FieldInfo field, DocValuesProducer valuesProducer) throws IOException;
-  
-  /** Merges in the fields from the readers in 
-   *  <code>mergeState</code>. The default implementation 
-   *  calls {@link #mergeNumericField}, {@link #mergeBinaryField},
-   *  {@link #mergeSortedField}, {@link #mergeSortedSetField},
-   *  or {@link #mergeSortedNumericField} for each field,
-   *  depending on its type.
-   *  Implementations can override this method 
-   *  for more sophisticated merging (bulk-byte copying, etc). */
+  public abstract void addSortedSetField(FieldInfo field, DocValuesProducer valuesProducer)
+      throws IOException;
+
+  /**
+   * Merges in the fields from the readers in <code>mergeState</code>. The default implementation
+   * calls {@link #mergeNumericField}, {@link #mergeBinaryField}, {@link #mergeSortedField}, {@link
+   * #mergeSortedSetField}, or {@link #mergeSortedNumericField} for each field, depending on its
+   * type. Implementations can override this method for more sophisticated merging (bulk-byte
+   * copying, etc).
+   */
   public void merge(MergeState mergeState) throws IOException {
-    for(DocValuesProducer docValuesProducer : mergeState.docValuesProducers) {
+    for (DocValuesProducer docValuesProducer : mergeState.docValuesProducers) {
       if (docValuesProducer != null) {
         docValuesProducer.checkIntegrity();
       }
@@ -168,88 +171,92 @@ public abstract class DocValuesConsumer implements Closeable {
       return values.nextDoc();
     }
   }
-  
+
   /**
    * Merges the numeric docvalues from <code>MergeState</code>.
-   * <p>
-   * The default implementation calls {@link #addNumericField}, passing
-   * a DocValuesProducer that merges and filters deleted documents on the fly.
+   *
+   * <p>The default implementation calls {@link #addNumericField}, passing a DocValuesProducer that
+   * merges and filters deleted documents on the fly.
    */
-  public void mergeNumericField(final FieldInfo mergeFieldInfo, final MergeState mergeState) throws IOException {
-    addNumericField(mergeFieldInfo,
-                    new EmptyDocValuesProducer() {
-                      @Override
-                      public NumericDocValues getNumeric(FieldInfo fieldInfo) throws IOException {
-                        if (fieldInfo != mergeFieldInfo) {
-                          throw new IllegalArgumentException("wrong fieldInfo");
-                        }
-
-                        List<NumericDocValuesSub> subs = new ArrayList<>();
-                        assert mergeState.docMaps.length == mergeState.docValuesProducers.length;
-                        long cost = 0;
-                        for (int i=0;i<mergeState.docValuesProducers.length;i++) {
-                          NumericDocValues values = null;
-                          DocValuesProducer docValuesProducer = mergeState.docValuesProducers[i];
-                          if (docValuesProducer != null) {
-                            FieldInfo readerFieldInfo = mergeState.fieldInfos[i].fieldInfo(mergeFieldInfo.name);
-                            if (readerFieldInfo != null && readerFieldInfo.getDocValuesType() == DocValuesType.NUMERIC) {
-                              values = docValuesProducer.getNumeric(readerFieldInfo);
-                            }
-                          }
-                          if (values != null) {
-                            cost += values.cost();
-                            subs.add(new NumericDocValuesSub(mergeState.docMaps[i], values));
-                          }
-                        }
-
-                        final DocIDMerger<NumericDocValuesSub> docIDMerger = DocIDMerger.of(subs, mergeState.needsIndexSort);
-
-                        final long finalCost = cost;
-                        
-                        return new NumericDocValues() {
-                          private int docID = -1;
-                          private NumericDocValuesSub current;
-
-                          @Override
-                          public int docID() {
-                            return docID;
-                          }
-
-                          @Override
-                          public int nextDoc() throws IOException {
-                            current = docIDMerger.next();
-                            if (current == null) {
-                              docID = NO_MORE_DOCS;
-                            } else {
-                              docID = current.mappedDocID;
-                            }
-                            return docID;
-                          }
-
-                          @Override
-                          public int advance(int target) throws IOException {
-                            throw new UnsupportedOperationException();
-                          }
-
-                          @Override
-                          public boolean advanceExact(int target) throws IOException {
-                            throw new UnsupportedOperationException();
-                          }
-
-                          @Override
-                          public long cost() {
-                            return finalCost;
-                          }
-
-                          @Override
-                          public long longValue() throws IOException {
-                            return current.values.longValue();
-                          }
-                        };
-                      }
-                    });
+  public void mergeNumericField(final FieldInfo mergeFieldInfo, final MergeState mergeState)
+      throws IOException {
+    addNumericField(
+        mergeFieldInfo,
+        new EmptyDocValuesProducer() {
+          @Override
+          public NumericDocValues getNumeric(FieldInfo fieldInfo) throws IOException {
+            if (fieldInfo != mergeFieldInfo) {
+              throw new IllegalArgumentException("wrong fieldInfo");
+            }
+
+            List<NumericDocValuesSub> subs = new ArrayList<>();
+            assert mergeState.docMaps.length == mergeState.docValuesProducers.length;
+            long cost = 0;
+            for (int i = 0; i < mergeState.docValuesProducers.length; i++) {
+              NumericDocValues values = null;
+              DocValuesProducer docValuesProducer = mergeState.docValuesProducers[i];
+              if (docValuesProducer != null) {
+                FieldInfo readerFieldInfo = mergeState.fieldInfos[i].fieldInfo(mergeFieldInfo.name);
+                if (readerFieldInfo != null
+                    && readerFieldInfo.getDocValuesType() == DocValuesType.NUMERIC) {
+                  values = docValuesProducer.getNumeric(readerFieldInfo);
+                }
+              }
+              if (values != null) {
+                cost += values.cost();
+                subs.add(new NumericDocValuesSub(mergeState.docMaps[i], values));
+              }
+            }
+
+            final DocIDMerger<NumericDocValuesSub> docIDMerger =
+                DocIDMerger.of(subs, mergeState.needsIndexSort);
+
+            final long finalCost = cost;
+
+            return new NumericDocValues() {
+              private int docID = -1;
+              private NumericDocValuesSub current;
+
+              @Override
+              public int docID() {
+                return docID;
+              }
+
+              @Override
+              public int nextDoc() throws IOException {
+                current = docIDMerger.next();
+                if (current == null) {
+                  docID = NO_MORE_DOCS;
+                } else {
+                  docID = current.mappedDocID;
+                }
+                return docID;
+              }
+
+              @Override
+              public int advance(int target) throws IOException {
+                throw new UnsupportedOperationException();
+              }
+
+              @Override
+              public boolean advanceExact(int target) throws IOException {
+                throw new UnsupportedOperationException();
+              }
+
+              @Override
+              public long cost() {
+                return finalCost;
+              }
+
+              @Override
+              public long longValue() throws IOException {
+                return current.values.longValue();
+              }
+            };
+          }
+        });
   }
-  
+
   /** Tracks state of one binary sub-reader that we are merging */
   private static class BinaryDocValuesSub extends DocIDMerger.Sub {
 
@@ -269,82 +276,86 @@ public abstract class DocValuesConsumer implements Closeable {
 
   /**
    * Merges the binary docvalues from <code>MergeState</code>.
-   * <p>
-   * The default implementation calls {@link #addBinaryField}, passing
-   * a DocValuesProducer that merges and filters deleted documents on the fly.
+   *
+   * <p>The default implementation calls {@link #addBinaryField}, passing a DocValuesProducer that
+   * merges and filters deleted documents on the fly.
    */
-  public void mergeBinaryField(FieldInfo mergeFieldInfo, final MergeState mergeState) throws IOException {
-    addBinaryField(mergeFieldInfo,
-                   new EmptyDocValuesProducer() {
-                     @Override
-                     public BinaryDocValues getBinary(FieldInfo fieldInfo) throws IOException {
-                       if (fieldInfo != mergeFieldInfo) {
-                         throw new IllegalArgumentException("wrong fieldInfo");
-                       }
-                   
-                       List<BinaryDocValuesSub> subs = new ArrayList<>();
-
-                       long cost = 0;
-                       for (int i=0;i<mergeState.docValuesProducers.length;i++) {
-                         BinaryDocValues values = null;
-                         DocValuesProducer docValuesProducer = mergeState.docValuesProducers[i];
-                         if (docValuesProducer != null) {
-                           FieldInfo readerFieldInfo = mergeState.fieldInfos[i].fieldInfo(mergeFieldInfo.name);
-                           if (readerFieldInfo != null && readerFieldInfo.getDocValuesType() == DocValuesType.BINARY) {
-                             values = docValuesProducer.getBinary(readerFieldInfo);
-                           }
-                         }
-                         if (values != null) {
-                           cost += values.cost();
-                           subs.add(new BinaryDocValuesSub(mergeState.docMaps[i], values));
-                         }
-                       }
-
-                       final DocIDMerger<BinaryDocValuesSub> docIDMerger = DocIDMerger.of(subs, mergeState.needsIndexSort);
-                       final long finalCost = cost;
-                       
-                       return new BinaryDocValues() {
-                         private BinaryDocValuesSub current;
-                         private int docID = -1;
-
-                         @Override
-                         public int docID() {
-                           return docID;
-                         }
-
-                         @Override
-                         public int nextDoc() throws IOException {
-                           current = docIDMerger.next();
-                           if (current == null) {
-                             docID = NO_MORE_DOCS;
-                           } else {
-                             docID = current.mappedDocID;
-                           }
-                           return docID;
-                         }
-
-                         @Override
-                         public int advance(int target) throws IOException {
-                           throw new UnsupportedOperationException();
-                         }
-
-                         @Override
-                         public boolean advanceExact(int target) throws IOException {
-                           throw new UnsupportedOperationException();
-                         }
-
-                         @Override
-                         public long cost() {
-                           return finalCost;
-                         }
-
-                         @Override
-                         public BytesRef binaryValue() throws IOException {
-                           return current.values.binaryValue();
-                         }
-                       };
-                     }
-                   });
+  public void mergeBinaryField(FieldInfo mergeFieldInfo, final MergeState mergeState)
+      throws IOException {
+    addBinaryField(
+        mergeFieldInfo,
+        new EmptyDocValuesProducer() {
+          @Override
+          public BinaryDocValues getBinary(FieldInfo fieldInfo) throws IOException {
+            if (fieldInfo != mergeFieldInfo) {
+              throw new IllegalArgumentException("wrong fieldInfo");
+            }
+
+            List<BinaryDocValuesSub> subs = new ArrayList<>();
+
+            long cost = 0;
+            for (int i = 0; i < mergeState.docValuesProducers.length; i++) {
+              BinaryDocValues values = null;
+              DocValuesProducer docValuesProducer = mergeState.docValuesProducers[i];
+              if (docValuesProducer != null) {
+                FieldInfo readerFieldInfo = mergeState.fieldInfos[i].fieldInfo(mergeFieldInfo.name);
+                if (readerFieldInfo != null
+                    && readerFieldInfo.getDocValuesType() == DocValuesType.BINARY) {
+                  values = docValuesProducer.getBinary(readerFieldInfo);
+                }
+              }
+              if (values != null) {
+                cost += values.cost();
+                subs.add(new BinaryDocValuesSub(mergeState.docMaps[i], values));
+              }
+            }
+
+            final DocIDMerger<BinaryDocValuesSub> docIDMerger =
+                DocIDMerger.of(subs, mergeState.needsIndexSort);
+            final long finalCost = cost;
+
+            return new BinaryDocValues() {
+              private BinaryDocValuesSub current;
+              private int docID = -1;
+
+              @Override
+              public int docID() {
+                return docID;
+              }
+
+              @Override
+              public int nextDoc() throws IOException {
+                current = docIDMerger.next();
+                if (current == null) {
+                  docID = NO_MORE_DOCS;
+                } else {
+                  docID = current.mappedDocID;
+                }
+                return docID;
+              }
+
+              @Override
+              public int advance(int target) throws IOException {
+                throw new UnsupportedOperationException();
+              }
+
+              @Override
+              public boolean advanceExact(int target) throws IOException {
+                throw new UnsupportedOperationException();
+              }
+
+              @Override
+              public long cost() {
+                return finalCost;
+              }
+
+              @Override
+              public BytesRef binaryValue() throws IOException {
+                return current.values.binaryValue();
+              }
+            };
+          }
+        });
   }
 
   /** Tracks state of one sorted numeric sub-reader that we are merging */
@@ -366,98 +377,102 @@ public abstract class DocValuesConsumer implements Closeable {
 
   /**
    * Merges the sorted docvalues from <code>toMerge</code>.
-   * <p>
-   * The default implementation calls {@link #addSortedNumericField}, passing
-   * iterables that filter deleted documents.
+   *
+   * <p>The default implementation calls {@link #addSortedNumericField}, passing iterables that
+   * filter deleted documents.
    */
-  public void mergeSortedNumericField(FieldInfo mergeFieldInfo, final MergeState mergeState) throws IOException {
-    
-    addSortedNumericField(mergeFieldInfo,
-                          new EmptyDocValuesProducer() {
-                            @Override
-                            public SortedNumericDocValues getSortedNumeric(FieldInfo fieldInfo) throws IOException {
-                              if (fieldInfo != mergeFieldInfo) {
-                                throw new IllegalArgumentException("wrong FieldInfo");
-                              }
-                              
-                              // We must make new iterators + DocIDMerger for each iterator:
-                              List<SortedNumericDocValuesSub> subs = new ArrayList<>();
-                              long cost = 0;
-                              for (int i=0;i<mergeState.docValuesProducers.length;i++) {
-                                DocValuesProducer docValuesProducer = mergeState.docValuesProducers[i];
-                                SortedNumericDocValues values = null;
-                                if (docValuesProducer != null) {
-                                  FieldInfo readerFieldInfo = mergeState.fieldInfos[i].fieldInfo(mergeFieldInfo.name);
-                                  if (readerFieldInfo != null && readerFieldInfo.getDocValuesType() == DocValuesType.SORTED_NUMERIC) {
-                                    values = docValuesProducer.getSortedNumeric(readerFieldInfo);
-                                  }
-                                }
-                                if (values == null) {
-                                  values = DocValues.emptySortedNumeric();
-                                }
-                                cost += values.cost();
-                                subs.add(new SortedNumericDocValuesSub(mergeState.docMaps[i], values));
-                              }
-
-                              final long finalCost = cost;
-
-                              final DocIDMerger<SortedNumericDocValuesSub> docIDMerger = DocIDMerger.of(subs, mergeState.needsIndexSort);
-
-                              return new SortedNumericDocValues() {
-
-                                private int docID = -1;
-                                private SortedNumericDocValuesSub currentSub;
-
-                                @Override
-                                public int docID() {
-                                  return docID;
-                                }
-                                
-                                @Override
-                                public int nextDoc() throws IOException {
-                                  currentSub = docIDMerger.next();
-                                  if (currentSub == null) {
-                                    docID = NO_MORE_DOCS;
-                                  } else {
-                                    docID = currentSub.mappedDocID;
-                                  }
-
-                                  return docID;
-                                }
-
-                                @Override
-                                public int advance(int target) throws IOException {
-                                  throw new UnsupportedOperationException();
-                                }
-
-                                @Override
-                                public boolean advanceExact(int target) throws IOException {
-                                  throw new UnsupportedOperationException();
-                                }
-
-                                @Override
-                                public int docValueCount() {
-                                  return currentSub.values.docValueCount();
-                                }
-
-                                @Override
-                                public long cost() {
-                                  return finalCost;
-                                }
-
-                                @Override
-                                public long nextValue() throws IOException {
-                                  return currentSub.values.nextValue();
-                                }
-                              };
-                            }
-                          });
+  public void mergeSortedNumericField(FieldInfo mergeFieldInfo, final MergeState mergeState)
+      throws IOException {
+
+    addSortedNumericField(
+        mergeFieldInfo,
+        new EmptyDocValuesProducer() {
+          @Override
+          public SortedNumericDocValues getSortedNumeric(FieldInfo fieldInfo) throws IOException {
+            if (fieldInfo != mergeFieldInfo) {
+              throw new IllegalArgumentException("wrong FieldInfo");
+            }
+
+            // We must make new iterators + DocIDMerger for each iterator:
+            List<SortedNumericDocValuesSub> subs = new ArrayList<>();
+            long cost = 0;
+            for (int i = 0; i < mergeState.docValuesProducers.length; i++) {
+              DocValuesProducer docValuesProducer = mergeState.docValuesProducers[i];
+              SortedNumericDocValues values = null;
+              if (docValuesProducer != null) {
+                FieldInfo readerFieldInfo = mergeState.fieldInfos[i].fieldInfo(mergeFieldInfo.name);
+                if (readerFieldInfo != null
+                    && readerFieldInfo.getDocValuesType() == DocValuesType.SORTED_NUMERIC) {
+                  values = docValuesProducer.getSortedNumeric(readerFieldInfo);
+                }
+              }
+              if (values == null) {
+                values = DocValues.emptySortedNumeric();
+              }
+              cost += values.cost();
+              subs.add(new SortedNumericDocValuesSub(mergeState.docMaps[i], values));
+            }
+
+            final long finalCost = cost;
+
+            final DocIDMerger<SortedNumericDocValuesSub> docIDMerger =
+                DocIDMerger.of(subs, mergeState.needsIndexSort);
+
+            return new SortedNumericDocValues() {
+
+              private int docID = -1;
+              private SortedNumericDocValuesSub currentSub;
+
+              @Override
+              public int docID() {
+                return docID;
+              }
+
+              @Override
+              public int nextDoc() throws IOException {
+                currentSub = docIDMerger.next();
+                if (currentSub == null) {
+                  docID = NO_MORE_DOCS;
+                } else {
+                  docID = currentSub.mappedDocID;
+                }
+
+                return docID;
+              }
+
+              @Override
+              public int advance(int target) throws IOException {
+                throw new UnsupportedOperationException();
+              }
+
+              @Override
+              public boolean advanceExact(int target) throws IOException {
+                throw new UnsupportedOperationException();
+              }
+
+              @Override
+              public int docValueCount() {
+                return currentSub.values.docValueCount();
+              }
+
+              @Override
+              public long cost() {
+                return finalCost;
+              }
+
+              @Override
+              public long nextValue() throws IOException {
+                return currentSub.values.nextValue();
+              }
+            };
+          }
+        });
   }
 
   /**
-   * A merged {@link TermsEnum}. This helps avoid relying on the default terms enum,
-   * which calls {@link SortedDocValues#lookupOrd(int)} or
-   * {@link SortedSetDocValues#lookupOrd(long)} on every call to {@link TermsEnum#next()}.
+   * A merged {@link TermsEnum}. This helps avoid relying on the default terms enum, which calls
+   * {@link SortedDocValues#lookupOrd(int)} or {@link SortedSetDocValues#lookupOrd(long)} on every
+   * call to {@link TermsEnum#next()}.
    */
   private static class MergedTermsEnum extends TermsEnum {
 
@@ -547,7 +562,6 @@ public abstract class DocValuesConsumer implements Closeable {
     public TermState termState() throws IOException {
       throw new UnsupportedOperationException();
     }
-
   }
 
   /** Tracks state of one sorted sub-reader that we are merging */
@@ -555,7 +569,7 @@ public abstract class DocValuesConsumer implements Closeable {
 
     final SortedDocValues values;
     final LongValues map;
-    
+
     public SortedDocValuesSub(MergeState.DocMap docMap, SortedDocValues values, LongValues map) {
       super(docMap);
       this.values = values;
@@ -571,13 +585,14 @@ public abstract class DocValuesConsumer implements Closeable {
 
   /**
    * Merges the sorted docvalues from <code>toMerge</code>.
-   * <p>
-   * The default implementation calls {@link #addSortedField}, passing
-   * an Iterable that merges ordinals and values and filters deleted documents .
+   *
+   * <p>The default implementation calls {@link #addSortedField}, passing an Iterable that merges
+   * ordinals and values and filters deleted documents .
    */
-  public void mergeSortedField(FieldInfo fieldInfo, final MergeState mergeState) throws IOException {
+  public void mergeSortedField(FieldInfo fieldInfo, final MergeState mergeState)
+      throws IOException {
     List<SortedDocValues> toMerge = new ArrayList<>();
-    for (int i=0;i<mergeState.docValuesProducers.length;i++) {
+    for (int i = 0; i < mergeState.docValuesProducers.length; i++) {
       SortedDocValues values = null;
       DocValuesProducer docValuesProducer = mergeState.docValuesProducers[i];
       if (docValuesProducer != null) {
@@ -594,11 +609,11 @@ public abstract class DocValuesConsumer implements Closeable {
 
     final int numReaders = toMerge.size();
     final SortedDocValues dvs[] = toMerge.toArray(new SortedDocValues[numReaders]);
-    
+
     // step 1: iterate thru each sub and mark terms still in use
     TermsEnum liveTerms[] = new TermsEnum[dvs.length];
     long[] weights = new long[liveTerms.length];
-    for (int sub=0;sub<numReaders;sub++) {
+    for (int sub = 0; sub < numReaders; sub++) {
       SortedDocValues dv = dvs[sub];
       Bits liveDocs = mergeState.liveDocs[sub];
       if (liveDocs == null) {
@@ -619,118 +634,122 @@ public abstract class DocValuesConsumer implements Closeable {
         weights[sub] = bitset.cardinality();
       }
     }
-    
+
     // step 2: create ordinal map (this conceptually does the "merging")
     final OrdinalMap map = OrdinalMap.build(null, liveTerms, weights, PackedInts.COMPACT);
-    
+
     // step 3: add field
-    addSortedField(fieldInfo,
-                   new EmptyDocValuesProducer() {
-                     @Override
-                     public SortedDocValues getSorted(FieldInfo fieldInfoIn) throws IOException {
-                       if (fieldInfoIn != fieldInfo) {
-                         throw new IllegalArgumentException("wrong FieldInfo");
-                       }
-
-                       // We must make new iterators + DocIDMerger for each iterator:
-
-                       List<SortedDocValuesSub> subs = new ArrayList<>();
-                       long cost = 0;
-                       for (int i=0;i<mergeState.docValuesProducers.length;i++) {
-                         SortedDocValues values = null;
-                         DocValuesProducer docValuesProducer = mergeState.docValuesProducers[i];
-                         if (docValuesProducer != null) {
-                           FieldInfo readerFieldInfo = mergeState.fieldInfos[i].fieldInfo(fieldInfo.name);
-                           if (readerFieldInfo != null && readerFieldInfo.getDocValuesType() == DocValuesType.SORTED) {
-                             values = docValuesProducer.getSorted(readerFieldInfo);
-                           }
-                         }
-                         if (values == null) {
-                           values = DocValues.emptySorted();
-                         }
-                         cost += values.cost();
-                         
-                         subs.add(new SortedDocValuesSub(mergeState.docMaps[i], values, map.getGlobalOrds(i)));
-                       }
-
-                       final long finalCost = cost;
-
-                       final DocIDMerger<SortedDocValuesSub> docIDMerger = DocIDMerger.of(subs, mergeState.needsIndexSort);
-                       
-                       return new SortedDocValues() {
-                         private int docID = -1;
-                         private int ord;
-
-                         @Override
-                         public int docID() {
-                           return docID;
-                         }
-
-                         @Override
-                         public int nextDoc() throws IOException {
-                           SortedDocValuesSub sub = docIDMerger.next();
-                           if (sub == null) {
-                             return docID = NO_MORE_DOCS;
-                           }
-                           int subOrd = sub.values.ordValue();
-                           assert subOrd != -1;
-                           ord = (int) sub.map.get(subOrd);
-                           docID = sub.mappedDocID;
-                           return docID;
-                         }
-
-                         @Override
-                         public int ordValue() {
-                           return ord;
-                         }
-                         
-                         @Override
-                         public int advance(int target) {
-                           throw new UnsupportedOperationException();
-                         }
-
-                         @Override
-                         public boolean advanceExact(int target) throws IOException {
-                           throw new UnsupportedOperationException();
-                         }
-
-                         @Override
-                         public long cost() {
-                           return finalCost;
-                         }
-
-                         @Override
-                         public int getValueCount() {
-                           return (int) map.getValueCount();
-                         }
-                         
-                         @Override
-                         public BytesRef lookupOrd(int ord) throws IOException {
-                           int segmentNumber = map.getFirstSegmentNumber(ord);
-                           int segmentOrd = (int) map.getFirstSegmentOrd(ord);
-                           return dvs[segmentNumber].lookupOrd(segmentOrd);
-                         }
-
-                         @Override
-                         public TermsEnum termsEnum() throws IOException {
-                           TermsEnum[] subs = new TermsEnum[toMerge.size()];
-                           for (int sub = 0; sub < subs.length; ++sub) {
-                             subs[sub] = toMerge.get(sub).termsEnum();
-                           }
-                           return new MergedTermsEnum(map, subs);
-                         }
-                       };
-                     }
-                   });
+    addSortedField(
+        fieldInfo,
+        new EmptyDocValuesProducer() {
+          @Override
+          public SortedDocValues getSorted(FieldInfo fieldInfoIn) throws IOException {
+            if (fieldInfoIn != fieldInfo) {
+              throw new IllegalArgumentException("wrong FieldInfo");
+            }
+
+            // We must make new iterators + DocIDMerger for each iterator:
+
+            List<SortedDocValuesSub> subs = new ArrayList<>();
+            long cost = 0;
+            for (int i = 0; i < mergeState.docValuesProducers.length; i++) {
+              SortedDocValues values = null;
+              DocValuesProducer docValuesProducer = mergeState.docValuesProducers[i];
+              if (docValuesProducer != null) {
+                FieldInfo readerFieldInfo = mergeState.fieldInfos[i].fieldInfo(fieldInfo.name);
+                if (readerFieldInfo != null
+                    && readerFieldInfo.getDocValuesType() == DocValuesType.SORTED) {
+                  values = docValuesProducer.getSorted(readerFieldInfo);
+                }
+              }
+              if (values == null) {
+                values = DocValues.emptySorted();
+              }
+              cost += values.cost();
+
+              subs.add(new SortedDocValuesSub(mergeState.docMaps[i], values, map.getGlobalOrds(i)));
+            }
+
+            final long finalCost = cost;
+
+            final DocIDMerger<SortedDocValuesSub> docIDMerger =
+                DocIDMerger.of(subs, mergeState.needsIndexSort);
+
+            return new SortedDocValues() {
+              private int docID = -1;
+              private int ord;
+
+              @Override
+              public int docID() {
+                return docID;
+              }
+
+              @Override
+              public int nextDoc() throws IOException {
+                SortedDocValuesSub sub = docIDMerger.next();
+                if (sub == null) {
+                  return docID = NO_MORE_DOCS;
+                }
+                int subOrd = sub.values.ordValue();
+                assert subOrd != -1;
+                ord = (int) sub.map.get(subOrd);
+                docID = sub.mappedDocID;
+                return docID;
+              }
+
+              @Override
+              public int ordValue() {
+                return ord;
+              }
+
+              @Override
+              public int advance(int target) {
+                throw new UnsupportedOperationException();
+              }
+
+              @Override
+              public boolean advanceExact(int target) throws IOException {
+                throw new UnsupportedOperationException();
+              }
+
+              @Override
+              public long cost() {
+                return finalCost;
+              }
+
+              @Override
+              public int getValueCount() {
+                return (int) map.getValueCount();
+              }
+
+              @Override
+              public BytesRef lookupOrd(int ord) throws IOException {
+                int segmentNumber = map.getFirstSegmentNumber(ord);
+                int segmentOrd = (int) map.getFirstSegmentOrd(ord);
+                return dvs[segmentNumber].lookupOrd(segmentOrd);
+              }
+
+              @Override
+              public TermsEnum termsEnum() throws IOException {
+                TermsEnum[] subs = new TermsEnum[toMerge.size()];
+                for (int sub = 0; sub < subs.length; ++sub) {
+                  subs[sub] = toMerge.get(sub).termsEnum();
+                }
+                return new MergedTermsEnum(map, subs);
+              }
+            };
+          }
+        });
   }
-  
+
   /** Tracks state of one sorted set sub-reader that we are merging */
   private static class SortedSetDocValuesSub extends DocIDMerger.Sub {
 
     final SortedSetDocValues values;
     final LongValues map;
-    
-    public SortedSetDocValuesSub(MergeState.DocMap docMap, SortedSetDocValues values, LongValues map) {
+
+    public SortedSetDocValuesSub(
+        MergeState.DocMap docMap, SortedSetDocValues values, LongValues map) {
       super(docMap);
       this.values = values;
       this.map = map;
@@ -750,14 +769,15 @@ public abstract class DocValuesConsumer implements Closeable {
 
   /**
    * Merges the sortedset docvalues from <code>toMerge</code>.
-   * <p>
-   * The default implementation calls {@link #addSortedSetField}, passing
-   * an Iterable that merges ordinals and values and filters deleted documents .
+   *
+   * <p>The default implementation calls {@link #addSortedSetField}, passing an Iterable that merges
+   * ordinals and values and filters deleted documents .
    */
-  public void mergeSortedSetField(FieldInfo mergeFieldInfo, final MergeState mergeState) throws IOException {
+  public void mergeSortedSetField(FieldInfo mergeFieldInfo, final MergeState mergeState)
+      throws IOException {
 
     List<SortedSetDocValues> toMerge = new ArrayList<>();
-    for (int i=0;i<mergeState.docValuesProducers.length;i++) {
+    for (int i = 0; i < mergeState.docValuesProducers.length; i++) {
       SortedSetDocValues values = null;
       DocValuesProducer docValuesProducer = mergeState.docValuesProducers[i];
       if (docValuesProducer != null) {
@@ -796,118 +816,122 @@ public abstract class DocValuesConsumer implements Closeable {
         weights[sub] = bitset.cardinality();
       }
     }
-    
+
     // step 2: create ordinal map (this conceptually does the "merging")
     final OrdinalMap map = OrdinalMap.build(null, liveTerms, weights, PackedInts.COMPACT);
-    
+
     // step 3: add field
-    addSortedSetField(mergeFieldInfo,
-                      new EmptyDocValuesProducer() {
-                        @Override
-                        public SortedSetDocValues getSortedSet(FieldInfo fieldInfo) throws IOException {
-                          if (fieldInfo != mergeFieldInfo) {
-                            throw new IllegalArgumentException("wrong FieldInfo");
-                          }
-
-                          // We must make new iterators + DocIDMerger for each iterator:
-                          List<SortedSetDocValuesSub> subs = new ArrayList<>();
-
-                          long cost = 0;
-                          
-                          for (int i=0;i<mergeState.docValuesProducers.length;i++) {
-                            SortedSetDocValues values = null;
-                            DocValuesProducer docValuesProducer = mergeState.docValuesProducers[i];
-                            if (docValuesProducer != null) {
-                              FieldInfo readerFieldInfo = mergeState.fieldInfos[i].fieldInfo(mergeFieldInfo.name);
-                              if (readerFieldInfo != null && readerFieldInfo.getDocValuesType() == DocValuesType.SORTED_SET) {
-                                values = docValuesProducer.getSortedSet(readerFieldInfo);
-                              }
-                            }
-                            if (values == null) {
-                              values = DocValues.emptySortedSet();
-                            }
-                            cost += values.cost();
-                            subs.add(new SortedSetDocValuesSub(mergeState.docMaps[i], values, map.getGlobalOrds(i)));
-                          }
-            
-                          final DocIDMerger<SortedSetDocValuesSub> docIDMerger = DocIDMerger.of(subs, mergeState.needsIndexSort);
-                          
-                          final long finalCost = cost;
-
-                          return new SortedSetDocValues() {
-                            private int docID = -1;
-                            private SortedSetDocValuesSub currentSub;
-
-                            @Override
-                            public int docID() {
-                              return docID;
-                            }
-
-                            @Override
-                            public int nextDoc() throws IOException {
-                              currentSub = docIDMerger.next();
-                              if (currentSub == null) {
-                                docID = NO_MORE_DOCS;
-                              } else {
-                                docID = currentSub.mappedDocID;
-                              }
-
-                              return docID;
-                            }
-
-                            @Override
-                            public int advance(int target) throws IOException {
-                              throw new UnsupportedOperationException();
-                            }
-
-                            @Override
-                            public boolean advanceExact(int target) throws IOException {
-                              throw new UnsupportedOperationException();
-                            }
-
-                            @Override
-                            public long nextOrd() throws IOException {
-                              long subOrd = currentSub.values.nextOrd();
-                              if (subOrd == NO_MORE_ORDS) {
-                                return NO_MORE_ORDS;
-                              }
-                              return currentSub.map.get(subOrd);
-                            }
-
-                            @Override
-                            public long cost() {
-                              return finalCost;
-                            }
-
-                            @Override
-                            public BytesRef lookupOrd(long ord) throws IOException {
-                              int segmentNumber = map.getFirstSegmentNumber(ord);
-                              long segmentOrd = map.getFirstSegmentOrd(ord);
-                              return toMerge.get(segmentNumber).lookupOrd(segmentOrd);
-                            }
-
-                            @Override
-                            public long getValueCount() {
-                              return map.getValueCount();
-                            }
-
-                            @Override
-                            public TermsEnum termsEnum() throws IOException {
-                              TermsEnum[] subs = new TermsEnum[toMerge.size()];
-                              for (int sub = 0; sub < subs.length; ++sub) {
-                                subs[sub] = toMerge.get(sub).termsEnum();
-                              }
-                              return new MergedTermsEnum(map, subs);
-                            }
-                          };
-                        }
-                      });
+    addSortedSetField(
+        mergeFieldInfo,
+        new EmptyDocValuesProducer() {
+          @Override
+          public SortedSetDocValues getSortedSet(FieldInfo fieldInfo) throws IOException {
+            if (fieldInfo != mergeFieldInfo) {
+              throw new IllegalArgumentException("wrong FieldInfo");
+            }
+
+            // We must make new iterators + DocIDMerger for each iterator:
+            List<SortedSetDocValuesSub> subs = new ArrayList<>();
+
+            long cost = 0;
+
+            for (int i = 0; i < mergeState.docValuesProducers.length; i++) {
+              SortedSetDocValues values = null;
+              DocValuesProducer docValuesProducer = mergeState.docValuesProducers[i];
+              if (docValuesProducer != null) {
+                FieldInfo readerFieldInfo = mergeState.fieldInfos[i].fieldInfo(mergeFieldInfo.name);
+                if (readerFieldInfo != null
+                    && readerFieldInfo.getDocValuesType() == DocValuesType.SORTED_SET) {
+                  values = docValuesProducer.getSortedSet(readerFieldInfo);
+                }
+              }
+              if (values == null) {
+                values = DocValues.emptySortedSet();
+              }
+              cost += values.cost();
+              subs.add(
+                  new SortedSetDocValuesSub(mergeState.docMaps[i], values, map.getGlobalOrds(i)));
+            }
+
+            final DocIDMerger<SortedSetDocValuesSub> docIDMerger =
+                DocIDMerger.of(subs, mergeState.needsIndexSort);
+
+            final long finalCost = cost;
+
+            return new SortedSetDocValues() {
+              private int docID = -1;
+              private SortedSetDocValuesSub currentSub;
+
+              @Override
+              public int docID() {
+                return docID;
+              }
+
+              @Override
+              public int nextDoc() throws IOException {
+                currentSub = docIDMerger.next();
+                if (currentSub == null) {
+                  docID = NO_MORE_DOCS;
+                } else {
+                  docID = currentSub.mappedDocID;
+                }
+
+                return docID;
+              }
+
+              @Override
+              public int advance(int target) throws IOException {
+                throw new UnsupportedOperationException();
+              }
+
+              @Override
+              public boolean advanceExact(int target) throws IOException {
+                throw new UnsupportedOperationException();
+              }
+
+              @Override
+              public long nextOrd() throws IOException {
+                long subOrd = currentSub.values.nextOrd();
+                if (subOrd == NO_MORE_ORDS) {
+                  return NO_MORE_ORDS;
+                }
+                return currentSub.map.get(subOrd);
+              }
+
+              @Override
+              public long cost() {
+                return finalCost;
+              }
+
+              @Override
+              public BytesRef lookupOrd(long ord) throws IOException {
+                int segmentNumber = map.getFirstSegmentNumber(ord);
+                long segmentOrd = map.getFirstSegmentOrd(ord);
+                return toMerge.get(segmentNumber).lookupOrd(segmentOrd);
+              }
+
+              @Override
+              public long getValueCount() {
+                return map.getValueCount();
+              }
+
+              @Override
+              public TermsEnum termsEnum() throws IOException {
+                TermsEnum[] subs = new TermsEnum[toMerge.size()];
+                for (int sub = 0; sub < subs.length; ++sub) {
+                  subs[sub] = toMerge.get(sub).termsEnum();
+                }
+                return new MergedTermsEnum(map, subs);
+              }
+            };
+          }
+        });
   }
-  
+
   // TODO: seek-by-ord to nextSetBit
   static class BitsFilteredTermsEnum extends FilteredTermsEnum {
     final LongBitSet liveTerms;
-    
+
     BitsFilteredTermsEnum(TermsEnum in, LongBitSet liveTerms) {
       super(in, false); // <-- not passing false here wasted about 3 hours of my time!!!!!!!!!!!!!
       assert liveTerms != null;
@@ -923,7 +947,7 @@ public abstract class DocValuesConsumer implements Closeable {
       }
     }
   }
-  
+
   /** Helper: returns true if the given docToValue count contains only at most one value */
   public static boolean isSingleValued(Iterable<Number> docToValueCount) {
     for (Number count : docToValueCount) {
@@ -933,9 +957,12 @@ public abstract class DocValuesConsumer implements Closeable {
     }
     return true;
   }
-  
+
   /** Helper: returns single-valued view, using {@code missingValue} when count is zero */
-  public static Iterable<Number> singletonView(final Iterable<Number> docToValueCount, final Iterable<Number> values, final Number missingValue) {
+  public static Iterable<Number> singletonView(
+      final Iterable<Number> docToValueCount,
+      final Iterable<Number> values,
+      final Number missingValue) {
     assert isSingleValued(docToValueCount);
     return new Iterable<Number>() {
 
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/DocValuesFormat.java b/lucene/core/src/java/org/apache/lucene/codecs/DocValuesFormat.java
index 511a2b9..7cac0c2 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/DocValuesFormat.java
+++ b/lucene/core/src/java/org/apache/lucene/codecs/DocValuesFormat.java
@@ -16,60 +16,60 @@
  */
 package org.apache.lucene.codecs;
 
-
 import java.io.IOException;
 import java.util.ServiceLoader;
 import java.util.Set;
-
 import org.apache.lucene.index.SegmentReadState;
 import org.apache.lucene.index.SegmentWriteState;
 import org.apache.lucene.util.NamedSPILoader;
 
-/** 
+/**
  * Encodes/decodes per-document values.
- * <p>
- * Note, when extending this class, the name ({@link #getName}) may
- * written into the index in certain configurations. In order for the segment 
- * to be read, the name must resolve to your implementation via {@link #forName(String)}.
- * This method uses Java's 
- * {@link ServiceLoader Service Provider Interface} (SPI) to resolve format names.
- * <p>
- * If you implement your own format, make sure that it has a no-arg constructor
- * so SPI can load it.
+ *
+ * <p>Note, when extending this class, the name ({@link #getName}) may written into the index in
+ * certain configurations. In order for the segment to be read, the name must resolve to your
+ * implementation via {@link #forName(String)}. This method uses Java's {@link ServiceLoader Service
+ * Provider Interface} (SPI) to resolve format names.
+ *
+ * <p>If you implement your own format, make sure that it has a no-arg constructor so SPI can load
+ * it.
+ *
  * @see ServiceLoader
- * @lucene.experimental */
+ * @lucene.experimental
+ */
 public abstract class DocValuesFormat implements NamedSPILoader.NamedSPI {
-  
+
   /**
-   * This static holder class prevents classloading deadlock by delaying
-   * init of doc values formats until needed.
+   * This static holder class prevents classloading deadlock by delaying init of doc values formats
+   * until needed.
    */
   private static final class Holder {
-    private static final NamedSPILoader<DocValuesFormat> LOADER = new NamedSPILoader<>(DocValuesFormat.class);
-    
+    private static final NamedSPILoader<DocValuesFormat> LOADER =
+        new NamedSPILoader<>(DocValuesFormat.class);
+
     private Holder() {}
-    
+
     static NamedSPILoader<DocValuesFormat> getLoader() {
       if (LOADER == null) {
-        throw new IllegalStateException("You tried to lookup a DocValuesFormat by name before all formats could be initialized. "+
-          "This likely happens if you call DocValuesFormat#forName from a DocValuesFormat's ctor.");
+        throw new IllegalStateException(
+            "You tried to lookup a DocValuesFormat by name before all formats could be initialized. "
+                + "This likely happens if you call DocValuesFormat#forName from a DocValuesFormat's ctor.");
       }
       return LOADER;
     }
   }
-  
-  /** Unique name that's used to retrieve this format when
-   *  reading the index.
-   */
+
+  /** Unique name that's used to retrieve this format when reading the index. */
   private final String name;
 
   /**
    * Creates a new docvalues format.
-   * <p>
-   * The provided name will be written into the index segment in some configurations
-   * (such as when using {@code PerFieldDocValuesFormat}): in such configurations,
-   * for the segment to be read this class should be registered with Java's
-   * SPI mechanism (registered in META-INF/ of your jar file, etc).
+   *
+   * <p>The provided name will be written into the index segment in some configurations (such as
+   * when using {@code PerFieldDocValuesFormat}): in such configurations, for the segment to be read
+   * this class should be registered with Java's SPI mechanism (registered in META-INF/ of your jar
+   * file, etc).
+   *
    * @param name must be all ascii alphanumeric, and less than 128 characters in length.
    */
   protected DocValuesFormat(String name) {
@@ -77,18 +77,16 @@ public abstract class DocValuesFormat implements NamedSPILoader.NamedSPI {
     this.name = name;
   }
 
-  /** Returns a {@link DocValuesConsumer} to write docvalues to the
-   *  index. */
+  /** Returns a {@link DocValuesConsumer} to write docvalues to the index. */
   public abstract DocValuesConsumer fieldsConsumer(SegmentWriteState state) throws IOException;
 
-  /** 
-   * Returns a {@link DocValuesProducer} to read docvalues from the index. 
-   * <p>
-   * NOTE: by the time this call returns, it must hold open any files it will 
-   * need to use; else, those files may be deleted. Additionally, required files 
-   * may be deleted during the execution of this call before there is a chance 
-   * to open them. Under these circumstances an IOException should be thrown by 
-   * the implementation. IOExceptions are expected and will automatically cause 
+  /**
+   * Returns a {@link DocValuesProducer} to read docvalues from the index.
+   *
+   * <p>NOTE: by the time this call returns, it must hold open any files it will need to use; else,
+   * those files may be deleted. Additionally, required files may be deleted during the execution of
+   * this call before there is a chance to open them. Under these circumstances an IOException
+   * should be thrown by the implementation. IOExceptions are expected and will automatically cause
    * a retry of the segment opening logic with the newly revised segments.
    */
   public abstract DocValuesProducer fieldsProducer(SegmentReadState state) throws IOException;
@@ -97,32 +95,32 @@ public abstract class DocValuesFormat implements NamedSPILoader.NamedSPI {
   public final String getName() {
     return name;
   }
-  
+
   @Override
   public String toString() {
     return "DocValuesFormat(name=" + name + ")";
   }
-  
+
   /** looks up a format by name */
   public static DocValuesFormat forName(String name) {
     return Holder.getLoader().lookup(name);
   }
-  
+
   /** returns a list of all available format names */
   public static Set<String> availableDocValuesFormats() {
     return Holder.getLoader().availableServices();
   }
-  
-  /** 
-   * Reloads the DocValues format list from the given {@link ClassLoader}.
-   * Changes to the docvalues formats are visible after the method ends, all
-   * iterators ({@link #availableDocValuesFormats()},...) stay consistent. 
-   * 
-   * <p><b>NOTE:</b> Only new docvalues formats are added, existing ones are
-   * never removed or replaced.
-   * 
-   * <p><em>This method is expensive and should only be called for discovery
-   * of new docvalues formats on the given classpath/classloader!</em>
+
+  /**
+   * Reloads the DocValues format list from the given {@link ClassLoader}. Changes to the docvalues
+   * formats are visible after the method ends, all iterators ({@link
+   * #availableDocValuesFormats()},...) stay consistent.
+   *
+   * <p><b>NOTE:</b> Only new docvalues formats are added, existing ones are never removed or
+   * replaced.
+   *
+   * <p><em>This method is expensive and should only be called for discovery of new docvalues
+   * formats on the given classpath/classloader!</em>
    */
   public static void reloadDocValuesFormats(ClassLoader classloader) {
     Holder.getLoader().reload(classloader);
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/DocValuesProducer.java b/lucene/core/src/java/org/apache/lucene/codecs/DocValuesProducer.java
index 5fe0b33..abd975f 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/DocValuesProducer.java
+++ b/lucene/core/src/java/org/apache/lucene/codecs/DocValuesProducer.java
@@ -16,10 +16,8 @@
  */
 package org.apache.lucene.codecs;
 
-
 import java.io.Closeable;
 import java.io.IOException;
-
 import org.apache.lucene.index.BinaryDocValues;
 import org.apache.lucene.index.FieldInfo;
 import org.apache.lucene.index.NumericDocValues;
@@ -28,56 +26,62 @@ import org.apache.lucene.index.SortedNumericDocValues;
 import org.apache.lucene.index.SortedSetDocValues;
 import org.apache.lucene.util.Accountable;
 
-/** Abstract API that produces numeric, binary, sorted, sortedset,
- *  and sortednumeric docvalues.
+/**
+ * Abstract API that produces numeric, binary, sorted, sortedset, and sortednumeric docvalues.
  *
  * @lucene.experimental
  */
 public abstract class DocValuesProducer implements Closeable, Accountable {
-  
-  /** Sole constructor. (For invocation by subclass 
-   *  constructors, typically implicit.) */
+
+  /** Sole constructor. (For invocation by subclass constructors, typically implicit.) */
   protected DocValuesProducer() {}
 
-  /** Returns {@link NumericDocValues} for this field.
-   *  The returned instance need not be thread-safe: it will only be
-   *  used by a single thread. */
+  /**
+   * Returns {@link NumericDocValues} for this field. The returned instance need not be thread-safe:
+   * it will only be used by a single thread.
+   */
   public abstract NumericDocValues getNumeric(FieldInfo field) throws IOException;
 
-  /** Returns {@link BinaryDocValues} for this field.
-   *  The returned instance need not be thread-safe: it will only be
-   *  used by a single thread. */
+  /**
+   * Returns {@link BinaryDocValues} for this field. The returned instance need not be thread-safe:
+   * it will only be used by a single thread.
+   */
   public abstract BinaryDocValues getBinary(FieldInfo field) throws IOException;
 
-  /** Returns {@link SortedDocValues} for this field.
-   *  The returned instance need not be thread-safe: it will only be
-   *  used by a single thread. */
+  /**
+   * Returns {@link SortedDocValues} for this field. The returned instance need not be thread-safe:
+   * it will only be used by a single thread.
+   */
   public abstract SortedDocValues getSorted(FieldInfo field) throws IOException;
-  
-  /** Returns {@link SortedNumericDocValues} for this field.
-   *  The returned instance need not be thread-safe: it will only be
-   *  used by a single thread. */
+
+  /**
+   * Returns {@link SortedNumericDocValues} for this field. The returned instance need not be
+   * thread-safe: it will only be used by a single thread.
+   */
   public abstract SortedNumericDocValues getSortedNumeric(FieldInfo field) throws IOException;
-  
-  /** Returns {@link SortedSetDocValues} for this field.
-   *  The returned instance need not be thread-safe: it will only be
-   *  used by a single thread. */
+
+  /**
+   * Returns {@link SortedSetDocValues} for this field. The returned instance need not be
+   * thread-safe: it will only be used by a single thread.
+   */
   public abstract SortedSetDocValues getSortedSet(FieldInfo field) throws IOException;
-  
-  /** 
+
+  /**
    * Checks consistency of this producer
-   * <p>
-   * Note that this may be costly in terms of I/O, e.g. 
-   * may involve computing a checksum value against large data files.
+   *
+   * <p>Note that this may be costly in terms of I/O, e.g. may involve computing a checksum value
+   * against large data files.
+   *
    * @lucene.internal
    */
   public abstract void checkIntegrity() throws IOException;
-  
-  /** 
-   * Returns an instance optimized for merging. This instance may only be
-   * consumed in the thread that called {@link #getMergeInstance()}.
-   * <p>
-   * The default implementation returns {@code this} */
+
+  /**
+   * Returns an instance optimized for merging. This instance may only be consumed in the thread
+   * that called {@link #getMergeInstance()}.
+   *
+   * <p>The default implementation returns {@code this}
+   */
   public DocValuesProducer getMergeInstance() {
     return this;
   }
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/FieldInfosFormat.java b/lucene/core/src/java/org/apache/lucene/codecs/FieldInfosFormat.java
index d4b21d7..00e744e 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/FieldInfosFormat.java
+++ b/lucene/core/src/java/org/apache/lucene/codecs/FieldInfosFormat.java
@@ -16,9 +16,7 @@
  */
 package org.apache.lucene.codecs;
 
-
 import java.io.IOException;
-
 import org.apache.lucene.index.FieldInfos; // javadocs
 import org.apache.lucene.index.SegmentInfo;
 import org.apache.lucene.store.Directory;
@@ -26,18 +24,24 @@ import org.apache.lucene.store.IOContext;
 
 /**
  * Encodes/decodes {@link FieldInfos}
+ *
  * @lucene.experimental
  */
 public abstract class FieldInfosFormat {
-  /** Sole constructor. (For invocation by subclass 
-   *  constructors, typically implicit.) */
-  protected FieldInfosFormat() {
-  }
-  
+  /** Sole constructor. (For invocation by subclass constructors, typically implicit.) */
+  protected FieldInfosFormat() {}
+
   /** Read the {@link FieldInfos} previously written with {@link #write}. */
-  public abstract FieldInfos read(Directory directory, SegmentInfo segmentInfo, String segmentSuffix, IOContext iocontext) throws IOException;
+  public abstract FieldInfos read(
+      Directory directory, SegmentInfo segmentInfo, String segmentSuffix, IOContext iocontext)
+      throws IOException;
 
-  /** Writes the provided {@link FieldInfos} to the
-   *  directory. */
-  public abstract void write(Directory directory, SegmentInfo segmentInfo, String segmentSuffix, FieldInfos infos, IOContext context) throws IOException;
+  /** Writes the provided {@link FieldInfos} to the directory. */
+  public abstract void write(
+      Directory directory,
+      SegmentInfo segmentInfo,
+      String segmentSuffix,
+      FieldInfos infos,
+      IOContext context)
+      throws IOException;
 }
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/FieldsConsumer.java b/lucene/core/src/java/org/apache/lucene/codecs/FieldsConsumer.java
index f4fc9ac..0659827 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/FieldsConsumer.java
+++ b/lucene/core/src/java/org/apache/lucene/codecs/FieldsConsumer.java
@@ -16,33 +16,27 @@
  */
 package org.apache.lucene.codecs;
 
-
 import java.io.Closeable;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
-
 import org.apache.lucene.index.Fields;
 import org.apache.lucene.index.MappedMultiFields;
 import org.apache.lucene.index.MergeState;
 import org.apache.lucene.index.MultiFields;
 import org.apache.lucene.index.ReaderSlice;
 
-/** 
- * Abstract API that consumes terms, doc, freq, prox, offset and
- * payloads postings.  Concrete implementations of this
- * actually do "something" with the postings (write it into
- * the index in a specific format).
+/**
+ * Abstract API that consumes terms, doc, freq, prox, offset and payloads postings. Concrete
+ * implementations of this actually do "something" with the postings (write it into the index in a
+ * specific format).
  *
  * @lucene.experimental
  */
-
 public abstract class FieldsConsumer implements Closeable {
 
-  /** Sole constructor. (For invocation by subclass 
-   *  constructors, typically implicit.) */
-  protected FieldsConsumer() {
-  }
+  /** Sole constructor. (For invocation by subclass constructors, typically implicit.) */
+  protected FieldsConsumer() {}
 
   // TODO: can we somehow compute stats for you...?
 
@@ -50,46 +44,38 @@ public abstract class FieldsConsumer implements Closeable {
   // iterables, no counts/stats) base classes from
   // Fields/Terms/Docs/AndPositions?
 
-  /** Write all fields, terms and postings.  This the "pull"
-   *  API, allowing you to iterate more than once over the
-   *  postings, somewhat analogous to using a DOM API to
-   *  traverse an XML tree.
+  /**
+   * Write all fields, terms and postings. This the "pull" API, allowing you to iterate more than
+   * once over the postings, somewhat analogous to using a DOM API to traverse an XML tree.
    *
-   *  <p><b>Notes</b>:
+   * <p><b>Notes</b>:
    *
-   *  <ul>
-   *    <li> You must compute index statistics,
-   *         including each Term's docFreq and totalTermFreq,
-   *         as well as the summary sumTotalTermFreq,
-   *         sumTotalDocFreq and docCount.
-   *
-   *    <li> You must skip terms that have no docs and
-   *         fields that have no terms, even though the provided
-   *         Fields API will expose them; this typically
-   *         requires lazily writing the field or term until
-   *         you've actually seen the first term or
-   *         document.
-   *
-   *    <li> The provided Fields instance is limited: you
-   *         cannot call any methods that return
-   *         statistics/counts; you cannot pass a non-null
-   *         live docs when pulling docs/positions enums.
-   *  </ul>
+   * <ul>
+   *   <li>You must compute index statistics, including each Term's docFreq and totalTermFreq, as
+   *       well as the summary sumTotalTermFreq, sumTotalDocFreq and docCount.
+   *   <li>You must skip terms that have no docs and fields that have no terms, even though the
+   *       provided Fields API will expose them; this typically requires lazily writing the field or
+   *       term until you've actually seen the first term or document.
+   *   <li>The provided Fields instance is limited: you cannot call any methods that return
+   *       statistics/counts; you cannot pass a non-null live docs when pulling docs/positions
+   *       enums.
+   * </ul>
    */
   public abstract void write(Fields fields, NormsProducer norms) throws IOException;
-  
-  /** Merges in the fields from the readers in 
-   *  <code>mergeState</code>. The default implementation skips
-   *  and maps around deleted documents, and calls {@link #write(Fields,NormsProducer)}.
-   *  Implementations can override this method for more sophisticated
-   *  merging (bulk-byte copying, etc). */
+
+  /**
+   * Merges in the fields from the readers in <code>mergeState</code>. The default implementation
+   * skips and maps around deleted documents, and calls {@link #write(Fields,NormsProducer)}.
+   * Implementations can override this method for more sophisticated merging (bulk-byte copying,
+   * etc).
+   */
   public void merge(MergeState mergeState, NormsProducer norms) throws IOException {
     final List<Fields> fields = new ArrayList<>();
     final List<ReaderSlice> slices = new ArrayList<>();
 
     int docBase = 0;
 
-    for(int readerIndex=0;readerIndex<mergeState.fieldsProducers.length;readerIndex++) {
+    for (int readerIndex = 0; readerIndex < mergeState.fieldsProducers.length; readerIndex++) {
       final FieldsProducer f = mergeState.fieldsProducers[readerIndex];
 
       final int maxDoc = mergeState.maxDocs[readerIndex];
@@ -99,9 +85,11 @@ public abstract class FieldsConsumer implements Closeable {
       docBase += maxDoc;
     }
 
-    Fields mergedFields = new MappedMultiFields(mergeState, 
-                                                new MultiFields(fields.toArray(Fields.EMPTY_ARRAY),
-                                                                slices.toArray(ReaderSlice.EMPTY_ARRAY)));
+    Fields mergedFields =
+        new MappedMultiFields(
+            mergeState,
+            new MultiFields(
+                fields.toArray(Fields.EMPTY_ARRAY), slices.toArray(ReaderSlice.EMPTY_ARRAY)));
     write(mergedFields, norms);
   }
 
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/FieldsProducer.java b/lucene/core/src/java/org/apache/lucene/codecs/FieldsProducer.java
index 481b160..7aa88a4 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/FieldsProducer.java
+++ b/lucene/core/src/java/org/apache/lucene/codecs/FieldsProducer.java
@@ -16,42 +16,39 @@
  */
 package org.apache.lucene.codecs;
 
-
 import java.io.Closeable;
 import java.io.IOException;
-
 import org.apache.lucene.index.Fields;
 import org.apache.lucene.util.Accountable;
 
-/** Abstract API that produces terms, doc, freq, prox, offset and
- *  payloads postings.  
+/**
+ * Abstract API that produces terms, doc, freq, prox, offset and payloads postings.
  *
  * @lucene.experimental
  */
-
 public abstract class FieldsProducer extends Fields implements Closeable, Accountable {
-  /** Sole constructor. (For invocation by subclass 
-   *  constructors, typically implicit.) */
-  protected FieldsProducer() {
-  }
+  /** Sole constructor. (For invocation by subclass constructors, typically implicit.) */
+  protected FieldsProducer() {}
 
   @Override
   public abstract void close() throws IOException;
-  
-  /** 
+
+  /**
    * Checks consistency of this reader.
-   * <p>
-   * Note that this may be costly in terms of I/O, e.g. 
-   * may involve computing a checksum value against large data files.
+   *
+   * <p>Note that this may be costly in terms of I/O, e.g. may involve computing a checksum value
+   * against large data files.
+   *
    * @lucene.internal
    */
   public abstract void checkIntegrity() throws IOException;
-  
-  /** 
-   * Returns an instance optimized for merging. This instance may only be
-   * consumed in the thread that called {@link #getMergeInstance()}.
-   * <p>
-   * The default implementation returns {@code this} */
+
+  /**
+   * Returns an instance optimized for merging. This instance may only be consumed in the thread
+   * that called {@link #getMergeInstance()}.
+   *
+   * <p>The default implementation returns {@code this}
+   */
   public FieldsProducer getMergeInstance() {
     return this;
   }
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/FilterCodec.java b/lucene/core/src/java/org/apache/lucene/codecs/FilterCodec.java
index 4a5e934..0a71c7d 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/FilterCodec.java
+++ b/lucene/core/src/java/org/apache/lucene/codecs/FilterCodec.java
@@ -16,13 +16,12 @@
  */
 package org.apache.lucene.codecs;
 
-
 /**
  * A codec that forwards all its method calls to another codec.
- * <p>
- * Extend this class when you need to reuse the functionality of an existing
- * codec. For example, if you want to build a codec that redefines LuceneMN's
- * {@link LiveDocsFormat}:
+ *
+ * <p>Extend this class when you need to reuse the functionality of an existing codec. For example,
+ * if you want to build a codec that redefines LuceneMN's {@link LiveDocsFormat}:
+ *
  * <pre class="prettyprint">
  *   public final class CustomCodec extends FilterCodec {
  *
@@ -36,22 +35,21 @@ package org.apache.lucene.codecs;
  *
  *   }
  * </pre>
- * 
- * <p><em>Please note:</em> Don't call {@link Codec#forName} from
- * the no-arg constructor of your own codec. When the SPI framework
- * loads your own Codec as SPI component, SPI has not yet fully initialized!
- * If you want to extend another Codec, instantiate it directly by calling
- * its constructor.
- * 
+ *
+ * <p><em>Please note:</em> Don't call {@link Codec#forName} from the no-arg constructor of your own
+ * codec. When the SPI framework loads your own Codec as SPI component, SPI has not yet fully
+ * initialized! If you want to extend another Codec, instantiate it directly by calling its
+ * constructor.
+ *
  * @lucene.experimental
  */
 public abstract class FilterCodec extends Codec {
 
   /** The codec to filter. */
   protected final Codec delegate;
-  
-  /** Sole constructor. When subclassing this codec,
-   * create a no-arg ctor and pass the delegate codec
+
+  /**
+   * Sole constructor. When subclassing this codec, create a no-arg ctor and pass the delegate codec
    * and a unique name to this ctor.
    */
   protected FilterCodec(String name, Codec delegate) {
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/LiveDocsFormat.java b/lucene/core/src/java/org/apache/lucene/codecs/LiveDocsFormat.java
index 286b75d..87745d7 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/LiveDocsFormat.java
+++ b/lucene/core/src/java/org/apache/lucene/codecs/LiveDocsFormat.java
@@ -16,31 +16,34 @@
  */
 package org.apache.lucene.codecs;
 
-
 import java.io.IOException;
 import java.util.Collection;
-
 import org.apache.lucene.index.SegmentCommitInfo;
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.store.IOContext;
 import org.apache.lucene.util.Bits;
 
-/** Format for live/deleted documents
- * @lucene.experimental */
+/**
+ * Format for live/deleted documents
+ *
+ * @lucene.experimental
+ */
 public abstract class LiveDocsFormat {
 
-  /** Sole constructor. (For invocation by subclass 
-   *  constructors, typically implicit.) */
-  protected LiveDocsFormat() {
-  }
+  /** Sole constructor. (For invocation by subclass constructors, typically implicit.) */
+  protected LiveDocsFormat() {}
 
   /** Read live docs bits. */
-  public abstract Bits readLiveDocs(Directory dir, SegmentCommitInfo info, IOContext context) throws IOException;
-
-  /** Persist live docs bits.  Use {@link
-   *  SegmentCommitInfo#getNextDelGen} to determine the
-   *  generation of the deletes file you should write to. */
-  public abstract void writeLiveDocs(Bits bits, Directory dir, SegmentCommitInfo info, int newDelCount, IOContext context) throws IOException;
+  public abstract Bits readLiveDocs(Directory dir, SegmentCommitInfo info, IOContext context)
+      throws IOException;
+
+  /**
+   * Persist live docs bits. Use {@link SegmentCommitInfo#getNextDelGen} to determine the generation
+   * of the deletes file you should write to.
+   */
+  public abstract void writeLiveDocs(
+      Bits bits, Directory dir, SegmentCommitInfo info, int newDelCount, IOContext context)
+      throws IOException;
 
   /** Records all files in use by this {@link SegmentCommitInfo} into the files argument. */
   public abstract void files(SegmentCommitInfo info, Collection<String> files) throws IOException;
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/MultiLevelSkipListReader.java b/lucene/core/src/java/org/apache/lucene/codecs/MultiLevelSkipListReader.java
index 78cceb1..7f62ec2 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/MultiLevelSkipListReader.java
+++ b/lucene/core/src/java/org/apache/lucene/codecs/MultiLevelSkipListReader.java
@@ -16,32 +16,30 @@
  */
 package org.apache.lucene.codecs;
 
-
 import java.io.Closeable;
 import java.io.IOException;
 import java.util.Arrays;
-
 import org.apache.lucene.store.IndexInput;
 import org.apache.lucene.util.MathUtil;
 
 /**
  * This abstract class reads skip lists with multiple levels.
- * 
- * See {@link MultiLevelSkipListWriter} for the information about the encoding 
- * of the multi level skip lists. 
- * 
- * Subclasses must implement the abstract method {@link #readSkipData(int, IndexInput)}
- * which defines the actual format of the skip data.
+ *
+ * <p>See {@link MultiLevelSkipListWriter} for the information about the encoding of the multi level
+ * skip lists.
+ *
+ * <p>Subclasses must implement the abstract method {@link #readSkipData(int, IndexInput)} which
+ * defines the actual format of the skip data.
+ *
  * @lucene.experimental
  */
-
 public abstract class MultiLevelSkipListReader implements Closeable {
   /** the maximum number of skip levels possible for this index */
-  protected int maxNumberOfSkipLevels; 
-  
+  protected int maxNumberOfSkipLevels;
+
   /** number of levels in this skip list */
   protected int numberOfSkipLevels;
-  
+
   // Expert: defines the number of top skip levels to buffer in memory.
   // Reducing this number results in less memory usage, but possibly
   // slower performance due to more random I/Os.
@@ -50,7 +48,7 @@ public abstract class MultiLevelSkipListReader implements Closeable {
   // skipLevel entries, the second top level can not contain more
   // than skipLevel^2 entries and so forth.
   private int numberOfLevelsToBuffer = 1;
-  
+
   private int docCount;
 
   /** skipStream for each level. */
@@ -59,16 +57,17 @@ public abstract class MultiLevelSkipListReader implements Closeable {
   /** The start pointer of each skip level. */
   private long skipPointer[];
 
-  /**  skipInterval of each level. */
+  /** skipInterval of each level. */
   private int skipInterval[];
 
-  /** Number of docs skipped per level.
-   * It's possible for some values to overflow a signed int, but this has been accounted for.
+  /**
+   * Number of docs skipped per level. It's possible for some values to overflow a signed int, but
+   * this has been accounted for.
    */
   private int[] numSkipped;
 
   /** Doc id of current skip entry per level. */
-  protected int[] skipDoc;            
+  protected int[] skipDoc;
 
   /** Doc id of last read skip entry with docId &lt;= target. */
   private int lastDoc;
@@ -76,14 +75,14 @@ public abstract class MultiLevelSkipListReader implements Closeable {
   /** Child pointer of current skip entry per level. */
   private long[] childPointer;
 
-  /** childPointer of last read skip entry with docId &lt;=
-   *  target. */
+  /** childPointer of last read skip entry with docId &lt;= target. */
   private long lastChildPointer;
 
   private final int skipMultiplier;
 
   /** Creates a {@code MultiLevelSkipListReader}. */
-  protected MultiLevelSkipListReader(IndexInput skipStream, int maxSkipLevels, int skipInterval, int skipMultiplier) {
+  protected MultiLevelSkipListReader(
+      IndexInput skipStream, int maxSkipLevels, int skipInterval, int skipMultiplier) {
     this.skipStream = new IndexInput[maxSkipLevels];
     this.skipPointer = new long[maxSkipLevels];
     this.childPointer = new long[maxSkipLevels];
@@ -91,7 +90,7 @@ public abstract class MultiLevelSkipListReader implements Closeable {
     this.maxNumberOfSkipLevels = maxSkipLevels;
     this.skipInterval = new int[maxSkipLevels];
     this.skipMultiplier = skipMultiplier;
-    this.skipStream [0]= skipStream;
+    this.skipStream[0] = skipStream;
     this.skipInterval[0] = skipInterval;
     for (int i = 1; i < maxSkipLevels; i++) {
       // cache skip intervals
@@ -100,22 +99,22 @@ public abstract class MultiLevelSkipListReader implements Closeable {
     skipDoc = new int[maxSkipLevels];
   }
 
-  /** Creates a {@code MultiLevelSkipListReader}, where
-   *  {@code skipInterval} and {@code skipMultiplier} are
-   *  the same. */
+  /**
+   * Creates a {@code MultiLevelSkipListReader}, where {@code skipInterval} and {@code
+   * skipMultiplier} are the same.
+   */
   protected MultiLevelSkipListReader(IndexInput skipStream, int maxSkipLevels, int skipInterval) {
     this(skipStream, maxSkipLevels, skipInterval, skipInterval);
   }
-  
-  /** Returns the id of the doc to which the last call of {@link #skipTo(int)}
-   *  has skipped.  */
+
+  /** Returns the id of the doc to which the last call of {@link #skipTo(int)} has skipped. */
   public int getDoc() {
     return lastDoc;
   }
-  
-  
-  /** Skips entries to the first beyond the current whose document number is
-   *  greater than or equal to <i>target</i>. Returns the current doc count. 
+
+  /**
+   * Skips entries to the first beyond the current whose document number is greater than or equal to
+   * <i>target</i>. Returns the current doc count.
    */
   public int skipTo(int target) throws IOException {
 
@@ -124,7 +123,7 @@ public abstract class MultiLevelSkipListReader implements Closeable {
     int level = 0;
     while (level < numberOfSkipLevels - 1 && target > skipDoc[level + 1]) {
       level++;
-    }    
+    }
 
     while (level >= 0) {
       if (target > skipDoc[level]) {
@@ -135,41 +134,40 @@ public abstract class MultiLevelSkipListReader implements Closeable {
         // no more skips on this level, go down one level
         if (level > 0 && lastChildPointer > skipStream[level - 1].getFilePointer()) {
           seekChild(level - 1);
-        } 
+        }
         level--;
       }
     }
-    
+
     return numSkipped[0] - skipInterval[0] - 1;
   }
-  
+
   private boolean loadNextSkip(int level) throws IOException {
     // we have to skip, the target document is greater than the current
-    // skip list entry        
+    // skip list entry
     setLastSkipData(level);
-      
+
     numSkipped[level] += skipInterval[level];
 
     // numSkipped may overflow a signed int, so compare as unsigned.
     if (Integer.compareUnsigned(numSkipped[level], docCount) > 0) {
       // this skip list is exhausted
       skipDoc[level] = Integer.MAX_VALUE;
-      if (numberOfSkipLevels > level) numberOfSkipLevels = level; 
+      if (numberOfSkipLevels > level) numberOfSkipLevels = level;
       return false;
     }
 
     // read next skip entry
     skipDoc[level] += readSkipData(level, skipStream[level]);
-    
+
     if (level != 0) {
       // read the child pointer if we are not on the leaf level
       childPointer[level] = skipStream[level].readVLong() + skipPointer[level - 1];
     }
-    
-    return true;
 
+    return true;
   }
-  
+
   /** Seeks the skip entry on the given level */
   protected void seekChild(int level) throws IOException {
     skipStream[level].seek(lastChildPointer);
@@ -193,24 +191,24 @@ public abstract class MultiLevelSkipListReader implements Closeable {
   public void init(long skipPointer, int df) throws IOException {
     this.skipPointer[0] = skipPointer;
     this.docCount = df;
-    assert skipPointer >= 0 && skipPointer <= skipStream[0].length() 
-    : "invalid skip pointer: " + skipPointer + ", length=" + skipStream[0].length();
+    assert skipPointer >= 0 && skipPointer <= skipStream[0].length()
+        : "invalid skip pointer: " + skipPointer + ", length=" + skipStream[0].length();
     Arrays.fill(skipDoc, 0);
     Arrays.fill(numSkipped, 0);
     Arrays.fill(childPointer, 0);
-    
+
     for (int i = 1; i < numberOfSkipLevels; i++) {
       skipStream[i] = null;
     }
     loadSkipLevels();
   }
-  
-  /** Loads the skip levels  */
+
+  /** Loads the skip levels */
   private void loadSkipLevels() throws IOException {
     if (docCount <= skipInterval[0]) {
       numberOfSkipLevels = 1;
     } else {
-      numberOfSkipLevels = 1+MathUtil.log(docCount/skipInterval[0], skipMultiplier);
+      numberOfSkipLevels = 1 + MathUtil.log(docCount / skipInterval[0], skipMultiplier);
     }
 
     if (numberOfSkipLevels > maxNumberOfSkipLevels) {
@@ -218,13 +216,13 @@ public abstract class MultiLevelSkipListReader implements Closeable {
     }
 
     skipStream[0].seek(skipPointer[0]);
-    
+
     int toBuffer = numberOfLevelsToBuffer;
-    
+
     for (int i = numberOfSkipLevels - 1; i > 0; i--) {
       // the length of the current level
       long length = skipStream[0].readVLong();
-      
+
       // the start pointer of the current level
       skipPointer[i] = skipStream[0].getFilePointer();
       if (toBuffer > 0) {
@@ -234,44 +232,43 @@ public abstract class MultiLevelSkipListReader implements Closeable {
       } else {
         // clone this stream, it is already at the start of the current level
         skipStream[i] = skipStream[0].clone();
-        
+
         // move base stream beyond the current level
         skipStream[0].seek(skipStream[0].getFilePointer() + length);
       }
     }
-   
+
     // use base stream for the lowest level
     skipPointer[0] = skipStream[0].getFilePointer();
   }
-  
+
   /**
    * Subclasses must implement the actual skip data encoding in this method.
-   *  
+   *
    * @param level the level skip data shall be read from
    * @param skipStream the skip stream to read from
-   */  
+   */
   protected abstract int readSkipData(int level, IndexInput skipStream) throws IOException;
-  
+
   /** Copies the values of the last read skip entry on this level */
   protected void setLastSkipData(int level) {
     lastDoc = skipDoc[level];
     lastChildPointer = childPointer[level];
   }
 
-  
   /** used to buffer the top skip levels */
-  private final static class SkipBuffer extends IndexInput {
+  private static final class SkipBuffer extends IndexInput {
     private byte[] data;
     private long pointer;
     private int pos;
-    
+
     SkipBuffer(IndexInput input, int length) throws IOException {
       super("SkipBuffer on " + input);
       data = new byte[length];
       pointer = input.getFilePointer();
       input.readBytes(data, 0, length);
     }
-    
+
     @Override
     public void close() {
       data = null;
@@ -300,9 +297,9 @@ public abstract class MultiLevelSkipListReader implements Closeable {
 
     @Override
     public void seek(long pos) {
-      this.pos =  (int) (pos - pointer);
+      this.pos = (int) (pos - pointer);
     }
-    
+
     @Override
     public IndexInput slice(String sliceDescription, long offset, long length) throws IOException {
       throw new UnsupportedOperationException();
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/MultiLevelSkipListWriter.java b/lucene/core/src/java/org/apache/lucene/codecs/MultiLevelSkipListWriter.java
index 7cf04a0..7a13a63 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/MultiLevelSkipListWriter.java
+++ b/lucene/core/src/java/org/apache/lucene/codecs/MultiLevelSkipListWriter.java
@@ -16,9 +16,7 @@
  */
 package org.apache.lucene.codecs;
 
-
 import java.io.IOException;
-
 import org.apache.lucene.store.ByteBuffersDataOutput;
 import org.apache.lucene.store.DataOutput;
 import org.apache.lucene.store.IndexOutput;
@@ -26,75 +24,77 @@ import org.apache.lucene.util.MathUtil;
 
 /**
  * This abstract class writes skip lists with multiple levels.
- * 
+ *
  * <pre>
  *
  * Example for skipInterval = 3:
  *                                                     c            (skip level 2)
- *                 c                 c                 c            (skip level 1) 
+ *                 c                 c                 c            (skip level 1)
  *     x     x     x     x     x     x     x     x     x     x      (skip level 0)
  * d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d  (posting list)
  *     3     6     9     12    15    18    21    24    27    30     (df)
- * 
+ *
  * d - document
  * x - skip data
  * c - skip data with child pointer
- * 
+ *
  * Skip level i contains every skipInterval-th entry from skip level i-1.
  * Therefore the number of entries on level i is: floor(df / ((skipInterval ^ (i + 1))).
- * 
+ *
  * Each skip entry on a level {@code i>0} contains a pointer to the corresponding skip entry in list i-1.
  * This guarantees a logarithmic amount of skips to find the target document.
- * 
+ *
  * While this class takes care of writing the different skip levels,
  * subclasses must define the actual format of the skip data.
  * </pre>
+ *
  * @lucene.experimental
  */
-
 public abstract class MultiLevelSkipListWriter {
   /** number of levels in this skip list */
   protected final int numberOfSkipLevels;
-  
+
   /** the skip interval in the list with level = 0 */
   private final int skipInterval;
 
   /** skipInterval used for level &gt; 0 */
   private final int skipMultiplier;
-  
-  /** for every skip level a different buffer is used  */
+
+  /** for every skip level a different buffer is used */
   private ByteBuffersDataOutput[] skipBuffer;
 
   /** Creates a {@code MultiLevelSkipListWriter}. */
-  protected MultiLevelSkipListWriter(int skipInterval, int skipMultiplier, int maxSkipLevels, int df) {
+  protected MultiLevelSkipListWriter(
+      int skipInterval, int skipMultiplier, int maxSkipLevels, int df) {
     this.skipInterval = skipInterval;
     this.skipMultiplier = skipMultiplier;
-    
+
     int numberOfSkipLevels;
     // calculate the maximum number of skip levels for this document frequency
     if (df <= skipInterval) {
       numberOfSkipLevels = 1;
     } else {
-      numberOfSkipLevels = 1+MathUtil.log(df/skipInterval, skipMultiplier);
+      numberOfSkipLevels = 1 + MathUtil.log(df / skipInterval, skipMultiplier);
     }
-    
+
     // make sure it does not exceed maxSkipLevels
     if (numberOfSkipLevels > maxSkipLevels) {
       numberOfSkipLevels = maxSkipLevels;
     }
     this.numberOfSkipLevels = numberOfSkipLevels;
   }
-  
-  /** Creates a {@code MultiLevelSkipListWriter}, where
-   *  {@code skipInterval} and {@code skipMultiplier} are
-   *  the same. */
+
+  /**
+   * Creates a {@code MultiLevelSkipListWriter}, where {@code skipInterval} and {@code
+   * skipMultiplier} are the same.
+   */
   protected MultiLevelSkipListWriter(int skipInterval, int maxSkipLevels, int df) {
     this(skipInterval, skipInterval, maxSkipLevels, df);
   }
 
   /** Allocates internal skip buffers. */
   protected void init() {
-    skipBuffer = new ByteBuffersDataOutput [numberOfSkipLevels];
+    skipBuffer = new ByteBuffersDataOutput[numberOfSkipLevels];
     for (int i = 0; i < numberOfSkipLevels; i++) {
       skipBuffer[i] = ByteBuffersDataOutput.newResettableInstance();
     }
@@ -108,22 +108,22 @@ public abstract class MultiLevelSkipListWriter {
       for (int i = 0; i < skipBuffer.length; i++) {
         skipBuffer[i].reset();
       }
-    }      
+    }
   }
 
   /**
    * Subclasses must implement the actual skip data encoding in this method.
-   *  
+   *
    * @param level the level skip data shall be writing for
    * @param skipBuffer the skip buffer to write to
    */
   protected abstract void writeSkipData(int level, DataOutput skipBuffer) throws IOException;
 
   /**
-   * Writes the current skip data to the buffers. The current document frequency determines
-   * the max level is skip data is to be written to. 
-   * 
-   * @param df the current document frequency 
+   * Writes the current skip data to the buffers. The current document frequency determines the max
+   * level is skip data is to be written to.
+   *
+   * @param df the current document frequency
    * @throws IOException If an I/O error occurs
    */
   public void bufferSkip(int df) throws IOException {
@@ -131,41 +131,41 @@ public abstract class MultiLevelSkipListWriter {
     assert df % skipInterval == 0;
     int numLevels = 1;
     df /= skipInterval;
-   
+
     // determine max level
     while ((df % skipMultiplier) == 0 && numLevels < numberOfSkipLevels) {
       numLevels++;
       df /= skipMultiplier;
     }
-    
+
     long childPointer = 0;
-    
+
     for (int level = 0; level < numLevels; level++) {
       writeSkipData(level, skipBuffer[level]);
-      
+
       long newChildPointer = skipBuffer[level].size();
-      
+
       if (level != 0) {
         // store child pointers for all levels except the lowest
         skipBuffer[level].writeVLong(childPointer);
       }
-      
-      //remember the childPointer for the next level
+
+      // remember the childPointer for the next level
       childPointer = newChildPointer;
     }
   }
 
   /**
    * Writes the buffered skip lists to the given output.
-   * 
-   * @param output the IndexOutput the skip lists shall be written to 
+   *
+   * @param output the IndexOutput the skip lists shall be written to
    * @return the pointer the skip list starts
    */
   public long writeSkip(IndexOutput output) throws IOException {
     long skipPointer = output.getFilePointer();
-    //System.out.println("skipper.writeSkip fp=" + skipPointer);
+    // System.out.println("skipper.writeSkip fp=" + skipPointer);
     if (skipBuffer == null || skipBuffer.length == 0) return skipPointer;
-    
+
     for (int level = numberOfSkipLevels - 1; level > 0; level--) {
       long length = skipBuffer[level].size();
       if (length > 0) {
@@ -174,7 +174,7 @@ public abstract class MultiLevelSkipListWriter {
       }
     }
     skipBuffer[0].copyTo(output);
-    
+
     return skipPointer;
   }
 }
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/MutablePointValues.java b/lucene/core/src/java/org/apache/lucene/codecs/MutablePointValues.java
index 8f4d69c..ed248b5 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/MutablePointValues.java
+++ b/lucene/core/src/java/org/apache/lucene/codecs/MutablePointValues.java
@@ -19,9 +19,12 @@ package org.apache.lucene.codecs;
 import org.apache.lucene.index.PointValues;
 import org.apache.lucene.util.BytesRef;
 
-/** {@link PointValues} whose order of points can be changed.
- *  This class is useful for codecs to optimize flush.
- *  @lucene.internal */
+/**
+ * {@link PointValues} whose order of points can be changed. This class is useful for codecs to
+ * optimize flush.
+ *
+ * @lucene.internal
+ */
 public abstract class MutablePointValues extends PointValues {
 
   /** Sole constructor. */
@@ -38,5 +41,4 @@ public abstract class MutablePointValues extends PointValues {
 
   /** Swap the i-th and j-th values. */
   public abstract void swap(int i, int j);
-
 }
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/NormsConsumer.java b/lucene/core/src/java/org/apache/lucene/codecs/NormsConsumer.java
index c21fc01..69a1b5a 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/NormsConsumer.java
+++ b/lucene/core/src/java/org/apache/lucene/codecs/NormsConsumer.java
@@ -20,54 +20,51 @@ import java.io.Closeable;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
-
 import org.apache.lucene.index.DocIDMerger;
 import org.apache.lucene.index.FieldInfo;
 import org.apache.lucene.index.MergeState;
 import org.apache.lucene.index.NumericDocValues;
 import org.apache.lucene.index.SegmentWriteState;
 
-/** 
- * Abstract API that consumes normalization values.  
- * Concrete implementations of this
- * actually do "something" with the norms (write it into
- * the index in a specific format).
- * <p>
- * The lifecycle is:
+/**
+ * Abstract API that consumes normalization values. Concrete implementations of this actually do
+ * "something" with the norms (write it into the index in a specific format).
+ *
+ * <p>The lifecycle is:
+ *
  * <ol>
- *   <li>NormsConsumer is created by 
- *       {@link NormsFormat#normsConsumer(SegmentWriteState)}.
- *   <li>{@link #addNormsField} is called for each field with
- *       normalization values. The API is a "pull" rather
- *       than "push", and the implementation is free to iterate over the 
- *       values multiple times ({@link Iterable#iterator()}).
+ *   <li>NormsConsumer is created by {@link NormsFormat#normsConsumer(SegmentWriteState)}.
+ *   <li>{@link #addNormsField} is called for each field with normalization values. The API is a
+ *       "pull" rather than "push", and the implementation is free to iterate over the values
+ *       multiple times ({@link Iterable#iterator()}).
  *   <li>After all fields are added, the consumer is {@link #close}d.
  * </ol>
  *
  * @lucene.experimental
  */
 public abstract class NormsConsumer implements Closeable {
-  
-  /** Sole constructor. (For invocation by subclass 
-   *  constructors, typically implicit.) */
+
+  /** Sole constructor. (For invocation by subclass constructors, typically implicit.) */
   protected NormsConsumer() {}
-  
+
   /**
    * Writes normalization values for a field.
+   *
    * @param field field information
    * @param normsProducer NormsProducer of the numeric norm values
    * @throws IOException if an I/O error occurred.
    */
-  public abstract void addNormsField(FieldInfo field, NormsProducer normsProducer) throws IOException;
-
-  /** Merges in the fields from the readers in 
-   *  <code>mergeState</code>. The default implementation 
-   *  calls {@link #mergeNormsField} for each field,
-   *  filling segments with missing norms for the field with zeros. 
-   *  Implementations can override this method 
-   *  for more sophisticated merging (bulk-byte copying, etc). */
+  public abstract void addNormsField(FieldInfo field, NormsProducer normsProducer)
+      throws IOException;
+
+  /**
+   * Merges in the fields from the readers in <code>mergeState</code>. The default implementation
+   * calls {@link #mergeNormsField} for each field, filling segments with missing norms for the
+   * field with zeros. Implementations can override this method for more sophisticated merging
+   * (bulk-byte copying, etc).
+   */
   public void merge(MergeState mergeState) throws IOException {
-    for(NormsProducer normsProducer : mergeState.normsProducers) {
+    for (NormsProducer normsProducer : mergeState.normsProducers) {
       if (normsProducer != null) {
         normsProducer.checkIntegrity();
       }
@@ -78,12 +75,12 @@ public abstract class NormsConsumer implements Closeable {
       }
     }
   }
-  
+
   /** Tracks state of one numeric sub-reader that we are merging */
   private static class NumericDocValuesSub extends DocIDMerger.Sub {
 
     private final NumericDocValues values;
-    
+
     public NumericDocValuesSub(MergeState.DocMap docMap, NumericDocValues values) {
       super(docMap);
       this.values = values;
@@ -98,94 +95,95 @@ public abstract class NormsConsumer implements Closeable {
 
   /**
    * Merges the norms from <code>toMerge</code>.
-   * <p>
-   * The default implementation calls {@link #addNormsField}, passing
-   * an Iterable that merges and filters deleted documents on the fly.
+   *
+   * <p>The default implementation calls {@link #addNormsField}, passing an Iterable that merges and
+   * filters deleted documents on the fly.
    */
-  public void mergeNormsField(final FieldInfo mergeFieldInfo, final MergeState mergeState) throws IOException {
+  public void mergeNormsField(final FieldInfo mergeFieldInfo, final MergeState mergeState)
+      throws IOException {
 
     // TODO: try to share code with default merge of DVConsumer by passing MatchAllBits ?
-    addNormsField(mergeFieldInfo,
-                  new NormsProducer() {
-                    @Override
-                    public NumericDocValues getNorms(FieldInfo fieldInfo) throws IOException {
-                      if (fieldInfo != mergeFieldInfo) {
-                        throw new IllegalArgumentException("wrong fieldInfo");
-                      }
-
-                        List<NumericDocValuesSub> subs = new ArrayList<>();
-                        assert mergeState.docMaps.length == mergeState.docValuesProducers.length;
-                        for (int i=0;i<mergeState.docValuesProducers.length;i++) {
-                          NumericDocValues norms = null;
-                          NormsProducer normsProducer = mergeState.normsProducers[i];
-                          if (normsProducer != null) {
-                            FieldInfo readerFieldInfo = mergeState.fieldInfos[i].fieldInfo(mergeFieldInfo.name);
-                            if (readerFieldInfo != null && readerFieldInfo.hasNorms()) {
-                              norms = normsProducer.getNorms(readerFieldInfo);
-                            }
-                          }
-
-                          if (norms != null) {
-                            subs.add(new NumericDocValuesSub(mergeState.docMaps[i], norms));
-                          }
-                        }
-
-                        final DocIDMerger<NumericDocValuesSub> docIDMerger = DocIDMerger.of(subs, mergeState.needsIndexSort);
-
-                        return new NumericDocValues() {
-                          private int docID = -1;
-                          private NumericDocValuesSub current;
-
-                          @Override
-                          public int docID() {
-                            return docID;
-                          }
-
-                          @Override
-                          public int nextDoc() throws IOException {
-                            current = docIDMerger.next();
-                            if (current == null) {
-                              docID = NO_MORE_DOCS;
-                            } else {
-                              docID = current.mappedDocID;
-                            }
-                            return docID;
-                          }
-
-                          @Override
-                          public int advance(int target) throws IOException {
-                            throw new UnsupportedOperationException();
-                          }
-
-                          @Override
-                          public boolean advanceExact(int target) throws IOException {
-                            throw new UnsupportedOperationException();
-                          }
-
-                          @Override
-                          public long cost() {
-                            return 0;
-                          }
-
-                          @Override
-                          public long longValue() throws IOException {
-                            return current.values.longValue();
-                          }
-                        };
-                    }
-                    
-                    @Override
-                    public void checkIntegrity() {
-                    }
-
-                    @Override
-                    public void close() {
-                    }
-
-                    @Override
-                    public long ramBytesUsed() {
-                      return 0;
-                    }
-                  });
+    addNormsField(
+        mergeFieldInfo,
+        new NormsProducer() {
+          @Override
+          public NumericDocValues getNorms(FieldInfo fieldInfo) throws IOException {
+            if (fieldInfo != mergeFieldInfo) {
+              throw new IllegalArgumentException("wrong fieldInfo");
+            }
+
+            List<NumericDocValuesSub> subs = new ArrayList<>();
+            assert mergeState.docMaps.length == mergeState.docValuesProducers.length;
+            for (int i = 0; i < mergeState.docValuesProducers.length; i++) {
+              NumericDocValues norms = null;
+              NormsProducer normsProducer = mergeState.normsProducers[i];
+              if (normsProducer != null) {
+                FieldInfo readerFieldInfo = mergeState.fieldInfos[i].fieldInfo(mergeFieldInfo.name);
+                if (readerFieldInfo != null && readerFieldInfo.hasNorms()) {
+                  norms = normsProducer.getNorms(readerFieldInfo);
+                }
+              }
+
+              if (norms != null) {
+                subs.add(new NumericDocValuesSub(mergeState.docMaps[i], norms));
+              }
+            }
+
+            final DocIDMerger<NumericDocValuesSub> docIDMerger =
+                DocIDMerger.of(subs, mergeState.needsIndexSort);
+
+            return new NumericDocValues() {
+              private int docID = -1;
+              private NumericDocValuesSub current;
+
+              @Override
+              public int docID() {
+                return docID;
+              }
+
+              @Override
+              public int nextDoc() throws IOException {
+                current = docIDMerger.next();
+                if (current == null) {
+                  docID = NO_MORE_DOCS;
+                } else {
+                  docID = current.mappedDocID;
+                }
+                return docID;
+              }
+
+              @Override
+              public int advance(int target) throws IOException {
+                throw new UnsupportedOperationException();
+              }
+
+              @Override
+              public boolean advanceExact(int target) throws IOException {
+                throw new UnsupportedOperationException();
+              }
+
+              @Override
+              public long cost() {
+                return 0;
+              }
+
+              @Override
+              public long longValue() throws IOException {
+                return current.values.longValue();
+              }
+            };
+          }
+
+          @Override
+          public void checkIntegrity() {}
+
+          @Override
+          public void close() {}
+
+          @Override
+          public long ramBytesUsed() {
+            return 0;
+          }
+        });
   }
 }
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/NormsFormat.java b/lucene/core/src/java/org/apache/lucene/codecs/NormsFormat.java
index 6b5afbd..646fa17 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/NormsFormat.java
+++ b/lucene/core/src/java/org/apache/lucene/codecs/NormsFormat.java
@@ -16,33 +16,25 @@
  */
 package org.apache.lucene.codecs;
 
-
 import java.io.IOException;
-
 import org.apache.lucene.index.SegmentReadState;
 import org.apache.lucene.index.SegmentWriteState;
 
-/**
- * Encodes/decodes per-document score normalization values.
- */
+/** Encodes/decodes per-document score normalization values. */
 public abstract class NormsFormat {
-  /** Sole constructor. (For invocation by subclass 
-   *  constructors, typically implicit.) */
-  protected NormsFormat() {
-  }
+  /** Sole constructor. (For invocation by subclass constructors, typically implicit.) */
+  protected NormsFormat() {}
 
-  /** Returns a {@link NormsConsumer} to write norms to the
-   *  index. */
+  /** Returns a {@link NormsConsumer} to write norms to the index. */
   public abstract NormsConsumer normsConsumer(SegmentWriteState state) throws IOException;
 
-  /** 
-   * Returns a {@link NormsProducer} to read norms from the index. 
-   * <p>
-   * NOTE: by the time this call returns, it must hold open any files it will 
-   * need to use; else, those files may be deleted. Additionally, required files 
-   * may be deleted during the execution of this call before there is a chance 
-   * to open them. Under these circumstances an IOException should be thrown by 
-   * the implementation. IOExceptions are expected and will automatically cause 
+  /**
+   * Returns a {@link NormsProducer} to read norms from the index.
+   *
+   * <p>NOTE: by the time this call returns, it must hold open any files it will need to use; else,
+   * those files may be deleted. Additionally, required files may be deleted during the execution of
+   * this call before there is a chance to open them. Under these circumstances an IOException
+   * should be thrown by the implementation. IOExceptions are expected and will automatically cause
    * a retry of the segment opening logic with the newly revised segments.
    */
   public abstract NormsProducer normsProducer(SegmentReadState state) throws IOException;
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/NormsProducer.java b/lucene/core/src/java/org/apache/lucene/codecs/NormsProducer.java
index 647d9e9..8af9d72 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/NormsProducer.java
+++ b/lucene/core/src/java/org/apache/lucene/codecs/NormsProducer.java
@@ -18,41 +18,42 @@ package org.apache.lucene.codecs;
 
 import java.io.Closeable;
 import java.io.IOException;
-
 import org.apache.lucene.index.FieldInfo;
 import org.apache.lucene.index.NumericDocValues;
 import org.apache.lucene.util.Accountable;
 
-
-/** Abstract API that produces field normalization values
+/**
+ * Abstract API that produces field normalization values
  *
  * @lucene.experimental
  */
 public abstract class NormsProducer implements Closeable, Accountable {
-  
-  /** Sole constructor. (For invocation by subclass 
-   *  constructors, typically implicit.) */
+
+  /** Sole constructor. (For invocation by subclass constructors, typically implicit.) */
   protected NormsProducer() {}
 
-  /** Returns {@link NumericDocValues} for this field.
-   *  The returned instance need not be thread-safe: it will only be
-   *  used by a single thread. */
+  /**
+   * Returns {@link NumericDocValues} for this field. The returned instance need not be thread-safe:
+   * it will only be used by a single thread.
+   */
   public abstract NumericDocValues getNorms(FieldInfo field) throws IOException;
-  
-  /** 
+
+  /**
    * Checks consistency of this producer
-   * <p>
-   * Note that this may be costly in terms of I/O, e.g. 
-   * may involve computing a checksum value against large data files.
+   *
+   * <p>Note that this may be costly in terms of I/O, e.g. may involve computing a checksum value
+   * against large data files.
+   *
    * @lucene.internal
    */
   public abstract void checkIntegrity() throws IOException;
-  
-  /** 
-   * Returns an instance optimized for merging. This instance may only be used
-   * from the thread that acquires it.
-   * <p>
-   * The default implementation returns {@code this} */
+
+  /**
+   * Returns an instance optimized for merging. This instance may only be used from the thread that
+   * acquires it.
+   *
+   * <p>The default implementation returns {@code this}
+   */
   public NormsProducer getMergeInstance() {
     return this;
   }
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/PointsFormat.java b/lucene/core/src/java/org/apache/lucene/codecs/PointsFormat.java
index 1723e42..8979768 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/PointsFormat.java
+++ b/lucene/core/src/java/org/apache/lucene/codecs/PointsFormat.java
@@ -16,67 +16,61 @@
  */
 package org.apache.lucene.codecs;
 
-
 import java.io.IOException;
-
 import org.apache.lucene.index.PointValues;
 import org.apache.lucene.index.SegmentReadState;
 import org.apache.lucene.index.SegmentWriteState;
 
-/** 
+/**
  * Encodes/decodes indexed points.
  *
- * @lucene.experimental */
+ * @lucene.experimental
+ */
 public abstract class PointsFormat {
 
-  /**
-   * Creates a new point format.
-   */
-  protected PointsFormat() {
-  }
+  /** Creates a new point format. */
+  protected PointsFormat() {}
 
   /** Writes a new segment */
   public abstract PointsWriter fieldsWriter(SegmentWriteState state) throws IOException;
 
-  /** Reads a segment.  NOTE: by the time this call
-   *  returns, it must hold open any files it will need to
-   *  use; else, those files may be deleted. 
-   *  Additionally, required files may be deleted during the execution of 
-   *  this call before there is a chance to open them. Under these 
-   *  circumstances an IOException should be thrown by the implementation. 
-   *  IOExceptions are expected and will automatically cause a retry of the 
-   *  segment opening logic with the newly revised segments.
-   *  */
+  /**
+   * Reads a segment. NOTE: by the time this call returns, it must hold open any files it will need
+   * to use; else, those files may be deleted. Additionally, required files may be deleted during
+   * the execution of this call before there is a chance to open them. Under these circumstances an
+   * IOException should be thrown by the implementation. IOExceptions are expected and will
+   * automatically cause a retry of the segment opening logic with the newly revised segments.
+   */
   public abstract PointsReader fieldsReader(SegmentReadState state) throws IOException;
 
   /** A {@code PointsFormat} that has nothing indexed */
-  public static final PointsFormat EMPTY = new PointsFormat() {
-      @Override
-      public PointsWriter fieldsWriter(SegmentWriteState state) {
-        throw new UnsupportedOperationException();
-      }
+  public static final PointsFormat EMPTY =
+      new PointsFormat() {
+        @Override
+        public PointsWriter fieldsWriter(SegmentWriteState state) {
+          throw new UnsupportedOperationException();
+        }
 
-      @Override
-      public PointsReader fieldsReader(SegmentReadState state) {
-        return new PointsReader() {
-          @Override
-          public void close() {
-          }
+        @Override
+        public PointsReader fieldsReader(SegmentReadState state) {
+          return new PointsReader() {
+            @Override
+            public void close() {}
 
-          @Override
-          public long ramBytesUsed() {
-            return 0L;
-          }
+            @Override
+            public long ramBytesUsed() {
+              return 0L;
+            }
 
-          @Override
-          public void checkIntegrity() {
-          }
+            @Override
+            public void checkIntegrity() {}
 
-          @Override
-          public PointValues getValues(String field) {
-            throw new IllegalArgumentException("field=\"" + field + "\" was not indexed with points");
-          }
-        };
-      }
-    };
+            @Override
+            public PointValues getValues(String field) {
+              throw new IllegalArgumentException(
+                  "field=\"" + field + "\" was not indexed with points");
+            }
+          };
+        }
+      };
 }
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/PointsReader.java b/lucene/core/src/java/org/apache/lucene/codecs/PointsReader.java
index 213b72e..72c640a 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/PointsReader.java
+++ b/lucene/core/src/java/org/apache/lucene/codecs/PointsReader.java
@@ -16,14 +16,13 @@
  */
 package org.apache.lucene.codecs;
 
-
 import java.io.Closeable;
 import java.io.IOException;
-
 import org.apache.lucene.index.PointValues;
 import org.apache.lucene.util.Accountable;
 
-/** Abstract API to visit point values.
+/**
+ * Abstract API to visit point values.
  *
  * @lucene.experimental
  */
@@ -32,11 +31,12 @@ public abstract class PointsReader implements Closeable, Accountable {
   /** Sole constructor. (For invocation by subclass constructors, typically implicit.) */
   protected PointsReader() {}
 
-  /** 
+  /**
    * Checks consistency of this reader.
-   * <p>
-   * Note that this may be costly in terms of I/O, e.g. 
-   * may involve computing a checksum value against large data files.
+   *
+   * <p>Note that this may be costly in terms of I/O, e.g. may involve computing a checksum value
+   * against large data files.
+   *
    * @lucene.internal
    */
   public abstract void checkIntegrity() throws IOException;
@@ -44,11 +44,12 @@ public abstract class PointsReader implements Closeable, Accountable {
   /** Return {@link PointValues} for the given {@code field}. */
   public abstract PointValues getValues(String field) throws IOException;
 
-  /** 
-   * Returns an instance optimized for merging. This instance may only be used
-   * in the thread that acquires it.
-   * <p>
-   * The default implementation returns {@code this} */
+  /**
+   * Returns an instance optimized for merging. This instance may only be used in the thread that
+   * acquires it.
+   *
+   * <p>The default implementation returns {@code this}
+   */
   public PointsReader getMergeInstance() {
     return this;
   }
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/PointsWriter.java b/lucene/core/src/java/org/apache/lucene/codecs/PointsWriter.java
index 1f62c9f..b7c9769 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/PointsWriter.java
+++ b/lucene/core/src/java/org/apache/lucene/codecs/PointsWriter.java
@@ -16,35 +16,33 @@
  */
 package org.apache.lucene.codecs;
 
-
 import java.io.Closeable;
 import java.io.IOException;
-
 import org.apache.lucene.index.FieldInfo;
 import org.apache.lucene.index.MergeState;
 import org.apache.lucene.index.PointValues;
 
-/** Abstract API to write points
+/**
+ * Abstract API to write points
  *
  * @lucene.experimental
  */
-
 public abstract class PointsWriter implements Closeable {
-  /** Sole constructor. (For invocation by subclass 
-   *  constructors, typically implicit.) */
-  protected PointsWriter() {
-  }
+  /** Sole constructor. (For invocation by subclass constructors, typically implicit.) */
+  protected PointsWriter() {}
 
   /** Write all values contained in the provided reader */
   public abstract void writeField(FieldInfo fieldInfo, PointsReader values) throws IOException;
 
-  /** Default naive merge implementation for one field: it just re-indexes all the values
-   *  from the incoming segment.  The default codec overrides this for 1D fields and uses
-   *  a faster but more complex implementation. */
+  /**
+   * Default naive merge implementation for one field: it just re-indexes all the values from the
+   * incoming segment. The default codec overrides this for 1D fields and uses a faster but more
+   * complex implementation.
+   */
   protected void mergeOneField(MergeState mergeState, FieldInfo fieldInfo) throws IOException {
     long maxPointCount = 0;
     int docCount = 0;
-    for (int i=0;i<mergeState.pointsReaders.length;i++) {
+    for (int i = 0; i < mergeState.pointsReaders.length; i++) {
       PointsReader pointsReader = mergeState.pointsReaders[i];
       if (pointsReader != null) {
         FieldInfo readerFieldInfo = mergeState.fieldInfos[i].fieldInfo(fieldInfo.name);
@@ -59,17 +57,18 @@ public abstract class PointsWriter implements Closeable {
     }
     final long finalMaxPointCount = maxPointCount;
     final int finalDocCount = docCount;
-    writeField(fieldInfo,
+    writeField(
+        fieldInfo,
         new PointsReader() {
-          
+
           @Override
           public long ramBytesUsed() {
             return 0;
           }
-          
+
           @Override
           public void close() throws IOException {}
-          
+
           @Override
           public PointValues getValues(String fieldName) {
             if (fieldName.equals(fieldInfo.name) == false) {
@@ -77,10 +76,10 @@ public abstract class PointsWriter implements Closeable {
             }
 
             return new PointValues() {
-              
+
               @Override
               public void intersect(IntersectVisitor mergedVisitor) throws IOException {
-                for (int i=0;i<mergeState.pointsReaders.length;i++) {
+                for (int i = 0; i < mergeState.pointsReaders.length; i++) {
                   PointsReader pointsReader = mergeState.pointsReaders[i];
                   if (pointsReader == null) {
                     // This segment has no points
@@ -102,28 +101,30 @@ public abstract class PointsWriter implements Closeable {
                     continue;
                   }
                   MergeState.DocMap docMap = mergeState.docMaps[i];
-                  values.intersect(new IntersectVisitor() {
-                    @Override
-                    public void visit(int docID) {
-                      // Should never be called because our compare method never returns Relation.CELL_INSIDE_QUERY
-                      throw new IllegalStateException();
-                    }
-
-                    @Override
-                    public void visit(int docID, byte[] packedValue) throws IOException {
-                      int newDocID = docMap.get(docID);
-                      if (newDocID != -1) {
-                        // Not deleted:
-                        mergedVisitor.visit(newDocID, packedValue);
-                      }
-                    }
-
-                    @Override
-                    public Relation compare(byte[] minPackedValue, byte[] maxPackedValue) {
-                      // Forces this segment's PointsReader to always visit all docs + values:
-                      return Relation.CELL_CROSSES_QUERY;
-                    }
-                  });
+                  values.intersect(
+                      new IntersectVisitor() {
+                        @Override
+                        public void visit(int docID) {
+                          // Should never be called because our compare method never returns
+                          // Relation.CELL_INSIDE_QUERY
+                          throw new IllegalStateException();
+                        }
+
+                        @Override
+                        public void visit(int docID, byte[] packedValue) throws IOException {
+                          int newDocID = docMap.get(docID);
+                          if (newDocID != -1) {
+                            // Not deleted:
+                            mergedVisitor.visit(newDocID, packedValue);
+                          }
+                        }
+
+                        @Override
+                        public Relation compare(byte[] minPackedValue, byte[] maxPackedValue) {
+                          // Forces this segment's PointsReader to always visit all docs + values:
+                          return Relation.CELL_CROSSES_QUERY;
+                        }
+                      });
                 }
               }
 
@@ -168,7 +169,7 @@ public abstract class PointsWriter implements Closeable {
               }
             };
           }
-          
+
           @Override
           public void checkIntegrity() throws IOException {
             throw new UnsupportedOperationException();
@@ -176,8 +177,10 @@ public abstract class PointsWriter implements Closeable {
         });
   }
 
-  /** Default merge implementation to merge incoming points readers by visiting all their points and
-   *  adding to this writer */
+  /**
+   * Default merge implementation to merge incoming points readers by visiting all their points and
+   * adding to this writer
+   */
   public void merge(MergeState mergeState) throws IOException {
     // check each incoming reader
     for (PointsReader reader : mergeState.pointsReaders) {
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/PostingsFormat.java b/lucene/core/src/java/org/apache/lucene/codecs/PostingsFormat.java
index 7994e05..4edb32c 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/PostingsFormat.java
+++ b/lucene/core/src/java/org/apache/lucene/codecs/PostingsFormat.java
@@ -16,44 +16,45 @@
  */
 package org.apache.lucene.codecs;
 
-
 import java.io.IOException;
 import java.util.ServiceLoader;
 import java.util.Set;
-
 import org.apache.lucene.codecs.perfield.PerFieldPostingsFormat; // javadocs
 import org.apache.lucene.index.SegmentReadState;
 import org.apache.lucene.index.SegmentWriteState;
 import org.apache.lucene.util.NamedSPILoader;
 
-/** 
+/**
  * Encodes/decodes terms, postings, and proximity data.
- * <p>
- * Note, when extending this class, the name ({@link #getName}) may
- * written into the index in certain configurations. In order for the segment 
- * to be read, the name must resolve to your implementation via {@link #forName(String)}.
- * This method uses Java's 
- * {@link ServiceLoader Service Provider Interface} (SPI) to resolve format names.
- * <p>
- * If you implement your own format, make sure that it has a no-arg constructor
- * so SPI can load it.
+ *
+ * <p>Note, when extending this class, the name ({@link #getName}) may written into the index in
+ * certain configurations. In order for the segment to be read, the name must resolve to your
+ * implementation via {@link #forName(String)}. This method uses Java's {@link ServiceLoader Service
+ * Provider Interface} (SPI) to resolve format names.
+ *
+ * <p>If you implement your own format, make sure that it has a no-arg constructor so SPI can load
+ * it.
+ *
  * @see ServiceLoader
- * @lucene.experimental */
+ * @lucene.experimental
+ */
 public abstract class PostingsFormat implements NamedSPILoader.NamedSPI {
 
   /**
-   * This static holder class prevents classloading deadlock by delaying
-   * init of postings formats until needed.
+   * This static holder class prevents classloading deadlock by delaying init of postings formats
+   * until needed.
    */
   private static final class Holder {
-    private static final NamedSPILoader<PostingsFormat> LOADER = new NamedSPILoader<>(PostingsFormat.class);
-    
+    private static final NamedSPILoader<PostingsFormat> LOADER =
+        new NamedSPILoader<>(PostingsFormat.class);
+
     private Holder() {}
-    
+
     static NamedSPILoader<PostingsFormat> getLoader() {
       if (LOADER == null) {
-        throw new IllegalStateException("You tried to lookup a PostingsFormat by name before all formats could be initialized. "+
-          "This likely happens if you call PostingsFormat#forName from a PostingsFormat's ctor.");
+        throw new IllegalStateException(
+            "You tried to lookup a PostingsFormat by name before all formats could be initialized. "
+                + "This likely happens if you call PostingsFormat#forName from a PostingsFormat's ctor.");
       }
       return LOADER;
     }
@@ -62,22 +63,22 @@ public abstract class PostingsFormat implements NamedSPILoader.NamedSPI {
   /** Zero-length {@code PostingsFormat} array. */
   public static final PostingsFormat[] EMPTY = new PostingsFormat[0];
 
-  /** Unique name that's used to retrieve this format when
-   *  reading the index.
-   */
+  /** Unique name that's used to retrieve this format when reading the index. */
   private final String name;
-  
+
   /**
    * Creates a new postings format.
-   * <p>
-   * The provided name will be written into the index segment in some configurations
-   * (such as when using {@link PerFieldPostingsFormat}): in such configurations,
-   * for the segment to be read this class should be registered with Java's
-   * SPI mechanism (registered in META-INF/ of your jar file, etc).
+   *
+   * <p>The provided name will be written into the index segment in some configurations (such as
+   * when using {@link PerFieldPostingsFormat}): in such configurations, for the segment to be read
+   * this class should be registered with Java's SPI mechanism (registered in META-INF/ of your jar
+   * file, etc).
+   *
    * @param name must be all ascii alphanumeric, and less than 128 characters in length.
    */
   protected PostingsFormat(String name) {
-    // TODO: can we somehow detect name conflicts here?  Two different classes trying to claim the same name?  Otherwise you see confusing errors...
+    // TODO: can we somehow detect name conflicts here?  Two different classes trying to claim the
+    // same name?  Otherwise you see confusing errors...
     NamedSPILoader.checkServiceName(name);
     this.name = name;
   }
@@ -87,46 +88,44 @@ public abstract class PostingsFormat implements NamedSPILoader.NamedSPI {
   public final String getName() {
     return name;
   }
-  
+
   /** Writes a new segment */
   public abstract FieldsConsumer fieldsConsumer(SegmentWriteState state) throws IOException;
 
-  /** Reads a segment.  NOTE: by the time this call
-   *  returns, it must hold open any files it will need to
-   *  use; else, those files may be deleted. 
-   *  Additionally, required files may be deleted during the execution of 
-   *  this call before there is a chance to open them. Under these 
-   *  circumstances an IOException should be thrown by the implementation. 
-   *  IOExceptions are expected and will automatically cause a retry of the 
-   *  segment opening logic with the newly revised segments.
-   *  */
+  /**
+   * Reads a segment. NOTE: by the time this call returns, it must hold open any files it will need
+   * to use; else, those files may be deleted. Additionally, required files may be deleted during
+   * the execution of this call before there is a chance to open them. Under these circumstances an
+   * IOException should be thrown by the implementation. IOExceptions are expected and will
+   * automatically cause a retry of the segment opening logic with the newly revised segments.
+   */
   public abstract FieldsProducer fieldsProducer(SegmentReadState state) throws IOException;
 
   @Override
   public String toString() {
     return "PostingsFormat(name=" + name + ")";
   }
-  
+
   /** looks up a format by name */
   public static PostingsFormat forName(String name) {
     return Holder.getLoader().lookup(name);
   }
-  
+
   /** returns a list of all available format names */
   public static Set<String> availablePostingsFormats() {
     return Holder.getLoader().availableServices();
   }
-  
-  /** 
-   * Reloads the postings format list from the given {@link ClassLoader}.
-   * Changes to the postings formats are visible after the method ends, all
-   * iterators ({@link #availablePostingsFormats()},...) stay consistent. 
-   * 
-   * <p><b>NOTE:</b> Only new postings formats are added, existing ones are
-   * never removed or replaced.
-   * 
-   * <p><em>This method is expensive and should only be called for discovery
-   * of new postings formats on the given classpath/classloader!</em>
+
+  /**
+   * Reloads the postings format list from the given {@link ClassLoader}. Changes to the postings
+   * formats are visible after the method ends, all iterators ({@link
+   * #availablePostingsFormats()},...) stay consistent.
+   *
+   * <p><b>NOTE:</b> Only new postings formats are added, existing ones are never removed or
+   * replaced.
+   *
+   * <p><em>This method is expensive and should only be called for discovery of new postings formats
+   * on the given classpath/classloader!</em>
    */
   public static void reloadPostingsFormats(ClassLoader classloader) {
     Holder.getLoader().reload(classloader);
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/PostingsReaderBase.java b/lucene/core/src/java/org/apache/lucene/codecs/PostingsReaderBase.java
index a1244ca..545df6b 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/PostingsReaderBase.java
+++ b/lucene/core/src/java/org/apache/lucene/codecs/PostingsReaderBase.java
@@ -16,27 +16,25 @@
  */
 package org.apache.lucene.codecs;
 
-
 import java.io.Closeable;
 import java.io.IOException;
-
-import org.apache.lucene.index.PostingsEnum;
 import org.apache.lucene.index.FieldInfo;
 import org.apache.lucene.index.ImpactsEnum;
+import org.apache.lucene.index.PostingsEnum;
 import org.apache.lucene.index.SegmentReadState;
 import org.apache.lucene.store.DataInput;
 import org.apache.lucene.store.IndexInput;
 import org.apache.lucene.util.Accountable;
 
-/** The core terms dictionaries (BlockTermsReader,
- *  BlockTreeTermsReader) interact with a single instance
- *  of this class to manage creation of {@link org.apache.lucene.index.PostingsEnum} and
- *  {@link org.apache.lucene.index.PostingsEnum} instances.  It provides an
- *  IndexInput (termsIn) where this class may read any
- *  previously stored data that it had written in its
- *  corresponding {@link PostingsWriterBase} at indexing
- *  time. 
- *  @lucene.experimental */
+/**
+ * The core terms dictionaries (BlockTermsReader, BlockTreeTermsReader) interact with a single
+ * instance of this class to manage creation of {@link org.apache.lucene.index.PostingsEnum} and
+ * {@link org.apache.lucene.index.PostingsEnum} instances. It provides an IndexInput (termsIn) where
+ * this class may read any previously stored data that it had written in its corresponding {@link
+ * PostingsWriterBase} at indexing time.
+ *
+ * @lucene.experimental
+ */
 
 // TODO: maybe move under blocktree?  but it's used by other terms dicts (e.g. Block)
 
@@ -45,39 +43,44 @@ import org.apache.lucene.util.Accountable;
 // TermsDict + PostingsReader/WriterBase == PostingsConsumer/Producer
 public abstract class PostingsReaderBase implements Closeable, Accountable {
 
-  /** Sole constructor. (For invocation by subclass 
-   *  constructors, typically implicit.) */
-  protected PostingsReaderBase() {
-  }
+  /** Sole constructor. (For invocation by subclass constructors, typically implicit.) */
+  protected PostingsReaderBase() {}
 
-  /** Performs any initialization, such as reading and
-   *  verifying the header from the provided terms
-   *  dictionary {@link IndexInput}. */
+  /**
+   * Performs any initialization, such as reading and verifying the header from the provided terms
+   * dictionary {@link IndexInput}.
+   */
   public abstract void init(IndexInput termsIn, SegmentReadState state) throws IOException;
 
   /** Return a newly created empty TermState */
   public abstract BlockTermState newTermState() throws IOException;
 
-  /** Actually decode metadata for next term 
-   *  @see PostingsWriterBase#encodeTerm 
+  /**
+   * Actually decode metadata for next term
+   *
+   * @see PostingsWriterBase#encodeTerm
    */
-  public abstract void decodeTerm(DataInput in, FieldInfo fieldInfo, BlockTermState state, boolean absolute) throws IOException;
+  public abstract void decodeTerm(
+      DataInput in, FieldInfo fieldInfo, BlockTermState state, boolean absolute) throws IOException;
 
-  /** Must fully consume state, since after this call that
-   *  TermState may be reused. */
-  public abstract PostingsEnum postings(FieldInfo fieldInfo, BlockTermState state, PostingsEnum reuse, int flags) throws IOException;
+  /** Must fully consume state, since after this call that TermState may be reused. */
+  public abstract PostingsEnum postings(
+      FieldInfo fieldInfo, BlockTermState state, PostingsEnum reuse, int flags) throws IOException;
 
   /**
    * Return a {@link ImpactsEnum} that computes impacts with {@code scorer}.
+   *
    * @see #postings(FieldInfo, BlockTermState, PostingsEnum, int)
    */
-  public abstract ImpactsEnum impacts(FieldInfo fieldInfo, BlockTermState state, int flags) throws IOException;
+  public abstract ImpactsEnum impacts(FieldInfo fieldInfo, BlockTermState state, int flags)
+      throws IOException;
 
-  /** 
+  /**
    * Checks consistency of this reader.
-   * <p>
-   * Note that this may be costly in terms of I/O, e.g. 
-   * may involve computing a checksum value against large data files.
+   *
+   * <p>Note that this may be costly in terms of I/O, e.g. may involve computing a checksum value
+   * against large data files.
+   *
    * @lucene.internal
    */
   public abstract void checkIntegrity() throws IOException;
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/PostingsWriterBase.java b/lucene/core/src/java/org/apache/lucene/codecs/PostingsWriterBase.java
index a8f8ed4..a98dc3b 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/PostingsWriterBase.java
+++ b/lucene/core/src/java/org/apache/lucene/codecs/PostingsWriterBase.java
@@ -16,7 +16,8 @@
  */
 package org.apache.lucene.codecs;
 
-
+import java.io.Closeable;
+import java.io.IOException;
 import org.apache.lucene.codecs.blocktree.BlockTreeTermsWriter;
 import org.apache.lucene.index.FieldInfo;
 import org.apache.lucene.index.SegmentWriteState;
@@ -26,13 +27,10 @@ import org.apache.lucene.store.IndexOutput;
 import org.apache.lucene.util.BytesRef;
 import org.apache.lucene.util.FixedBitSet;
 
-import java.io.Closeable;
-import java.io.IOException;
-
 /**
- * Class that plugs into term dictionaries, such as {@link
- * BlockTreeTermsWriter}, and handles writing postings.
- * 
+ * Class that plugs into term dictionaries, such as {@link BlockTreeTermsWriter}, and handles
+ * writing postings.
+ *
  * @see PostingsReaderBase
  * @lucene.experimental
  */
@@ -41,38 +39,37 @@ import java.io.IOException;
 // TermsDict + PostingsReader/WriterBase == FieldsProducer/Consumer
 public abstract class PostingsWriterBase implements Closeable {
 
-  /** Sole constructor. (For invocation by subclass 
-   *  constructors, typically implicit.) */
-  protected PostingsWriterBase() {
-  }
+  /** Sole constructor. (For invocation by subclass constructors, typically implicit.) */
+  protected PostingsWriterBase() {}
 
-  /** Called once after startup, before any terms have been
-   *  added.  Implementations typically write a header to
-   *  the provided {@code termsOut}. */
+  /**
+   * Called once after startup, before any terms have been added. Implementations typically write a
+   * header to the provided {@code termsOut}.
+   */
   public abstract void init(IndexOutput termsOut, SegmentWriteState state) throws IOException;
 
-  /** Write all postings for one term; use the provided
-   *  {@link TermsEnum} to pull a {@link org.apache.lucene.index.PostingsEnum}.
-   *  This method should not
-   *  re-position the {@code TermsEnum}!  It is already
-   *  positioned on the term that should be written.  This
-   *  method must set the bit in the provided {@link
-   *  FixedBitSet} for every docID written.  If no docs
-   *  were written, this method should return null, and the
-   *  terms dict will skip the term. */
-  public abstract BlockTermState writeTerm(BytesRef term, TermsEnum termsEnum, FixedBitSet docsSeen, NormsProducer norms) throws IOException;
+  /**
+   * Write all postings for one term; use the provided {@link TermsEnum} to pull a {@link
+   * org.apache.lucene.index.PostingsEnum}. This method should not re-position the {@code
+   * TermsEnum}! It is already positioned on the term that should be written. This method must set
+   * the bit in the provided {@link FixedBitSet} for every docID written. If no docs were written,
+   * this method should return null, and the terms dict will skip the term.
+   */
+  public abstract BlockTermState writeTerm(
+      BytesRef term, TermsEnum termsEnum, FixedBitSet docsSeen, NormsProducer norms)
+      throws IOException;
 
   /**
-   * Encode metadata as long[] and byte[]. {@code absolute} controls whether 
-   * current term is delta encoded according to latest term. 
-   * Usually elements in {@code longs} are file pointers, so each one always 
-   * increases when a new term is consumed. {@code out} is used to write generic
-   * bytes, which are not monotonic.
+   * Encode metadata as long[] and byte[]. {@code absolute} controls whether current term is delta
+   * encoded according to latest term. Usually elements in {@code longs} are file pointers, so each
+   * one always increases when a new term is consumed. {@code out} is used to write generic bytes,
+   * which are not monotonic.
    */
-  public abstract void encodeTerm(DataOutput out, FieldInfo fieldInfo, BlockTermState state, boolean absolute) throws IOException;
+  public abstract void encodeTerm(
+      DataOutput out, FieldInfo fieldInfo, BlockTermState state, boolean absolute)
+      throws IOException;
 
-  /** 
-   * Sets the current field for writing. */
+  /** Sets the current field for writing. */
   public abstract void setField(FieldInfo fieldInfo);
 
   @Override
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/PushPostingsWriterBase.java b/lucene/core/src/java/org/apache/lucene/codecs/PushPostingsWriterBase.java
index f51f0c6..1f1b050 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/PushPostingsWriterBase.java
+++ b/lucene/core/src/java/org/apache/lucene/codecs/PushPostingsWriterBase.java
@@ -16,23 +16,20 @@
  */
 package org.apache.lucene.codecs;
 
-
 import java.io.IOException;
-
-import org.apache.lucene.index.PostingsEnum;
 import org.apache.lucene.index.FieldInfo;
 import org.apache.lucene.index.IndexOptions;
 import org.apache.lucene.index.NumericDocValues;
+import org.apache.lucene.index.PostingsEnum;
 import org.apache.lucene.index.TermsEnum;
 import org.apache.lucene.util.BytesRef;
 import org.apache.lucene.util.FixedBitSet;
 
 /**
- * Extension of {@link PostingsWriterBase}, adding a push
- * API for writing each element of the postings.  This API
- * is somewhat analogous to an XML SAX API, while {@link
- * PostingsWriterBase} is more like an XML DOM API.
- * 
+ * Extension of {@link PostingsWriterBase}, adding a push API for writing each element of the
+ * postings. This API is somewhat analogous to an XML SAX API, while {@link PostingsWriterBase} is
+ * more like an XML DOM API.
+ *
  * @see PostingsReaderBase
  * @lucene.experimental
  */
@@ -48,8 +45,7 @@ public abstract class PushPostingsWriterBase extends PostingsWriterBase {
   /** {@link FieldInfo} of current field being written. */
   protected FieldInfo fieldInfo;
 
-  /** {@link IndexOptions} of current field being
-      written */
+  /** {@link IndexOptions} of current field being written */
   protected IndexOptions indexOptions;
 
   /** True if the current field writes freqs. */
@@ -64,28 +60,28 @@ public abstract class PushPostingsWriterBase extends PostingsWriterBase {
   /** True if the current field writes offsets. */
   protected boolean writeOffsets;
 
-  /** Sole constructor. (For invocation by subclass 
-   *  constructors, typically implicit.) */
-  protected PushPostingsWriterBase() {
-  }
+  /** Sole constructor. (For invocation by subclass constructors, typically implicit.) */
+  protected PushPostingsWriterBase() {}
 
   /** Return a newly created empty TermState */
   public abstract BlockTermState newTermState() throws IOException;
 
-  /** Start a new term.  Note that a matching call to {@link
-   *  #finishTerm(BlockTermState)} is done, only if the term has at least one
-   *  document. */
+  /**
+   * Start a new term. Note that a matching call to {@link #finishTerm(BlockTermState)} is done,
+   * only if the term has at least one document.
+   */
   public abstract void startTerm(NumericDocValues norms) throws IOException;
 
-  /** Finishes the current term.  The provided {@link
-   *  BlockTermState} contains the term's summary statistics, 
-   *  and will holds metadata from PBF when returned */
+  /**
+   * Finishes the current term. The provided {@link BlockTermState} contains the term's summary
+   * statistics, and will holds metadata from PBF when returned
+   */
   public abstract void finishTerm(BlockTermState state) throws IOException;
 
-  /** 
-   * Sets the current field for writing, and returns the
-   * fixed length of long[] metadata (which is fixed per
-   * field), called when the writing switches to another field. */
+  /**
+   * Sets the current field for writing, and returns the fixed length of long[] metadata (which is
+   * fixed per field), called when the writing switches to another field.
+   */
   @Override
   public void setField(FieldInfo fieldInfo) {
     this.fieldInfo = fieldInfo;
@@ -93,7 +89,8 @@ public abstract class PushPostingsWriterBase extends PostingsWriterBase {
 
     writeFreqs = indexOptions.compareTo(IndexOptions.DOCS_AND_FREQS) >= 0;
     writePositions = indexOptions.compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0;
-    writeOffsets = indexOptions.compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0;        
+    writeOffsets =
+        indexOptions.compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0;
     writePayloads = fieldInfo.hasPayloads();
 
     if (writeFreqs == false) {
@@ -116,7 +113,9 @@ public abstract class PushPostingsWriterBase extends PostingsWriterBase {
   }
 
   @Override
-  public final BlockTermState writeTerm(BytesRef term, TermsEnum termsEnum, FixedBitSet docsSeen, NormsProducer norms) throws IOException {
+  public final BlockTermState writeTerm(
+      BytesRef term, TermsEnum termsEnum, FixedBitSet docsSeen, NormsProducer norms)
+      throws IOException {
     NumericDocValues normValues;
     if (fieldInfo.hasNorms() == false) {
       normValues = null;
@@ -146,7 +145,7 @@ public abstract class PushPostingsWriterBase extends PostingsWriterBase {
       startDoc(docID, freq);
 
       if (writePositions) {
-        for(int i=0;i<freq;i++) {
+        for (int i = 0; i < freq; i++) {
           int pos = postingsEnum.nextPosition();
           BytesRef payload = writePayloads ? postingsEnum.getPayload() : null;
           int startOffset;
@@ -176,20 +175,21 @@ public abstract class PushPostingsWriterBase extends PostingsWriterBase {
     }
   }
 
-  /** Adds a new doc in this term. 
-   * <code>freq</code> will be -1 when term frequencies are omitted
-   * for the field. */
+  /**
+   * Adds a new doc in this term. <code>freq</code> will be -1 when term frequencies are omitted for
+   * the field.
+   */
   public abstract void startDoc(int docID, int freq) throws IOException;
 
-  /** Add a new position and payload, and start/end offset.  A
-   *  null payload means no payload; a non-null payload with
-   *  zero length also means no payload.  Caller may reuse
-   *  the {@link BytesRef} for the payload between calls
-   *  (method must fully consume the payload). <code>startOffset</code>
-   *  and <code>endOffset</code> will be -1 when offsets are not indexed. */
-  public abstract void addPosition(int position, BytesRef payload, int startOffset, int endOffset) throws IOException;
+  /**
+   * Add a new position and payload, and start/end offset. A null payload means no payload; a
+   * non-null payload with zero length also means no payload. Caller may reuse the {@link BytesRef}
+   * for the payload between calls (method must fully consume the payload). <code>startOffset</code>
+   * and <code>endOffset</code> will be -1 when offsets are not indexed.
+   */
+  public abstract void addPosition(int position, BytesRef payload, int startOffset, int endOffset)
+      throws IOException;
 
-  /** Called when we are done adding positions and payloads
-   *  for each doc. */
+  /** Called when we are done adding positions and payloads for each doc. */
   public abstract void finishDoc() throws IOException;
 }
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/SegmentInfoFormat.java b/lucene/core/src/java/org/apache/lucene/codecs/SegmentInfoFormat.java
index 40daf57..941b8ba 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/SegmentInfoFormat.java
+++ b/lucene/core/src/java/org/apache/lucene/codecs/SegmentInfoFormat.java
@@ -16,39 +16,40 @@
  */
 package org.apache.lucene.codecs;
 
-
 import java.io.IOException;
-
 import org.apache.lucene.index.SegmentInfo;
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.store.IOContext;
 
 /**
- * Expert: Controls the format of the 
- * {@link SegmentInfo} (segment metadata file).
+ * Expert: Controls the format of the {@link SegmentInfo} (segment metadata file).
+ *
  * @see SegmentInfo
  * @lucene.experimental
  */
 public abstract class SegmentInfoFormat {
-  /** Sole constructor. (For invocation by subclass 
-   *  constructors, typically implicit.) */
-  protected SegmentInfoFormat() {
-  }
+  /** Sole constructor. (For invocation by subclass constructors, typically implicit.) */
+  protected SegmentInfoFormat() {}
 
   /**
    * Read {@link SegmentInfo} data from a directory.
+   *
    * @param directory directory to read from
    * @param segmentName name of the segment to read
    * @param segmentID expected identifier for the segment
    * @return infos instance to be populated with data
    * @throws IOException If an I/O error occurs
    */
-  public abstract SegmentInfo read(Directory directory, String segmentName, byte segmentID[], IOContext context) throws IOException;
+  public abstract SegmentInfo read(
+      Directory directory, String segmentName, byte segmentID[], IOContext context)
+      throws IOException;
 
   /**
-   * Write {@link SegmentInfo} data.
-   * The codec must add its SegmentInfo filename(s) to {@code info} before doing i/o. 
+   * Write {@link SegmentInfo} data. The codec must add its SegmentInfo filename(s) to {@code info}
+   * before doing i/o.
+   *
    * @throws IOException If an I/O error occurs
    */
-  public abstract void write(Directory dir, SegmentInfo info, IOContext ioContext) throws IOException;
+  public abstract void write(Directory dir, SegmentInfo info, IOContext ioContext)
+      throws IOException;
 }
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/StoredFieldsFormat.java b/lucene/core/src/java/org/apache/lucene/codecs/StoredFieldsFormat.java
index 549fe2f..f5f83b2 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/StoredFieldsFormat.java
+++ b/lucene/core/src/java/org/apache/lucene/codecs/StoredFieldsFormat.java
@@ -16,28 +16,22 @@
  */
 package org.apache.lucene.codecs;
 
-
 import java.io.IOException;
-
 import org.apache.lucene.index.FieldInfos;
 import org.apache.lucene.index.SegmentInfo;
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.store.IOContext;
 
-/**
- * Controls the format of stored fields
- */
+/** Controls the format of stored fields */
 public abstract class StoredFieldsFormat {
-  /** Sole constructor. (For invocation by subclass 
-   *  constructors, typically implicit.) */
-  protected StoredFieldsFormat() {
-  }
+  /** Sole constructor. (For invocation by subclass constructors, typically implicit.) */
+  protected StoredFieldsFormat() {}
 
-  /** Returns a {@link StoredFieldsReader} to load stored
-   *  fields. */
-  public abstract StoredFieldsReader fieldsReader(Directory directory, SegmentInfo si, FieldInfos fn, IOContext context) throws IOException;
+  /** Returns a {@link StoredFieldsReader} to load stored fields. */
+  public abstract StoredFieldsReader fieldsReader(
+      Directory directory, SegmentInfo si, FieldInfos fn, IOContext context) throws IOException;
 
-  /** Returns a {@link StoredFieldsWriter} to write stored
-   *  fields. */
-  public abstract StoredFieldsWriter fieldsWriter(Directory directory, SegmentInfo si, IOContext context) throws IOException;
+  /** Returns a {@link StoredFieldsWriter} to write stored fields. */
+  public abstract StoredFieldsWriter fieldsWriter(
+      Directory directory, SegmentInfo si, IOContext context) throws IOException;
 }
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/StoredFieldsReader.java b/lucene/core/src/java/org/apache/lucene/codecs/StoredFieldsReader.java
index 1f32576..ea76e67 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/StoredFieldsReader.java
+++ b/lucene/core/src/java/org/apache/lucene/codecs/StoredFieldsReader.java
@@ -18,43 +18,43 @@ package org.apache.lucene.codecs;
 
 import java.io.Closeable;
 import java.io.IOException;
-
 import org.apache.lucene.index.StoredFieldVisitor;
 import org.apache.lucene.util.Accountable;
 
 /**
  * Codec API for reading stored fields.
- * <p>
- * You need to implement {@link #visitDocument(int, StoredFieldVisitor)} to
- * read the stored fields for a document, implement {@link #clone()} (creating
- * clones of any IndexInputs used, etc), and {@link #close()}
+ *
+ * <p>You need to implement {@link #visitDocument(int, StoredFieldVisitor)} to read the stored
+ * fields for a document, implement {@link #clone()} (creating clones of any IndexInputs used, etc),
+ * and {@link #close()}
+ *
  * @lucene.experimental
  */
 public abstract class StoredFieldsReader implements Cloneable, Closeable, Accountable {
-  /** Sole constructor. (For invocation by subclass 
-   *  constructors, typically implicit.) */
-  protected StoredFieldsReader() {
-  }
-  
+  /** Sole constructor. (For invocation by subclass constructors, typically implicit.) */
+  protected StoredFieldsReader() {}
+
   /** Visit the stored fields for document <code>docID</code> */
   public abstract void visitDocument(int docID, StoredFieldVisitor visitor) throws IOException;
 
   @Override
   public abstract StoredFieldsReader clone();
-  
-  /** 
+
+  /**
    * Checks consistency of this reader.
-   * <p>
-   * Note that this may be costly in terms of I/O, e.g. 
-   * may involve computing a checksum value against large data files.
+   *
+   * <p>Note that this may be costly in terms of I/O, e.g. may involve computing a checksum value
+   * against large data files.
+   *
    * @lucene.internal
    */
   public abstract void checkIntegrity() throws IOException;
-  
-  /** 
+
+  /**
    * Returns an instance optimized for merging. This instance may not be cloned.
-   * <p>
-   * The default implementation returns {@code this} */
+   *
+   * <p>The default implementation returns {@code this}
+   */
   public StoredFieldsReader getMergeInstance() {
     return this;
   }
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/StoredFieldsWriter.java b/lucene/core/src/java/org/apache/lucene/codecs/StoredFieldsWriter.java
index b778d206..02f2887 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/StoredFieldsWriter.java
+++ b/lucene/core/src/java/org/apache/lucene/codecs/StoredFieldsWriter.java
@@ -16,13 +16,14 @@
  */
 package org.apache.lucene.codecs;
 
+import static org.apache.lucene.search.DocIdSetIterator.NO_MORE_DOCS;
+
 import java.io.Closeable;
 import java.io.IOException;
 import java.io.Reader;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Objects;
-
 import org.apache.lucene.analysis.Analyzer;
 import org.apache.lucene.analysis.TokenStream;
 import org.apache.lucene.document.StoredField;
@@ -36,33 +37,30 @@ import org.apache.lucene.index.StoredFieldVisitor;
 import org.apache.lucene.util.Accountable;
 import org.apache.lucene.util.BytesRef;
 
-import static org.apache.lucene.search.DocIdSetIterator.NO_MORE_DOCS;
-
 /**
  * Codec API for writing stored fields:
+ *
  * <ol>
- *   <li>For every document, {@link #startDocument()} is called,
- *       informing the Codec that a new document has started.
- *   <li>{@link #writeField(FieldInfo, IndexableField)} is called for 
- *       each field in the document.
- *   <li>After all documents have been written, {@link #finish(FieldInfos, int)} 
- *       is called for verification/sanity-checks.
+ *   <li>For every document, {@link #startDocument()} is called, informing the Codec that a new
+ *       document has started.
+ *   <li>{@link #writeField(FieldInfo, IndexableField)} is called for each field in the document.
+ *   <li>After all documents have been written, {@link #finish(FieldInfos, int)} is called for
+ *       verification/sanity-checks.
  *   <li>Finally the writer is closed ({@link #close()})
  * </ol>
- * 
+ *
  * @lucene.experimental
  */
 public abstract class StoredFieldsWriter implements Closeable, Accountable {
-  
-  /** Sole constructor. (For invocation by subclass 
-   *  constructors, typically implicit.) */
-  protected StoredFieldsWriter() {
-  }
 
-  /** Called before writing the stored fields of the document.
-   *  {@link #writeField(FieldInfo, IndexableField)} will be called
-   *  for each stored field. Note that this is
-   *  called even if the document has no stored fields. */
+  /** Sole constructor. (For invocation by subclass constructors, typically implicit.) */
+  protected StoredFieldsWriter() {}
+
+  /**
+   * Called before writing the stored fields of the document. {@link #writeField(FieldInfo,
+   * IndexableField)} will be called for each stored field. Note that this is called even if the
+   * document has no stored fields.
+   */
   public abstract void startDocument() throws IOException;
 
   /** Called when a document and all its fields have been added. */
@@ -70,13 +68,12 @@ public abstract class StoredFieldsWriter implements Closeable, Accountable {
 
   /** Writes a single stored field. */
   public abstract void writeField(FieldInfo info, IndexableField field) throws IOException;
-  
-  /** Called before {@link #close()}, passing in the number
-   *  of documents that were written. Note that this is 
-   *  intentionally redundant (equivalent to the number of
-   *  calls to {@link #startDocument()}, but a Codec should
-   *  check that this is the case to detect the JRE bug described 
-   *  in LUCENE-1282. */
+
+  /**
+   * Called before {@link #close()}, passing in the number of documents that were written. Note that
+   * this is intentionally redundant (equivalent to the number of calls to {@link #startDocument()},
+   * but a Codec should check that this is the case to detect the JRE bug described in LUCENE-1282.
+   */
   public abstract void finish(FieldInfos fis, int numDocs) throws IOException;
 
   private static class StoredFieldsMergeSub extends DocIDMerger.Sub {
@@ -85,7 +82,8 @@ public abstract class StoredFieldsWriter implements Closeable, Accountable {
     private final MergeVisitor visitor;
     int docID = -1;
 
-    public StoredFieldsMergeSub(MergeVisitor visitor, MergeState.DocMap docMap, StoredFieldsReader reader, int maxDoc) {
+    public StoredFieldsMergeSub(
+        MergeVisitor visitor, MergeState.DocMap docMap, StoredFieldsReader reader, int maxDoc) {
       super(docMap);
       this.maxDoc = maxDoc;
       this.reader = reader;
@@ -102,23 +100,29 @@ public abstract class StoredFieldsWriter implements Closeable, Accountable {
       }
     }
   }
-  
-  /** Merges in the stored fields from the readers in 
-   *  <code>mergeState</code>. The default implementation skips
-   *  over deleted documents, and uses {@link #startDocument()},
-   *  {@link #writeField(FieldInfo, IndexableField)}, and {@link #finish(FieldInfos, int)},
-   *  returning the number of documents that were written.
-   *  Implementations can override this method for more sophisticated
-   *  merging (bulk-byte copying, etc). */
+
+  /**
+   * Merges in the stored fields from the readers in <code>mergeState</code>. The default
+   * implementation skips over deleted documents, and uses {@link #startDocument()}, {@link
+   * #writeField(FieldInfo, IndexableField)}, and {@link #finish(FieldInfos, int)}, returning the
+   * number of documents that were written. Implementations can override this method for more
+   * sophisticated merging (bulk-byte copying, etc).
+   */
   public int merge(MergeState mergeState) throws IOException {
     List<StoredFieldsMergeSub> subs = new ArrayList<>();
-    for(int i=0;i<mergeState.storedFieldsReaders.length;i++) {
+    for (int i = 0; i < mergeState.storedFieldsReaders.length; i++) {
       StoredFieldsReader storedFieldsReader = mergeState.storedFieldsReaders[i];
       storedFieldsReader.checkIntegrity();
-      subs.add(new StoredFieldsMergeSub(new MergeVisitor(mergeState, i), mergeState.docMaps[i], storedFieldsReader, mergeState.maxDocs[i]));
+      subs.add(
+          new StoredFieldsMergeSub(
+              new MergeVisitor(mergeState, i),
+              mergeState.docMaps[i],
+              storedFieldsReader,
+              mergeState.maxDocs[i]));
     }
 
-    final DocIDMerger<StoredFieldsMergeSub> docIDMerger = DocIDMerger.of(subs, mergeState.needsIndexSort);
+    final DocIDMerger<StoredFieldsMergeSub> docIDMerger =
+        DocIDMerger.of(subs, mergeState.needsIndexSort);
 
     int docCount = 0;
     while (true) {
@@ -135,11 +139,12 @@ public abstract class StoredFieldsWriter implements Closeable, Accountable {
     finish(mergeState.mergeFieldInfos, docCount);
     return docCount;
   }
-  
-  /** 
+
+  /**
    * A visitor that adds every field it sees.
-   * <p>
-   * Use like this:
+   *
+   * <p>Use like this:
+   *
    * <pre>
    * MergeVisitor visitor = new MergeVisitor(mergeState, readerIndex);
    * for (...) {
@@ -155,10 +160,8 @@ public abstract class StoredFieldsWriter implements Closeable, Accountable {
     Number numericValue;
     FieldInfo currentField;
     FieldInfos remapper;
-    
-    /**
-     * Create new merge visitor.
-     */
+
+    /** Create new merge visitor. */
     public MergeVisitor(MergeState mergeState, int readerIndex) {
       // if field numbers are aligned, we can save hash lookups
       // on every field access. Otherwise, we need to lookup
@@ -171,7 +174,7 @@ public abstract class StoredFieldsWriter implements Closeable, Accountable {
         }
       }
     }
-    
+
     @Override
     public void binaryField(FieldInfo fieldInfo, byte[] value) throws IOException {
       reset(fieldInfo);
@@ -266,7 +269,7 @@ public abstract class StoredFieldsWriter implements Closeable, Accountable {
       stringValue = null;
       numericValue = null;
     }
-    
+
     void write() throws IOException {
       writeField(currentField, this);
     }
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/TermStats.java b/lucene/core/src/java/org/apache/lucene/codecs/TermStats.java
index c3c2a48..60c522e 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/TermStats.java
+++ b/lucene/core/src/java/org/apache/lucene/codecs/TermStats.java
@@ -16,22 +16,19 @@
  */
 package org.apache.lucene.codecs;
 
-
 import org.apache.lucene.index.TermsEnum; // javadocs
 
 /**
  * Holder for per-term statistics.
- * 
+ *
  * @see TermsEnum#docFreq
  * @see TermsEnum#totalTermFreq
  */
 public class TermStats {
-  /** How many documents have at least one occurrence of
-   *  this term. */
+  /** How many documents have at least one occurrence of this term. */
   public final int docFreq;
-  
-  /** Total number of times this term occurs across all
-   *  documents in the field. */
+
+  /** Total number of times this term occurs across all documents in the field. */
   public final long totalTermFreq;
 
   /** Sole constructor. */
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/TermVectorsFormat.java b/lucene/core/src/java/org/apache/lucene/codecs/TermVectorsFormat.java
index a0a65a6..76745b9 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/TermVectorsFormat.java
+++ b/lucene/core/src/java/org/apache/lucene/codecs/TermVectorsFormat.java
@@ -16,28 +16,23 @@
  */
 package org.apache.lucene.codecs;
 
-
 import java.io.IOException;
-
 import org.apache.lucene.index.FieldInfos;
 import org.apache.lucene.index.SegmentInfo;
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.store.IOContext;
 
-/**
- * Controls the format of term vectors
- */
+/** Controls the format of term vectors */
 public abstract class TermVectorsFormat {
-  /** Sole constructor. (For invocation by subclass 
-   *  constructors, typically implicit.) */
-  protected TermVectorsFormat() {
-  }
+  /** Sole constructor. (For invocation by subclass constructors, typically implicit.) */
+  protected TermVectorsFormat() {}
 
-  /** Returns a {@link TermVectorsReader} to read term
-   *  vectors. */
-  public abstract TermVectorsReader vectorsReader(Directory directory, SegmentInfo segmentInfo, FieldInfos fieldInfos, IOContext context) throws IOException;
+  /** Returns a {@link TermVectorsReader} to read term vectors. */
+  public abstract TermVectorsReader vectorsReader(
+      Directory directory, SegmentInfo segmentInfo, FieldInfos fieldInfos, IOContext context)
+      throws IOException;
 
-  /** Returns a {@link TermVectorsWriter} to write term
-   *  vectors. */
-  public abstract TermVectorsWriter vectorsWriter(Directory directory, SegmentInfo segmentInfo, IOContext context) throws IOException;
+  /** Returns a {@link TermVectorsWriter} to write term vectors. */
+  public abstract TermVectorsWriter vectorsWriter(
+      Directory directory, SegmentInfo segmentInfo, IOContext context) throws IOException;
 }
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/TermVectorsReader.java b/lucene/core/src/java/org/apache/lucene/codecs/TermVectorsReader.java
index dc9115d..532a29e 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/TermVectorsReader.java
+++ b/lucene/core/src/java/org/apache/lucene/codecs/TermVectorsReader.java
@@ -16,51 +16,49 @@
  */
 package org.apache.lucene.codecs;
 
-
 import java.io.Closeable;
 import java.io.IOException;
-
 import org.apache.lucene.analysis.tokenattributes.OffsetAttribute; // javadocs
 import org.apache.lucene.index.Fields;
 import org.apache.lucene.util.Accountable;
 
 /**
  * Codec API for reading term vectors:
- * 
+ *
  * @lucene.experimental
  */
 public abstract class TermVectorsReader implements Cloneable, Closeable, Accountable {
 
-  /** Sole constructor. (For invocation by subclass 
-   *  constructors, typically implicit.) */
-  protected TermVectorsReader() {
-  }
+  /** Sole constructor. (For invocation by subclass constructors, typically implicit.) */
+  protected TermVectorsReader() {}
 
-  /** Returns term vectors for this document, or null if
-   *  term vectors were not indexed. If offsets are
-   *  available they are in an {@link OffsetAttribute}
-   *  available from the {@link org.apache.lucene.index.PostingsEnum}. */
+  /**
+   * Returns term vectors for this document, or null if term vectors were not indexed. If offsets
+   * are available they are in an {@link OffsetAttribute} available from the {@link
+   * org.apache.lucene.index.PostingsEnum}.
+   */
   public abstract Fields get(int doc) throws IOException;
-  
-  /** 
+
+  /**
    * Checks consistency of this reader.
-   * <p>
-   * Note that this may be costly in terms of I/O, e.g. 
-   * may involve computing a checksum value against large data files.
+   *
+   * <p>Note that this may be costly in terms of I/O, e.g. may involve computing a checksum value
+   * against large data files.
+   *
    * @lucene.internal
    */
   public abstract void checkIntegrity() throws IOException;
-  
-  /** Create a clone that one caller at a time may use to
-   *  read term vectors. */
+
+  /** Create a clone that one caller at a time may use to read term vectors. */
   @Override
   public abstract TermVectorsReader clone();
-  
-  /** 
-   * Returns an instance optimized for merging. This instance may only be
-   * consumed in the thread that called {@link #getMergeInstance()}.
-   * <p>
-   * The default implementation returns {@code this} */
+
+  /**
+   * Returns an instance optimized for merging. This instance may only be consumed in the thread
+   * that called {@link #getMergeInstance()}.
+   *
+   * <p>The default implementation returns {@code this}
+   */
   public TermVectorsReader getMergeInstance() {
     return this;
   }
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/TermVectorsWriter.java b/lucene/core/src/java/org/apache/lucene/codecs/TermVectorsWriter.java
index 7865c08..ee88de3 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/TermVectorsWriter.java
+++ b/lucene/core/src/java/org/apache/lucene/codecs/TermVectorsWriter.java
@@ -16,12 +16,13 @@
  */
 package org.apache.lucene.codecs;
 
+import static org.apache.lucene.search.DocIdSetIterator.NO_MORE_DOCS;
+
 import java.io.Closeable;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
-
 import org.apache.lucene.index.DocIDMerger;
 import org.apache.lucene.index.FieldInfo;
 import org.apache.lucene.index.FieldInfos;
@@ -36,58 +37,58 @@ import org.apache.lucene.util.Accountable;
 import org.apache.lucene.util.BytesRef;
 import org.apache.lucene.util.BytesRefBuilder;
 
-import static org.apache.lucene.search.DocIdSetIterator.NO_MORE_DOCS;
-
 /**
  * Codec API for writing term vectors:
+ *
  * <ol>
- *   <li>For every document, {@link #startDocument(int)} is called,
- *       informing the Codec how many fields will be written.
- *   <li>{@link #startField(FieldInfo, int, boolean, boolean, boolean)} is called for 
- *       each field in the document, informing the codec how many terms
- *       will be written for that field, and whether or not positions,
- *       offsets, or payloads are enabled.
- *   <li>Within each field, {@link #startTerm(BytesRef, int)} is called
- *       for each term.
- *   <li>If offsets and/or positions are enabled, then 
- *       {@link #addPosition(int, int, int, BytesRef)} will be called for each term
- *       occurrence.
- *   <li>After all documents have been written, {@link #finish(FieldInfos, int)} 
- *       is called for verification/sanity-checks.
+ *   <li>For every document, {@link #startDocument(int)} is called, informing the Codec how many
+ *       fields will be written.
+ *   <li>{@link #startField(FieldInfo, int, boolean, boolean, boolean)} is called for each field in
+ *       the document, informing the codec how many terms will be written for that field, and
+ *       whether or not positions, offsets, or payloads are enabled.
+ *   <li>Within each field, {@link #startTerm(BytesRef, int)} is called for each term.
+ *   <li>If offsets and/or positions are enabled, then {@link #addPosition(int, int, int, BytesRef)}
+ *       will be called for each term occurrence.
+ *   <li>After all documents have been written, {@link #finish(FieldInfos, int)} is called for
+ *       verification/sanity-checks.
  *   <li>Finally the writer is closed ({@link #close()})
  * </ol>
- * 
+ *
  * @lucene.experimental
  */
 public abstract class TermVectorsWriter implements Closeable, Accountable {
-  
-  /** Sole constructor. (For invocation by subclass 
-   *  constructors, typically implicit.) */
-  protected TermVectorsWriter() {
-  }
 
-  /** Called before writing the term vectors of the document.
-   *  {@link #startField(FieldInfo, int, boolean, boolean, boolean)} will 
-   *  be called <code>numVectorFields</code> times. Note that if term 
-   *  vectors are enabled, this is called even if the document 
-   *  has no vector fields, in this case <code>numVectorFields</code> 
-   *  will be zero. */
+  /** Sole constructor. (For invocation by subclass constructors, typically implicit.) */
+  protected TermVectorsWriter() {}
+
+  /**
+   * Called before writing the term vectors of the document. {@link #startField(FieldInfo, int,
+   * boolean, boolean, boolean)} will be called <code>numVectorFields</code> times. Note that if
+   * term vectors are enabled, this is called even if the document has no vector fields, in this
+   * case <code>numVectorFields</code> will be zero.
+   */
   public abstract void startDocument(int numVectorFields) throws IOException;
 
   /** Called after a doc and all its fields have been added. */
-  public void finishDocument() throws IOException {};
+  public void finishDocument() throws IOException {}
+  ;
 
-  /** Called before writing the terms of the field.
-   *  {@link #startTerm(BytesRef, int)} will be called <code>numTerms</code> times. */
-  public abstract void startField(FieldInfo info, int numTerms, boolean positions, boolean offsets, boolean payloads) throws IOException;
+  /**
+   * Called before writing the terms of the field. {@link #startTerm(BytesRef, int)} will be called
+   * <code>numTerms</code> times.
+   */
+  public abstract void startField(
+      FieldInfo info, int numTerms, boolean positions, boolean offsets, boolean payloads)
+      throws IOException;
 
   /** Called after a field and all its terms have been added. */
-  public void finishField() throws IOException {};
+  public void finishField() throws IOException {}
+  ;
 
-  /** Adds a term and its term frequency <code>freq</code>.
-   * If this field has positions and/or offsets enabled, then
-   * {@link #addPosition(int, int, int, BytesRef)} will be called 
-   * <code>freq</code> times respectively.
+  /**
+   * Adds a term and its term frequency <code>freq</code>. If this field has positions and/or
+   * offsets enabled, then {@link #addPosition(int, int, int, BytesRef)} will be called <code>freq
+   * </code> times respectively.
    */
   public abstract void startTerm(BytesRef term, int freq) throws IOException;
 
@@ -95,27 +96,29 @@ public abstract class TermVectorsWriter implements Closeable, Accountable {
   public void finishTerm() throws IOException {}
 
   /** Adds a term position and offsets */
-  public abstract void addPosition(int position, int startOffset, int endOffset, BytesRef payload) throws IOException;
-
-  /** Called before {@link #close()}, passing in the number
-   *  of documents that were written. Note that this is 
-   *  intentionally redundant (equivalent to the number of
-   *  calls to {@link #startDocument(int)}, but a Codec should
-   *  check that this is the case to detect the JRE bug described 
-   *  in LUCENE-1282. */
+  public abstract void addPosition(int position, int startOffset, int endOffset, BytesRef payload)
+      throws IOException;
+
+  /**
+   * Called before {@link #close()}, passing in the number of documents that were written. Note that
+   * this is intentionally redundant (equivalent to the number of calls to {@link
+   * #startDocument(int)}, but a Codec should check that this is the case to detect the JRE bug
+   * described in LUCENE-1282.
+   */
   public abstract void finish(FieldInfos fis, int numDocs) throws IOException;
 
-  /** 
+  /**
    * Called by IndexWriter when writing new segments.
-   * <p>
-   * This is an expert API that allows the codec to consume 
-   * positions and offsets directly from the indexer.
-   * <p>
-   * The default implementation calls {@link #addPosition(int, int, int, BytesRef)},
-   * but subclasses can override this if they want to efficiently write 
-   * all the positions, then all the offsets, for example.
-   * <p>
-   * NOTE: This API is extremely expert and subject to change or removal!!!
+   *
+   * <p>This is an expert API that allows the codec to consume positions and offsets directly from
+   * the indexer.
+   *
+   * <p>The default implementation calls {@link #addPosition(int, int, int, BytesRef)}, but
+   * subclasses can override this if they want to efficiently write all the positions, then all the
+   * offsets, for example.
+   *
+   * <p>NOTE: This API is extremely expert and subject to change or removal!!!
+   *
    * @lucene.internal
    */
   // TODO: we should probably nuke this and make a more efficient 4.x format
@@ -129,7 +132,7 @@ public abstract class TermVectorsWriter implements Closeable, Accountable {
       final int startOffset;
       final int endOffset;
       final BytesRef thisPayload;
-      
+
       if (positions == null) {
         position = -1;
         thisPayload = null;
@@ -152,7 +155,7 @@ public abstract class TermVectorsWriter implements Closeable, Accountable {
           thisPayload = null;
         }
       }
-      
+
       if (offsets == null) {
         startOffset = endOffset = -1;
       } else {
@@ -163,7 +166,7 @@ public abstract class TermVectorsWriter implements Closeable, Accountable {
       addPosition(position, startOffset, endOffset, thisPayload);
     }
   }
-  
+
   private static class TermVectorsMergeSub extends DocIDMerger.Sub {
     private final TermVectorsReader reader;
     private final int maxDoc;
@@ -186,19 +189,18 @@ public abstract class TermVectorsWriter implements Closeable, Accountable {
     }
   }
 
-  /** Merges in the term vectors from the readers in 
-   *  <code>mergeState</code>. The default implementation skips
-   *  over deleted documents, and uses {@link #startDocument(int)},
-   *  {@link #startField(FieldInfo, int, boolean, boolean, boolean)}, 
-   *  {@link #startTerm(BytesRef, int)}, {@link #addPosition(int, int, int, BytesRef)},
-   *  and {@link #finish(FieldInfos, int)},
-   *  returning the number of documents that were written.
-   *  Implementations can override this method for more sophisticated
-   *  merging (bulk-byte copying, etc). */
+  /**
+   * Merges in the term vectors from the readers in <code>mergeState</code>. The default
+   * implementation skips over deleted documents, and uses {@link #startDocument(int)}, {@link
+   * #startField(FieldInfo, int, boolean, boolean, boolean)}, {@link #startTerm(BytesRef, int)},
+   * {@link #addPosition(int, int, int, BytesRef)}, and {@link #finish(FieldInfos, int)}, returning
+   * the number of documents that were written. Implementations can override this method for more
+   * sophisticated merging (bulk-byte copying, etc).
+   */
   public int merge(MergeState mergeState) throws IOException {
 
     List<TermVectorsMergeSub> subs = new ArrayList<>();
-    for(int i=0;i<mergeState.termVectorsReaders.length;i++) {
+    for (int i = 0; i < mergeState.termVectorsReaders.length; i++) {
       TermVectorsReader reader = mergeState.termVectorsReaders[i];
       if (reader != null) {
         reader.checkIntegrity();
@@ -206,7 +208,8 @@ public abstract class TermVectorsWriter implements Closeable, Accountable {
       subs.add(new TermVectorsMergeSub(mergeState.docMaps[i], reader, mergeState.maxDocs[i]));
     }
 
-    final DocIDMerger<TermVectorsMergeSub> docIDMerger = DocIDMerger.of(subs, mergeState.needsIndexSort);
+    final DocIDMerger<TermVectorsMergeSub> docIDMerger =
+        DocIDMerger.of(subs, mergeState.needsIndexSort);
 
     int docCount = 0;
     while (true) {
@@ -229,9 +232,8 @@ public abstract class TermVectorsWriter implements Closeable, Accountable {
     finish(mergeState.mergeFieldInfos, docCount);
     return docCount;
   }
-  
-  /** Safe (but, slowish) default method to write every
-   *  vector field in the document. */
+
+  /** Safe (but, slowish) default method to write every vector field in the document. */
   protected final void addAllDocVectors(Fields vectors, MergeState mergeState) throws IOException {
     if (vectors == null) {
       startDocument(0);
@@ -249,18 +251,19 @@ public abstract class TermVectorsWriter implements Closeable, Accountable {
       }
     }
     startDocument(numFields);
-    
+
     String lastFieldName = null;
-    
+
     TermsEnum termsEnum = null;
     PostingsEnum docsAndPositionsEnum = null;
-    
+
     int fieldCount = 0;
-    for(String fieldName : vectors) {
+    for (String fieldName : vectors) {
       fieldCount++;
       final FieldInfo fieldInfo = mergeState.mergeFieldInfos.fieldInfo(fieldName);
 
-      assert lastFieldName == null || fieldName.compareTo(lastFieldName) > 0: "lastFieldName=" + lastFieldName + " fieldName=" + fieldName;
+      assert lastFieldName == null || fieldName.compareTo(lastFieldName) > 0
+          : "lastFieldName=" + lastFieldName + " fieldName=" + fieldName;
       lastFieldName = fieldName;
 
       final Terms terms = vectors.terms(fieldName);
@@ -268,49 +271,52 @@ public abstract class TermVectorsWriter implements Closeable, Accountable {
         // FieldsEnum shouldn't lie...
         continue;
       }
-      
+
       final boolean hasPositions = terms.hasPositions();
       final boolean hasOffsets = terms.hasOffsets();
       final boolean hasPayloads = terms.hasPayloads();
       assert !hasPayloads || hasPositions;
-      
+
       int numTerms = (int) terms.size();
       if (numTerms == -1) {
-        // count manually. It is stupid, but needed, as Terms.size() is not a mandatory statistics function
+        // count manually. It is stupid, but needed, as Terms.size() is not a mandatory statistics
+        // function
         numTerms = 0;
         termsEnum = terms.iterator();
-        while(termsEnum.next() != null) {
+        while (termsEnum.next() != null) {
           numTerms++;
         }
       }
-      
+
       startField(fieldInfo, numTerms, hasPositions, hasOffsets, hasPayloads);
       termsEnum = terms.iterator();
 
       int termCount = 0;
-      while(termsEnum.next() != null) {
+      while (termsEnum.next() != null) {
         termCount++;
 
         final int freq = (int) termsEnum.totalTermFreq();
-        
+
         startTerm(termsEnum.term(), freq);
 
         if (hasPositions || hasOffsets) {
-          docsAndPositionsEnum = termsEnum.postings(docsAndPositionsEnum, PostingsEnum.OFFSETS | PostingsEnum.PAYLOADS);
+          docsAndPositionsEnum =
+              termsEnum.postings(
+                  docsAndPositionsEnum, PostingsEnum.OFFSETS | PostingsEnum.PAYLOADS);
           assert docsAndPositionsEnum != null;
-          
+
           final int docID = docsAndPositionsEnum.nextDoc();
           assert docID != DocIdSetIterator.NO_MORE_DOCS;
           assert docsAndPositionsEnum.freq() == freq;
 
-          for(int posUpto=0; posUpto<freq; posUpto++) {
+          for (int posUpto = 0; posUpto < freq; posUpto++) {
             final int pos = docsAndPositionsEnum.nextPosition();
             final int startOffset = docsAndPositionsEnum.startOffset();
             final int endOffset = docsAndPositionsEnum.endOffset();
-            
+
             final BytesRef payload = docsAndPositionsEnum.getPayload();
 
-            assert !hasPositions || pos >= 0 ;
+            assert !hasPositions || pos >= 0;
             addPosition(pos, startOffset, endOffset, payload);
           }
         }
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/VectorFormat.java b/lucene/core/src/java/org/apache/lucene/codecs/VectorFormat.java
index a7a64e1..7cce5b2 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/VectorFormat.java
+++ b/lucene/core/src/java/org/apache/lucene/codecs/VectorFormat.java
@@ -18,59 +18,56 @@
 package org.apache.lucene.codecs;
 
 import java.io.IOException;
-
 import org.apache.lucene.index.SegmentReadState;
 import org.apache.lucene.index.SegmentWriteState;
 import org.apache.lucene.index.VectorValues;
 
 /**
- * Encodes/decodes per-document vector and any associated indexing structures required to support nearest-neighbor search
+ * Encodes/decodes per-document vector and any associated indexing structures required to support
+ * nearest-neighbor search
  */
 public abstract class VectorFormat {
 
   /** Sole constructor */
   protected VectorFormat() {}
 
-  /**
-   * Returns a {@link VectorWriter} to write the vectors to the index.
-   */
+  /** Returns a {@link VectorWriter} to write the vectors to the index. */
   public abstract VectorWriter fieldsWriter(SegmentWriteState state) throws IOException;
 
-  /**
-   * Returns a {@link VectorReader} to read the vectors from the index.
-   */
+  /** Returns a {@link VectorReader} to read the vectors from the index. */
   public abstract VectorReader fieldsReader(SegmentReadState state) throws IOException;
 
   /**
-   * EMPTY throws an exception when written. It acts as a sentinel indicating a Codec that does not support vectors.
+   * EMPTY throws an exception when written. It acts as a sentinel indicating a Codec that does not
+   * support vectors.
    */
-  public static final VectorFormat EMPTY = new VectorFormat() {
-    @Override
-    public VectorWriter fieldsWriter(SegmentWriteState state) {
-      throw new UnsupportedOperationException("Attempt to write EMPTY VectorValues: maybe you forgot to use codec=Lucene90");
-    }
-
-    @Override
-    public VectorReader fieldsReader(SegmentReadState state) {
-      return new VectorReader() {
+  public static final VectorFormat EMPTY =
+      new VectorFormat() {
         @Override
-        public void checkIntegrity() {
+        public VectorWriter fieldsWriter(SegmentWriteState state) {
+          throw new UnsupportedOperationException(
+              "Attempt to write EMPTY VectorValues: maybe you forgot to use codec=Lucene90");
         }
 
         @Override
-        public VectorValues getVectorValues(String field)  {
-          return VectorValues.EMPTY;
-        }
+        public VectorReader fieldsReader(SegmentReadState state) {
+          return new VectorReader() {
+            @Override
+            public void checkIntegrity() {}
 
-        @Override
-        public void close() throws IOException {
-        }
+            @Override
+            public VectorValues getVectorValues(String field) {
+              return VectorValues.EMPTY;
+            }
 
-        @Override
-        public long ramBytesUsed() {
-          return 0;
+            @Override
+            public void close() throws IOException {}
+
+            @Override
+            public long ramBytesUsed() {
+              return 0;
+            }
+          };
         }
       };
-    }
-  };
 }
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/VectorReader.java b/lucene/core/src/java/org/apache/lucene/codecs/VectorReader.java
index 15a3d46..6b878ca 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/VectorReader.java
+++ b/lucene/core/src/java/org/apache/lucene/codecs/VectorReader.java
@@ -19,13 +19,10 @@ package org.apache.lucene.codecs;
 
 import java.io.Closeable;
 import java.io.IOException;
-
 import org.apache.lucene.index.VectorValues;
 import org.apache.lucene.util.Accountable;
 
-/**
- * Reads vectors from an index.
- */
+/** Reads vectors from an index. */
 public abstract class VectorReader implements Closeable, Accountable {
 
   /** Sole constructor */
@@ -33,9 +30,10 @@ public abstract class VectorReader implements Closeable, Accountable {
 
   /**
    * Checks consistency of this reader.
-   * <p>
-   * Note that this may be costly in terms of I/O, e.g.
-   * may involve computing a checksum value against large data files.
+   *
+   * <p>Note that this may be costly in terms of I/O, e.g. may involve computing a checksum value
+   * against large data files.
+   *
    * @lucene.internal
    */
   public abstract void checkIntegrity() throws IOException;
@@ -44,12 +42,12 @@ public abstract class VectorReader implements Closeable, Accountable {
   public abstract VectorValues getVectorValues(String field) throws IOException;
 
   /**
-   * Returns an instance optimized for merging. This instance may only be
-   * consumed in the thread that called {@link #getMergeInstance()}.
-   * <p>
-   * The default implementation returns {@code this} */
+   * Returns an instance optimized for merging. This instance may only be consumed in the thread
+   * that called {@link #getMergeInstance()}.
+   *
+   * <p>The default implementation returns {@code this}
+   */
   public VectorReader getMergeInstance() {
     return this;
   }
-
 }
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/VectorWriter.java b/lucene/core/src/java/org/apache/lucene/codecs/VectorWriter.java
index 7b13310..d14fded 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/VectorWriter.java
+++ b/lucene/core/src/java/org/apache/lucene/codecs/VectorWriter.java
@@ -17,12 +17,13 @@
 
 package org.apache.lucene.codecs;
 
+import static org.apache.lucene.search.DocIdSetIterator.NO_MORE_DOCS;
+
 import java.io.Closeable;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
-
 import org.apache.lucene.index.DocIDMerger;
 import org.apache.lucene.index.FieldInfo;
 import org.apache.lucene.index.MergeState;
@@ -32,11 +33,7 @@ import org.apache.lucene.index.VectorValues;
 import org.apache.lucene.search.TopDocs;
 import org.apache.lucene.util.BytesRef;
 
-import static org.apache.lucene.search.DocIdSetIterator.NO_MORE_DOCS;
-
-/**
- * Writes vectors to an index.
- */
+/** Writes vectors to an index. */
 public abstract class VectorWriter implements Closeable {
 
   /** Sole constructor */
@@ -65,7 +62,8 @@ public abstract class VectorWriter implements Closeable {
     finish();
   }
 
-  private void mergeVectors(FieldInfo mergeFieldInfo, final MergeState mergeState) throws IOException {
+  private void mergeVectors(FieldInfo mergeFieldInfo, final MergeState mergeState)
+      throws IOException {
     if (mergeState.infoStream.isEnabled("VV")) {
       mergeState.infoStream.message("VV", "merging " + mergeState.segmentInfo);
     }
@@ -78,16 +76,27 @@ public abstract class VectorWriter implements Closeable {
       if (vectorReader != null) {
         if (mergeFieldInfo != null && mergeFieldInfo.hasVectorValues()) {
           int segmentDimension = mergeFieldInfo.getVectorDimension();
-          VectorValues.SearchStrategy segmentSearchStrategy = mergeFieldInfo.getVectorSearchStrategy();
+          VectorValues.SearchStrategy segmentSearchStrategy =
+              mergeFieldInfo.getVectorSearchStrategy();
           if (dimension == -1) {
             dimension = segmentDimension;
             searchStrategy = mergeFieldInfo.getVectorSearchStrategy();
           } else if (dimension != segmentDimension) {
-            throw new IllegalStateException("Varying dimensions for vector-valued field " + mergeFieldInfo.name
-                + ": " + dimension + "!=" + segmentDimension);
+            throw new IllegalStateException(
+                "Varying dimensions for vector-valued field "
+                    + mergeFieldInfo.name
+                    + ": "
+                    + dimension
+                    + "!="
+                    + segmentDimension);
           } else if (searchStrategy != segmentSearchStrategy) {
-            throw new IllegalStateException("Varying search strategys for vector-valued field " + mergeFieldInfo.name
-                + ": " + searchStrategy + "!=" + segmentSearchStrategy);
+            throw new IllegalStateException(
+                "Varying search strategys for vector-valued field "
+                    + mergeFieldInfo.name
+                    + ": "
+                    + searchStrategy
+                    + "!="
+                    + segmentSearchStrategy);
           }
           VectorValues values = vectorReader.getVectorValues(mergeFieldInfo.name);
           if (values != null) {
@@ -134,10 +143,12 @@ public abstract class VectorWriter implements Closeable {
   }
 
   /**
-   * View over multiple VectorValues supporting iterator-style access via DocIdMerger. Maintains a reverse ordinal
-   * mapping for documents having values in order to support random access by dense ordinal.
+   * View over multiple VectorValues supporting iterator-style access via DocIdMerger. Maintains a
+   * reverse ordinal mapping for documents having values in order to support random access by dense
+   * ordinal.
    */
-  private static class VectorValuesMerger extends VectorValues implements RandomAccessVectorValuesProducer {
+  private static class VectorValuesMerger extends VectorValues
+      implements RandomAccessVectorValuesProducer {
     private final List<VectorValuesSub> subs;
     private final DocIDMerger<VectorValuesSub> docIdMerger;
     private final int[] ordBase;
@@ -146,7 +157,8 @@ public abstract class VectorWriter implements Closeable {
 
     private int docId;
     private VectorValuesSub current;
-    // For each doc with a vector, record its ord in the segments being merged. This enables random access into the
+    // For each doc with a vector, record its ord in the segments being merged. This enables random
+    // access into the
     // unmerged segments using the ords from the merged segment.
     private int[] ordMap;
     private int ord;
@@ -244,7 +256,8 @@ public abstract class VectorWriter implements Closeable {
           if (sub.values instanceof RandomAccessVectorValuesProducer) {
             raSubs.add(((RandomAccessVectorValuesProducer) sub.values).randomAccess());
           } else {
-            throw new IllegalStateException("Cannot merge VectorValues without support for random access");
+            throw new IllegalStateException(
+                "Cannot merge VectorValues without support for random access");
           }
         }
       }
@@ -272,7 +285,7 @@ public abstract class VectorWriter implements Closeable {
           // get the index of the greatest lower bound
           segmentOrd = -2 - segmentOrd;
         }
-        while(segmentOrd < ordBase.length - 1 && ordBase[segmentOrd + 1] == ordBase[segmentOrd]) {
+        while (segmentOrd < ordBase.length - 1 && ordBase[segmentOrd + 1] == ordBase[segmentOrd]) {
           // forward over empty segments which will share the same ordBase
           segmentOrd++;
         }
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/blocktree/BlockTreeTermsReader.java b/lucene/core/src/java/org/apache/lucene/codecs/blocktree/BlockTreeTermsReader.java
index bee914b..79916f8 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/blocktree/BlockTreeTermsReader.java
+++ b/lucene/core/src/java/org/apache/lucene/codecs/blocktree/BlockTreeTermsReader.java
@@ -24,7 +24,6 @@ import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
-
 import org.apache.lucene.codecs.CodecUtil;
 import org.apache.lucene.codecs.FieldsProducer;
 import org.apache.lucene.codecs.PostingsReaderBase;
@@ -43,40 +42,32 @@ import org.apache.lucene.util.IOUtils;
 import org.apache.lucene.util.fst.ByteSequenceOutputs;
 import org.apache.lucene.util.fst.Outputs;
 
-/** A block-based terms index and dictionary that assigns
- *  terms to variable length blocks according to how they
- *  share prefixes.  The terms index is a prefix trie
- *  whose leaves are term blocks.  The advantage of this
- *  approach is that seekExact is often able to
- *  determine a term cannot exist without doing any IO, and
- *  intersection with Automata is very fast.  Note that this
- *  terms dictionary has its own fixed terms index (ie, it
- *  does not support a pluggable terms index
- *  implementation).
+/**
+ * A block-based terms index and dictionary that assigns terms to variable length blocks according
+ * to how they share prefixes. The terms index is a prefix trie whose leaves are term blocks. The
+ * advantage of this approach is that seekExact is often able to determine a term cannot exist
+ * without doing any IO, and intersection with Automata is very fast. Note that this terms
+ * dictionary has its own fixed terms index (ie, it does not support a pluggable terms index
+ * implementation).
  *
- *  <p><b>NOTE</b>: this terms dictionary supports
- *  min/maxItemsPerBlock during indexing to control how
- *  much memory the terms index uses.</p>
+ * <p><b>NOTE</b>: this terms dictionary supports min/maxItemsPerBlock during indexing to control
+ * how much memory the terms index uses.
  *
- *  <p>The data structure used by this implementation is very
- *  similar to a burst trie
- *  (http://citeseer.ist.psu.edu/viewdoc/summary?doi=10.1.1.18.3499),
- *  but with added logic to break up too-large blocks of all
- *  terms sharing a given prefix into smaller ones.</p>
+ * <p>The data structure used by this implementation is very similar to a burst trie
+ * (http://citeseer.ist.psu.edu/viewdoc/summary?doi=10.1.1.18.3499), but with added logic to break
+ * up too-large blocks of all terms sharing a given prefix into smaller ones.
  *
- *  <p>Use {@link org.apache.lucene.index.CheckIndex} with the <code>-verbose</code>
- *  option to see summary statistics on the blocks in the
- *  dictionary.
+ * <p>Use {@link org.apache.lucene.index.CheckIndex} with the <code>-verbose</code> option to see
+ * summary statistics on the blocks in the dictionary.
  *
- *  See {@link BlockTreeTermsWriter}.
+ * <p>See {@link BlockTreeTermsWriter}.
  *
  * @lucene.experimental
  */
-
 public final class BlockTreeTermsReader extends FieldsProducer {
 
   static final Outputs<BytesRef> FST_OUTPUTS = ByteSequenceOutputs.getSingleton();
-  
+
   static final BytesRef NO_OUTPUT = FST_OUTPUTS.getNoOutput();
 
   static final int OUTPUT_FLAGS_NUM_BITS = 2;
@@ -86,7 +77,8 @@ public final class BlockTreeTermsReader extends FieldsProducer {
 
   /** Extension of terms file */
   static final String TERMS_EXTENSION = "tim";
-  final static String TERMS_CODEC_NAME = "BlockTreeTermsDict";
+
+  static final String TERMS_CODEC_NAME = "BlockTreeTermsDict";
 
   /** Initial terms format. */
   public static final int VERSION_START = 3;
@@ -105,45 +97,63 @@ public final class BlockTreeTermsReader extends FieldsProducer {
 
   /** Extension of terms index file */
   static final String TERMS_INDEX_EXTENSION = "tip";
-  final static String TERMS_INDEX_CODEC_NAME = "BlockTreeTermsIndex";
+
+  static final String TERMS_INDEX_CODEC_NAME = "BlockTreeTermsIndex";
 
   /** Extension of terms meta file */
   static final String TERMS_META_EXTENSION = "tmd";
-  final static String TERMS_META_CODEC_NAME = "BlockTreeTermsMeta";
+
+  static final String TERMS_META_CODEC_NAME = "BlockTreeTermsMeta";
 
   // Open input to the main terms dict file (_X.tib)
   final IndexInput termsIn;
   // Open input to the terms index file (_X.tip)
   final IndexInput indexIn;
 
-  //private static final boolean DEBUG = BlockTreeTermsWriter.DEBUG;
+  // private static final boolean DEBUG = BlockTreeTermsWriter.DEBUG;
 
   // Reads the terms dict entries, to gather state to
   // produce DocsEnum on demand
   final PostingsReaderBase postingsReader;
 
-  private final Map<String,FieldReader> fieldMap;
+  private final Map<String, FieldReader> fieldMap;
   private final List<String> fieldList;
 
   final String segment;
-  
+
   final int version;
 
   /** Sole constructor. */
-  public BlockTreeTermsReader(PostingsReaderBase postingsReader, SegmentReadState state) throws IOException {
+  public BlockTreeTermsReader(PostingsReaderBase postingsReader, SegmentReadState state)
+      throws IOException {
     boolean success = false;
-    
+
     this.postingsReader = postingsReader;
     this.segment = state.segmentInfo.name;
 
     try {
-      String termsName = IndexFileNames.segmentFileName(segment, state.segmentSuffix, TERMS_EXTENSION);
+      String termsName =
+          IndexFileNames.segmentFileName(segment, state.segmentSuffix, TERMS_EXTENSION);
       termsIn = state.directory.openInput(termsName, state.context);
-      version = CodecUtil.checkIndexHeader(termsIn, TERMS_CODEC_NAME, VERSION_START, VERSION_CURRENT, state.segmentInfo.getId(), state.segmentSuffix);
-
-      String indexName = IndexFileNames.segmentFileName(segment, state.segmentSuffix, TERMS_INDEX_EXTENSION);
+      version =
+          CodecUtil.checkIndexHeader(
+              termsIn,
+              TERMS_CODEC_NAME,
+              VERSION_START,
+              VERSION_CURRENT,
+              state.segmentInfo.getId(),
+              state.segmentSuffix);
+
+      String indexName =
+          IndexFileNames.segmentFileName(segment, state.segmentSuffix, TERMS_INDEX_EXTENSION);
       indexIn = state.directory.openInput(indexName, state.context);
-      CodecUtil.checkIndexHeader(indexIn, TERMS_INDEX_CODEC_NAME, version, version, state.segmentInfo.getId(), state.segmentSuffix);
+      CodecUtil.checkIndexHeader(
+          indexIn,
+          TERMS_INDEX_CODEC_NAME,
+          version,
+          version,
+          state.segmentInfo.getId(),
+          state.segmentSuffix);
 
       if (version < VERSION_META_FILE) {
         // Have PostingsReader init itself
@@ -157,15 +167,25 @@ public final class BlockTreeTermsReader extends FieldsProducer {
       }
 
       // Read per-field details
-      String metaName = IndexFileNames.segmentFileName(segment, state.segmentSuffix, TERMS_META_EXTENSION);
+      String metaName =
+          IndexFileNames.segmentFileName(segment, state.segmentSuffix, TERMS_META_EXTENSION);
       Map<String, FieldReader> fieldMap = null;
       Throwable priorE = null;
       long indexLength = -1, termsLength = -1;
-      try (ChecksumIndexInput metaIn = version >= VERSION_META_FILE ? state.directory.openChecksumInput(metaName, state.context) : null) {
+      try (ChecksumIndexInput metaIn =
+          version >= VERSION_META_FILE
+              ? state.directory.openChecksumInput(metaName, state.context)
+              : null) {
         try {
           final IndexInput indexMetaIn, termsMetaIn;
           if (version >= VERSION_META_FILE) {
-            CodecUtil.checkIndexHeader(metaIn, TERMS_META_CODEC_NAME, version, version, state.segmentInfo.getId(), state.segmentSuffix);
+            CodecUtil.checkIndexHeader(
+                metaIn,
+                TERMS_META_CODEC_NAME,
+                version,
+                version,
+                state.segmentInfo.getId(),
+                state.segmentSuffix);
             indexMetaIn = termsMetaIn = metaIn;
             postingsReader.init(metaIn, state);
           } else {
@@ -184,7 +204,8 @@ public final class BlockTreeTermsReader extends FieldsProducer {
             final int field = termsMetaIn.readVInt();
             final long numTerms = termsMetaIn.readVLong();
             if (numTerms <= 0) {
-              throw new CorruptIndexException("Illegal numTerms for field number: " + field, termsMetaIn);
+              throw new CorruptIndexException(
+                  "Illegal numTerms for field number: " + field, termsMetaIn);
             }
             final BytesRef rootCode = readBytesRef(termsMetaIn);
             final FieldInfo fieldInfo = state.fieldInfos.fieldInfo(field);
@@ -192,30 +213,55 @@ public final class BlockTreeTermsReader extends FieldsProducer {
               throw new CorruptIndexException("invalid field number: " + field, termsMetaIn);
             }
             final long sumTotalTermFreq = termsMetaIn.readVLong();
-            // when frequencies are omitted, sumDocFreq=sumTotalTermFreq and only one value is written.
-            final long sumDocFreq = fieldInfo.getIndexOptions() == IndexOptions.DOCS ? sumTotalTermFreq : termsMetaIn.readVLong();
+            // when frequencies are omitted, sumDocFreq=sumTotalTermFreq and only one value is
+            // written.
+            final long sumDocFreq =
+                fieldInfo.getIndexOptions() == IndexOptions.DOCS
+                    ? sumTotalTermFreq
+                    : termsMetaIn.readVLong();
             final int docCount = termsMetaIn.readVInt();
             if (version < VERSION_META_LONGS_REMOVED) {
               final int longsSize = termsMetaIn.readVInt();
               if (longsSize < 0) {
-                throw new CorruptIndexException("invalid longsSize for field: " + fieldInfo.name + ", longsSize=" + longsSize, termsMetaIn);
+                throw new CorruptIndexException(
+                    "invalid longsSize for field: " + fieldInfo.name + ", longsSize=" + longsSize,
+                    termsMetaIn);
               }
             }
             BytesRef minTerm = readBytesRef(termsMetaIn);
             BytesRef maxTerm = readBytesRef(termsMetaIn);
-            if (docCount < 0 || docCount > state.segmentInfo.maxDoc()) { // #docs with field must be <= #docs
-              throw new CorruptIndexException("invalid docCount: " + docCount + " maxDoc: " + state.segmentInfo.maxDoc(), termsMetaIn);
+            if (docCount < 0
+                || docCount > state.segmentInfo.maxDoc()) { // #docs with field must be <= #docs
+              throw new CorruptIndexException(
+                  "invalid docCount: " + docCount + " maxDoc: " + state.segmentInfo.maxDoc(),
+                  termsMetaIn);
             }
-            if (sumDocFreq < docCount) {  // #postings must be >= #docs with field
-              throw new CorruptIndexException("invalid sumDocFreq: " + sumDocFreq + " docCount: " + docCount, termsMetaIn);
+            if (sumDocFreq < docCount) { // #postings must be >= #docs with field
+              throw new CorruptIndexException(
+                  "invalid sumDocFreq: " + sumDocFreq + " docCount: " + docCount, termsMetaIn);
             }
             if (sumTotalTermFreq < sumDocFreq) { // #positions must be >= #postings
-              throw new CorruptIndexException("invalid sumTotalTermFreq: " + sumTotalTermFreq + " sumDocFreq: " + sumDocFreq, termsMetaIn);
+              throw new CorruptIndexException(
+                  "invalid sumTotalTermFreq: " + sumTotalTermFreq + " sumDocFreq: " + sumDocFreq,
+                  termsMetaIn);
             }
             final long indexStartFP = indexMetaIn.readVLong();
-            FieldReader previous = fieldMap.put(fieldInfo.name,
-                new FieldReader(this, fieldInfo, numTerms, rootCode, sumTotalTermFreq, sumDocFreq, docCount,
-                    indexStartFP, indexMetaIn, indexIn, minTerm, maxTerm));
+            FieldReader previous =
+                fieldMap.put(
+                    fieldInfo.name,
+                    new FieldReader(
+                        this,
+                        fieldInfo,
+                        numTerms,
+                        rootCode,
+                        sumTotalTermFreq,
+                        sumDocFreq,
+                        docCount,
+                        indexStartFP,
+                        indexMetaIn,
+                        indexIn,
+                        minTerm,
+                        maxTerm));
             if (previous != null) {
               throw new CorruptIndexException("duplicate field: " + fieldInfo.name, termsMetaIn);
             }
@@ -235,7 +281,8 @@ public final class BlockTreeTermsReader extends FieldsProducer {
         }
       }
       if (version >= VERSION_META_FILE) {
-        // At this point the checksum of the meta file has been verified so the lengths are likely correct
+        // At this point the checksum of the meta file has been verified so the lengths are likely
+        // correct
         CodecUtil.retrieveChecksum(indexIn, indexLength);
         CodecUtil.retrieveChecksum(termsIn, termsLength);
       } else {
@@ -260,7 +307,7 @@ public final class BlockTreeTermsReader extends FieldsProducer {
     if (numBytes < 0) {
       throw new CorruptIndexException("invalid bytes length: " + numBytes, in);
     }
-    
+
     BytesRef bytes = new BytesRef();
     bytes.length = numBytes;
     bytes.bytes = new byte[numBytes];
@@ -285,7 +332,7 @@ public final class BlockTreeTermsReader extends FieldsProducer {
   public void close() throws IOException {
     try {
       IOUtils.close(indexIn, termsIn, postingsReader);
-    } finally { 
+    } finally {
       // Clear so refs to terms index is GCable even if
       // app hangs onto us:
       fieldMap.clear();
@@ -327,7 +374,7 @@ public final class BlockTreeTermsReader extends FieldsProducer {
   @Override
   public long ramBytesUsed() {
     long sizeInBytes = postingsReader.ramBytesUsed();
-    for(FieldReader reader : fieldMap.values()) {
+    for (FieldReader reader : fieldMap.values()) {
       sizeInBytes += reader.ramBytesUsed();
     }
     return sizeInBytes;
@@ -335,25 +382,31 @@ public final class BlockTreeTermsReader extends FieldsProducer {
 
   @Override
   public Collection<Accountable> getChildResources() {
-    List<Accountable> resources = new ArrayList<>(Accountables.namedAccountables("field", fieldMap));
+    List<Accountable> resources =
+        new ArrayList<>(Accountables.namedAccountables("field", fieldMap));
     resources.add(Accountables.namedAccountable("delegate", postingsReader));
     return Collections.unmodifiableList(resources);
   }
 
   @Override
-  public void checkIntegrity() throws IOException { 
+  public void checkIntegrity() throws IOException {
     // terms index
     CodecUtil.checksumEntireFile(indexIn);
 
     // term dictionary
     CodecUtil.checksumEntireFile(termsIn);
-      
+
     // postings
     postingsReader.checkIntegrity();
   }
 
   @Override
   public String toString() {
-    return getClass().getSimpleName() + "(fields=" + fieldMap.size() + ",delegate=" + postingsReader + ")";
+    return getClass().getSimpleName()
+        + "(fields="
+        + fieldMap.size()
+        + ",delegate="
+        + postingsReader
+        + ")";
   }
 }
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/blocktree/BlockTreeTermsWriter.java b/lucene/core/src/java/org/apache/lucene/codecs/blocktree/BlockTreeTermsWriter.java
index c05daeb..985125a 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/blocktree/BlockTreeTermsWriter.java
+++ b/lucene/core/src/java/org/apache/lucene/codecs/blocktree/BlockTreeTermsWriter.java
@@ -16,13 +16,11 @@
  */
 package org.apache.lucene.codecs.blocktree;
 
-
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 import java.util.Objects;
-
 import org.apache.lucene.codecs.BlockTermState;
 import org.apache.lucene.codecs.CodecUtil;
 import org.apache.lucene.codecs.FieldsConsumer;
@@ -57,7 +55,7 @@ import org.apache.lucene.util.fst.Util;
 
 /*
   TODO:
-  
+
     - Currently there is a one-to-one mapping of indexed
       term to term block, but we could decouple the two, ie,
       put more terms into the index than there are blocks.
@@ -87,108 +85,111 @@ import org.apache.lucene.util.fst.Util;
 
 /**
  * Block-based terms index and dictionary writer.
- * <p>
- * Writes terms dict and index, block-encoding (column
- * stride) each term's metadata for each set of terms
- * between two index terms.
- * <p>
  *
- * Files:
+ * <p>Writes terms dict and index, block-encoding (column stride) each term's metadata for each set
+ * of terms between two index terms.
+ *
+ * <p>Files:
+ *
  * <ul>
- *   <li><code>.tim</code>: <a href="#Termdictionary">Term Dictionary</a></li>
- *   <li><code>.tip</code>: <a href="#Termindex">Term Index</a></li>
+ *   <li><code>.tim</code>: <a href="#Termdictionary">Term Dictionary</a>
+ *   <li><code>.tip</code>: <a href="#Termindex">Term Index</a>
  * </ul>
- * <p>
- * <a id="Termdictionary"></a>
+ *
+ * <p><a id="Termdictionary"></a>
+ *
  * <h2>Term Dictionary</h2>
  *
- * <p>The .tim file contains the list of terms in each
- * field along with per-term statistics (such as docfreq)
- * and per-term metadata (typically pointers to the postings list
- * for that term in the inverted index).
- * </p>
+ * <p>The .tim file contains the list of terms in each field along with per-term statistics (such as
+ * docfreq) and per-term metadata (typically pointers to the postings list for that term in the
+ * inverted index).
  *
- * <p>The .tim is arranged in blocks: with blocks containing
- * a variable number of entries (by default 25-48), where
- * each entry is either a term or a reference to a
- * sub-block.</p>
+ * <p>The .tim is arranged in blocks: with blocks containing a variable number of entries (by
+ * default 25-48), where each entry is either a term or a reference to a sub-block.
  *
- * <p>NOTE: The term dictionary can plug into different postings implementations:
- * the postings writer/reader are actually responsible for encoding 
- * and decoding the Postings Metadata and Term Metadata sections.</p>
+ * <p>NOTE: The term dictionary can plug into different postings implementations: the postings
+ * writer/reader are actually responsible for encoding and decoding the Postings Metadata and Term
+ * Metadata sections.
  *
  * <ul>
- *    <li>TermsDict (.tim) --&gt; Header, <i>PostingsHeader</i>, NodeBlock<sup>NumBlocks</sup>,
- *                               FieldSummary, DirOffset, Footer</li>
- *    <li>NodeBlock --&gt; (OuterNode | InnerNode)</li>
- *    <li>OuterNode --&gt; EntryCount, SuffixLength, Byte<sup>SuffixLength</sup>, StatsLength, &lt; TermStats &gt;<sup>EntryCount</sup>, MetaLength, &lt;<i>TermMetadata</i>&gt;<sup>EntryCount</sup></li>
- *    <li>InnerNode --&gt; EntryCount, SuffixLength[,Sub?], Byte<sup>SuffixLength</sup>, StatsLength, &lt; TermStats ? &gt;<sup>EntryCount</sup>, MetaLength, &lt;<i>TermMetadata ? </i>&gt;<sup>EntryCount</sup></li>
- *    <li>TermStats --&gt; DocFreq, TotalTermFreq </li>
- *    <li>FieldSummary --&gt; NumFields, &lt;FieldNumber, NumTerms, RootCodeLength, Byte<sup>RootCodeLength</sup>,
- *                            SumTotalTermFreq?, SumDocFreq, DocCount, LongsSize, MinTerm, MaxTerm&gt;<sup>NumFields</sup></li>
- *    <li>Header --&gt; {@link CodecUtil#writeHeader CodecHeader}</li>
- *    <li>DirOffset --&gt; {@link DataOutput#writeLong Uint64}</li>
- *    <li>MinTerm,MaxTerm --&gt; {@link DataOutput#writeVInt VInt} length followed by the byte[]</li>
- *    <li>EntryCount,SuffixLength,StatsLength,DocFreq,MetaLength,NumFields,
- *        FieldNumber,RootCodeLength,DocCount,LongsSize --&gt; {@link DataOutput#writeVInt VInt}</li>
- *    <li>TotalTermFreq,NumTerms,SumTotalTermFreq,SumDocFreq --&gt; 
- *        {@link DataOutput#writeVLong VLong}</li>
- *    <li>Footer --&gt; {@link CodecUtil#writeFooter CodecFooter}</li>
+ *   <li>TermsDict (.tim) --&gt; Header, <i>PostingsHeader</i>, NodeBlock<sup>NumBlocks</sup>,
+ *       FieldSummary, DirOffset, Footer
+ *   <li>NodeBlock --&gt; (OuterNode | InnerNode)
+ *   <li>OuterNode --&gt; EntryCount, SuffixLength, Byte<sup>SuffixLength</sup>, StatsLength, &lt;
+ *       TermStats &gt;<sup>EntryCount</sup>, MetaLength,
+ *       &lt;<i>TermMetadata</i>&gt;<sup>EntryCount</sup>
+ *   <li>InnerNode --&gt; EntryCount, SuffixLength[,Sub?], Byte<sup>SuffixLength</sup>, StatsLength,
+ *       &lt; TermStats ? &gt;<sup>EntryCount</sup>, MetaLength, &lt;<i>TermMetadata ?
+ *       </i>&gt;<sup>EntryCount</sup>
+ *   <li>TermStats --&gt; DocFreq, TotalTermFreq
+ *   <li>FieldSummary --&gt; NumFields, &lt;FieldNumber, NumTerms, RootCodeLength,
+ *       Byte<sup>RootCodeLength</sup>, SumTotalTermFreq?, SumDocFreq, DocCount, LongsSize, MinTerm,
+ *       MaxTerm&gt;<sup>NumFields</sup>
+ *   <li>Header --&gt; {@link CodecUtil#writeHeader CodecHeader}
+ *   <li>DirOffset --&gt; {@link DataOutput#writeLong Uint64}
+ *   <li>MinTerm,MaxTerm --&gt; {@link DataOutput#writeVInt VInt} length followed by the byte[]
+ *   <li>EntryCount,SuffixLength,StatsLength,DocFreq,MetaLength,NumFields,
+ *       FieldNumber,RootCodeLength,DocCount,LongsSize --&gt; {@link DataOutput#writeVInt VInt}
+ *   <li>TotalTermFreq,NumTerms,SumTotalTermFreq,SumDocFreq --&gt; {@link DataOutput#writeVLong
+ *       VLong}
+ *   <li>Footer --&gt; {@link CodecUtil#writeFooter CodecFooter}
  * </ul>
- * <p>Notes:</p>
+ *
+ * <p>Notes:
+ *
  * <ul>
- *    <li>Header is a {@link CodecUtil#writeHeader CodecHeader} storing the version information
- *        for the BlockTree implementation.</li>
- *    <li>DirOffset is a pointer to the FieldSummary section.</li>
- *    <li>DocFreq is the count of documents which contain the term.</li>
- *    <li>TotalTermFreq is the total number of occurrences of the term. This is encoded
- *        as the difference between the total number of occurrences and the DocFreq.</li>
- *    <li>FieldNumber is the fields number from {@link FieldInfos}. (.fnm)</li>
- *    <li>NumTerms is the number of unique terms for the field.</li>
- *    <li>RootCode points to the root block for the field.</li>
- *    <li>SumDocFreq is the total number of postings, the number of term-document pairs across
- *        the entire field.</li>
- *    <li>DocCount is the number of documents that have at least one posting for this field.</li>
- *    <li>LongsSize records how many long values the postings writer/reader record per term
- *        (e.g., to hold freq/prox/doc file offsets).
- *    <li>MinTerm, MaxTerm are the lowest and highest term in this field.</li>
- *    <li>PostingsHeader and TermMetadata are plugged into by the specific postings implementation:
- *        these contain arbitrary per-file data (such as parameters or versioning information) 
- *        and per-term data (such as pointers to inverted files).</li>
- *    <li>For inner nodes of the tree, every entry will steal one bit to mark whether it points
- *        to child nodes(sub-block). If so, the corresponding TermStats and TermMetaData are omitted </li>
+ *   <li>Header is a {@link CodecUtil#writeHeader CodecHeader} storing the version information for
+ *       the BlockTree implementation.
+ *   <li>DirOffset is a pointer to the FieldSummary section.
+ *   <li>DocFreq is the count of documents which contain the term.
+ *   <li>TotalTermFreq is the total number of occurrences of the term. This is encoded as the
+ *       difference between the total number of occurrences and the DocFreq.
+ *   <li>FieldNumber is the fields number from {@link FieldInfos}. (.fnm)
+ *   <li>NumTerms is the number of unique terms for the field.
+ *   <li>RootCode points to the root block for the field.
+ *   <li>SumDocFreq is the total number of postings, the number of term-document pairs across the
+ *       entire field.
+ *   <li>DocCount is the number of documents that have at least one posting for this field.
+ *   <li>LongsSize records how many long values the postings writer/reader record per term (e.g., to
+ *       hold freq/prox/doc file offsets).
+ *   <li>MinTerm, MaxTerm are the lowest and highest term in this field.
+ *   <li>PostingsHeader and TermMetadata are plugged into by the specific postings implementation:
+ *       these contain arbitrary per-file data (such as parameters or versioning information) and
+ *       per-term data (such as pointers to inverted files).
+ *   <li>For inner nodes of the tree, every entry will steal one bit to mark whether it points to
+ *       child nodes(sub-block). If so, the corresponding TermStats and TermMetaData are omitted
  * </ul>
+ *
  * <a id="Termindex"></a>
+ *
  * <h2>Term Index</h2>
- * <p>The .tip file contains an index into the term dictionary, so that it can be 
- * accessed randomly.  The index is also used to determine
- * when a given term cannot exist on disk (in the .tim file), saving a disk seek.</p>
+ *
+ * <p>The .tip file contains an index into the term dictionary, so that it can be accessed randomly.
+ * The index is also used to determine when a given term cannot exist on disk (in the .tim file),
+ * saving a disk seek.
+ *
  * <ul>
  *   <li>TermsIndex (.tip) --&gt; Header, FSTIndex<sup>NumFields</sup>
- *                                &lt;IndexStartFP&gt;<sup>NumFields</sup>, DirOffset, Footer</li>
- *   <li>Header --&gt; {@link CodecUtil#writeHeader CodecHeader}</li>
- *   <li>DirOffset --&gt; {@link DataOutput#writeLong Uint64}</li>
- *   <li>IndexStartFP --&gt; {@link DataOutput#writeVLong VLong}</li>
- *   <!-- TODO: better describe FST output here -->
- *   <li>FSTIndex --&gt; {@link FST FST&lt;byte[]&gt;}</li>
- *   <li>Footer --&gt; {@link CodecUtil#writeFooter CodecFooter}</li>
+ *       &lt;IndexStartFP&gt;<sup>NumFields</sup>, DirOffset, Footer
+ *   <li>Header --&gt; {@link CodecUtil#writeHeader CodecHeader}
+ *   <li>DirOffset --&gt; {@link DataOutput#writeLong Uint64}
+ *   <li>IndexStartFP --&gt; {@link DataOutput#writeVLong VLong}
+ *       <!-- TODO: better describe FST output here -->
+ *   <li>FSTIndex --&gt; {@link FST FST&lt;byte[]&gt;}
+ *   <li>Footer --&gt; {@link CodecUtil#writeFooter CodecFooter}
  * </ul>
- * <p>Notes:</p>
+ *
+ * <p>Notes:
+ *
  * <ul>
- *   <li>The .tip file contains a separate FST for each
- *       field.  The FST maps a term prefix to the on-disk
- *       block that holds all terms starting with that
- *       prefix.  Each field's IndexStartFP points to its
- *       FST.</li>
- *   <li>DirOffset is a pointer to the start of the IndexStartFPs
- *       for all fields</li>
- *   <li>It's possible that an on-disk block would contain
- *       too many terms (more than the allowed maximum
- *       (default: 48)).  When this happens, the block is
- *       sub-divided into new blocks (called "floor
- *       blocks"), and then the output in the FST for the
- *       block's prefix encodes the leading byte of each
- *       sub-block, and its file pointer.
+ *   <li>The .tip file contains a separate FST for each field. The FST maps a term prefix to the
+ *       on-disk block that holds all terms starting with that prefix. Each field's IndexStartFP
+ *       points to its FST.
+ *   <li>DirOffset is a pointer to the start of the IndexStartFPs for all fields
+ *   <li>It's possible that an on-disk block would contain too many terms (more than the allowed
+ *       maximum (default: 48)). When this happens, the block is sub-divided into new blocks (called
+ *       "floor blocks"), and then the output in the FST for the block's prefix encodes the leading
+ *       byte of each sub-block, and its file pointer.
  * </ul>
  *
  * @see BlockTreeTermsReader
@@ -196,20 +197,22 @@ import org.apache.lucene.util.fst.Util;
  */
 public final class BlockTreeTermsWriter extends FieldsConsumer {
 
-  /** Suggested default value for the {@code
-   *  minItemsInBlock} parameter to {@link
-   *  #BlockTreeTermsWriter(SegmentWriteState,PostingsWriterBase,int,int)}. */
-  public final static int DEFAULT_MIN_BLOCK_SIZE = 25;
+  /**
+   * Suggested default value for the {@code minItemsInBlock} parameter to {@link
+   * #BlockTreeTermsWriter(SegmentWriteState,PostingsWriterBase,int,int)}.
+   */
+  public static final int DEFAULT_MIN_BLOCK_SIZE = 25;
 
-  /** Suggested default value for the {@code
-   *  maxItemsInBlock} parameter to {@link
-   *  #BlockTreeTermsWriter(SegmentWriteState,PostingsWriterBase,int,int)}. */
-  public final static int DEFAULT_MAX_BLOCK_SIZE = 48;
+  /**
+   * Suggested default value for the {@code maxItemsInBlock} parameter to {@link
+   * #BlockTreeTermsWriter(SegmentWriteState,PostingsWriterBase,int,int)}.
+   */
+  public static final int DEFAULT_MAX_BLOCK_SIZE = 48;
 
-  //public static boolean DEBUG = false;
-  //public static boolean DEBUG2 = false;
+  // public static boolean DEBUG = false;
+  // public static boolean DEBUG2 = false;
 
-  //private final static boolean SAVE_DOT_FILES = false;
+  // private final static boolean SAVE_DOT_FILES = false;
 
   private final IndexOutput metaOut;
   private final IndexOutput termsOut;
@@ -223,18 +226,18 @@ public final class BlockTreeTermsWriter extends FieldsConsumer {
 
   private final List<ByteBuffersDataOutput> fields = new ArrayList<>();
 
-  /** Create a new writer.  The number of items (terms or
-   *  sub-blocks) per block will aim to be between
-   *  minItemsPerBlock and maxItemsPerBlock, though in some
-   *  cases the blocks may be smaller than the min. */
-  public BlockTreeTermsWriter(SegmentWriteState state,
-                              PostingsWriterBase postingsWriter,
-                              int minItemsInBlock,
-                              int maxItemsInBlock)
-    throws IOException
-  {
-    validateSettings(minItemsInBlock,
-                     maxItemsInBlock);
+  /**
+   * Create a new writer. The number of items (terms or sub-blocks) per block will aim to be between
+   * minItemsPerBlock and maxItemsPerBlock, though in some cases the blocks may be smaller than the
+   * min.
+   */
+  public BlockTreeTermsWriter(
+      SegmentWriteState state,
+      PostingsWriterBase postingsWriter,
+      int minItemsInBlock,
+      int maxItemsInBlock)
+      throws IOException {
+    validateSettings(minItemsInBlock, maxItemsInBlock);
 
     this.minItemsInBlock = minItemsInBlock;
     this.maxItemsInBlock = maxItemsInBlock;
@@ -243,26 +246,48 @@ public final class BlockTreeTermsWriter extends FieldsConsumer {
     this.fieldInfos = state.fieldInfos;
     this.postingsWriter = postingsWriter;
 
-    final String termsName = IndexFileNames.segmentFileName(state.segmentInfo.name, state.segmentSuffix, BlockTreeTermsReader.TERMS_EXTENSION);
+    final String termsName =
+        IndexFileNames.segmentFileName(
+            state.segmentInfo.name, state.segmentSuffix, BlockTreeTermsReader.TERMS_EXTENSION);
     termsOut = state.directory.createOutput(termsName, state.context);
     boolean success = false;
     IndexOutput metaOut = null, indexOut = null;
     try {
-      CodecUtil.writeIndexHeader(termsOut, BlockTreeTermsReader.TERMS_CODEC_NAME, BlockTreeTermsReader.VERSION_CURRENT,
-                                 state.segmentInfo.getId(), state.segmentSuffix);
-
-      final String indexName = IndexFileNames.segmentFileName(state.segmentInfo.name, state.segmentSuffix, BlockTreeTermsReader.TERMS_INDEX_EXTENSION);
+      CodecUtil.writeIndexHeader(
+          termsOut,
+          BlockTreeTermsReader.TERMS_CODEC_NAME,
+          BlockTreeTermsReader.VERSION_CURRENT,
+          state.segmentInfo.getId(),
+          state.segmentSuffix);
+
+      final String indexName =
+          IndexFileNames.segmentFileName(
+              state.segmentInfo.name,
+              state.segmentSuffix,
+              BlockTreeTermsReader.TERMS_INDEX_EXTENSION);
       indexOut = state.directory.createOutput(indexName, state.context);
-      CodecUtil.writeIndexHeader(indexOut, BlockTreeTermsReader.TERMS_INDEX_CODEC_NAME, BlockTreeTermsReader.VERSION_CURRENT,
-                                 state.segmentInfo.getId(), state.segmentSuffix);
-      //segment = state.segmentInfo.name;
-
-      final String metaName = IndexFileNames.segmentFileName(state.segmentInfo.name, state.segmentSuffix, BlockTreeTermsReader.TERMS_META_EXTENSION);
+      CodecUtil.writeIndexHeader(
+          indexOut,
+          BlockTreeTermsReader.TERMS_INDEX_CODEC_NAME,
+          BlockTreeTermsReader.VERSION_CURRENT,
+          state.segmentInfo.getId(),
+          state.segmentSuffix);
+      // segment = state.segmentInfo.name;
+
+      final String metaName =
+          IndexFileNames.segmentFileName(
+              state.segmentInfo.name,
+              state.segmentSuffix,
+              BlockTreeTermsReader.TERMS_META_EXTENSION);
       metaOut = state.directory.createOutput(metaName, state.context);
-      CodecUtil.writeIndexHeader(metaOut, BlockTreeTermsReader.TERMS_META_CODEC_NAME, BlockTreeTermsReader.VERSION_CURRENT,
-          state.segmentInfo.getId(), state.segmentSuffix);
+      CodecUtil.writeIndexHeader(
+          metaOut,
+          BlockTreeTermsReader.TERMS_META_CODEC_NAME,
+          BlockTreeTermsReader.VERSION_CURRENT,
+          state.segmentInfo.getId(),
+          state.segmentSuffix);
 
-      postingsWriter.init(metaOut, state);                          // have consumer write its format/header
+      postingsWriter.init(metaOut, state); // have consumer write its format/header
 
       this.metaOut = metaOut;
       this.indexOut = indexOut;
@@ -274,30 +299,37 @@ public final class BlockTreeTermsWriter extends FieldsConsumer {
     }
   }
 
-  /** Throws {@code IllegalArgumentException} if any of these settings
-   *  is invalid. */
+  /** Throws {@code IllegalArgumentException} if any of these settings is invalid. */
   public static void validateSettings(int minItemsInBlock, int maxItemsInBlock) {
     if (minItemsInBlock <= 1) {
       throw new IllegalArgumentException("minItemsInBlock must be >= 2; got " + minItemsInBlock);
     }
     if (minItemsInBlock > maxItemsInBlock) {
-      throw new IllegalArgumentException("maxItemsInBlock must be >= minItemsInBlock; got maxItemsInBlock=" + maxItemsInBlock + " minItemsInBlock=" + minItemsInBlock);
+      throw new IllegalArgumentException(
+          "maxItemsInBlock must be >= minItemsInBlock; got maxItemsInBlock="
+              + maxItemsInBlock
+              + " minItemsInBlock="
+              + minItemsInBlock);
     }
-    if (2*(minItemsInBlock-1) > maxItemsInBlock) {
-      throw new IllegalArgumentException("maxItemsInBlock must be at least 2*(minItemsInBlock-1); got maxItemsInBlock=" + maxItemsInBlock + " minItemsInBlock=" + minItemsInBlock);
+    if (2 * (minItemsInBlock - 1) > maxItemsInBlock) {
+      throw new IllegalArgumentException(
+          "maxItemsInBlock must be at least 2*(minItemsInBlock-1); got maxItemsInBlock="
+              + maxItemsInBlock
+              + " minItemsInBlock="
+              + minItemsInBlock);
     }
   }
 
   @Override
   public void write(Fields fields, NormsProducer norms) throws IOException {
-    //if (DEBUG) System.out.println("\nBTTW.write seg=" + segment);
+    // if (DEBUG) System.out.println("\nBTTW.write seg=" + segment);
 
     String lastField = null;
-    for(String field : fields) {
+    for (String field : fields) {
       assert lastField == null || lastField.compareTo(field) < 0;
       lastField = field;
 
-      //if (DEBUG) System.out.println("\nBTTW.write seg=" + segment + " field=" + field);
+      // if (DEBUG) System.out.println("\nBTTW.write seg=" + segment + " field=" + field);
       Terms terms = fields.terms(field);
       if (terms == null) {
         continue;
@@ -307,25 +339,28 @@ public final class BlockTreeTermsWriter extends FieldsConsumer {
       TermsWriter termsWriter = new TermsWriter(fieldInfos.fieldInfo(field));
       while (true) {
         BytesRef term = termsEnum.next();
-        //if (DEBUG) System.out.println("BTTW: next term " + term);
+        // if (DEBUG) System.out.println("BTTW: next term " + term);
 
         if (term == null) {
           break;
         }
 
-        //if (DEBUG) System.out.println("write field=" + fieldInfo.name + " term=" + brToString(term));
+        // if (DEBUG) System.out.println("write field=" + fieldInfo.name + " term=" +
+        // brToString(term));
         termsWriter.write(term, termsEnum, norms);
       }
 
       termsWriter.finish();
 
-      //if (DEBUG) System.out.println("\nBTTW.write done seg=" + segment + " field=" + field);
+      // if (DEBUG) System.out.println("\nBTTW.write done seg=" + segment + " field=" + field);
     }
   }
-  
+
   static long encodeOutput(long fp, boolean hasTerms, boolean isFloor) {
     assert fp < (1L << 62);
-    return (fp << 2) | (hasTerms ? BlockTreeTermsReader.OUTPUT_FLAG_HAS_TERMS : 0) | (isFloor ? BlockTreeTermsReader.OUTPUT_FLAG_IS_FLOOR : 0);
+    return (fp << 2)
+        | (hasTerms ? BlockTreeTermsReader.OUTPUT_FLAG_HAS_TERMS : 0)
+        | (isFloor ? BlockTreeTermsReader.OUTPUT_FLAG_IS_FLOOR : 0);
   }
 
   private static class PendingEntry {
@@ -386,7 +421,13 @@ public final class BlockTreeTermsWriter extends FieldsConsumer {
     public final boolean isFloor;
     public final int floorLeadByte;
 
-    public PendingBlock(BytesRef prefix, long fp, boolean hasTerms, boolean isFloor, int floorLeadByte, List<FST<BytesRef>> subIndices) {
+    public PendingBlock(
+        BytesRef prefix,
+        long fp,
+        boolean hasTerms,
+        boolean isFloor,
+        int floorLeadByte,
+        List<FST<BytesRef>> subIndices) {
       super(false);
       this.prefix = prefix;
       this.fp = fp;
@@ -401,9 +442,14 @@ public final class BlockTreeTermsWriter extends FieldsConsumer {
       return "BLOCK: prefix=" + brToString(prefix);
     }
 
-    public void compileIndex(List<PendingBlock> blocks, ByteBuffersDataOutput scratchBytes, IntsRefBuilder scratchIntsRef) throws IOException {
+    public void compileIndex(
+        List<PendingBlock> blocks,
+        ByteBuffersDataOutput scratchBytes,
+        IntsRefBuilder scratchIntsRef)
+        throws IOException {
 
-      assert (isFloor && blocks.size() > 1) || (isFloor == false && blocks.size() == 1): "isFloor=" + isFloor + " blocks=" + blocks;
+      assert (isFloor && blocks.size() > 1) || (isFloor == false && blocks.size() == 1)
+          : "isFloor=" + isFloor + " blocks=" + blocks;
       assert this == blocks.get(0);
 
       assert scratchBytes.size() == 0;
@@ -413,13 +459,14 @@ public final class BlockTreeTermsWriter extends FieldsConsumer {
       // outputs sharing in the FST
       scratchBytes.writeVLong(encodeOutput(fp, hasTerms, isFloor));
       if (isFloor) {
-        scratchBytes.writeVInt(blocks.size()-1);
-        for (int i=1;i<blocks.size();i++) {
+        scratchBytes.writeVInt(blocks.size() - 1);
+        for (int i = 1; i < blocks.size(); i++) {
           PendingBlock sub = blocks.get(i);
           assert sub.floorLeadByte != -1;
-          //if (DEBUG) {
-          //  System.out.println("    write floorLeadByte=" + Integer.toHexString(sub.floorLeadByte&0xff));
-          //}
+          // if (DEBUG) {
+          //  System.out.println("    write floorLeadByte=" +
+          // Integer.toHexString(sub.floorLeadByte&0xff));
+          // }
           scratchBytes.writeByte((byte) sub.floorLeadByte);
           assert sub.fp > fp;
           scratchBytes.writeVLong((sub.fp - fp) << 1 | (sub.hasTerms ? 1 : 0));
@@ -427,20 +474,23 @@ public final class BlockTreeTermsWriter extends FieldsConsumer {
       }
 
       final ByteSequenceOutputs outputs = ByteSequenceOutputs.getSingleton();
-      final FSTCompiler<BytesRef> fstCompiler = new FSTCompiler.Builder<>(FST.INPUT_TYPE.BYTE1, outputs).shouldShareNonSingletonNodes(false).build();
-      //if (DEBUG) {
+      final FSTCompiler<BytesRef> fstCompiler =
+          new FSTCompiler.Builder<>(FST.INPUT_TYPE.BYTE1, outputs)
+              .shouldShareNonSingletonNodes(false)
+              .build();
+      // if (DEBUG) {
       //  System.out.println("  compile index for prefix=" + prefix);
-      //}
-      //indexBuilder.DEBUG = false;
+      // }
+      // indexBuilder.DEBUG = false;
       final byte[] bytes = scratchBytes.toArrayCopy();
       assert bytes.length > 0;
       fstCompiler.add(Util.toIntsRef(prefix, scratchIntsRef), new BytesRef(bytes, 0, bytes.length));
       scratchBytes.reset();
 
       // Copy over index for all sub-blocks
-      for(PendingBlock block : blocks) {
+      for (PendingBlock block : blocks) {
         if (block.subIndices != null) {
-          for(FST<BytesRef> subIndex : block.subIndices) {
+          for (FST<BytesRef> subIndex : block.subIndices) {
             append(fstCompiler, subIndex, scratchIntsRef);
           }
           block.subIndices = null;
@@ -462,13 +512,16 @@ public final class BlockTreeTermsWriter extends FieldsConsumer {
     // TODO: maybe we could add bulk-add method to
     // Builder?  Takes FST and unions it w/ current
     // FST.
-    private void append(FSTCompiler<BytesRef> fstCompiler, FST<BytesRef> subIndex, IntsRefBuilder scratchIntsRef) throws IOException {
+    private void append(
+        FSTCompiler<BytesRef> fstCompiler, FST<BytesRef> subIndex, IntsRefBuilder scratchIntsRef)
+        throws IOException {
       final BytesRefFSTEnum<BytesRef> subIndexEnum = new BytesRefFSTEnum<>(subIndex);
       BytesRefFSTEnum.InputOutput<BytesRef> indexEnt;
-      while((indexEnt = subIndexEnum.next()) != null) {
-        //if (DEBUG) {
-        //  System.out.println("      add sub=" + indexEnt.input + " " + indexEnt.input + " output=" + indexEnt.output);
-        //}
+      while ((indexEnt = subIndexEnum.next()) != null) {
+        // if (DEBUG) {
+        //  System.out.println("      add sub=" + indexEnt.input + " " + indexEnt.input + " output="
+        // + indexEnt.output);
+        // }
         fstCompiler.add(Util.toIntsRef(indexEnt.input, scratchIntsRef), indexEnt.output);
       }
     }
@@ -509,7 +562,6 @@ public final class BlockTreeTermsWriter extends FieldsConsumer {
         singletonCount = 0;
       }
     }
-
   }
 
   class TermsWriter {
@@ -544,11 +596,12 @@ public final class BlockTreeTermsWriter extends FieldsConsumer {
 
       assert count > 0;
 
-      //if (DEBUG2) {
+      // if (DEBUG2) {
       //  BytesRef br = new BytesRef(lastTerm.bytes());
       //  br.length = prefixLength;
-      //  System.out.println("writeBlocks: seg=" + segment + " prefix=" + brToString(br) + " count=" + count);
-      //}
+      //  System.out.println("writeBlocks: seg=" + segment + " prefix=" + brToString(br) + " count="
+      // + count);
+      // }
 
       // Root block better write all remaining pending entries:
       assert prefixLength > 0 || count == pending.size();
@@ -561,12 +614,12 @@ public final class BlockTreeTermsWriter extends FieldsConsumer {
       boolean hasTerms = false;
       boolean hasSubBlocks = false;
 
-      int start = pending.size()-count;
+      int start = pending.size() - count;
       int end = pending.size();
       int nextBlockStart = start;
       int nextFloorLeadLabel = -1;
 
-      for (int i=start; i<end; i++) {
+      for (int i = start; i < end; i++) {
 
         PendingEntry ent = pending.get(i);
 
@@ -578,7 +631,8 @@ public final class BlockTreeTermsWriter extends FieldsConsumer {
             // Suffix is 0, i.e. prefix 'foo' and term is
             // 'foo' so the term has empty string suffix
             // in this block
-            assert lastSuffixLeadLabel == -1: "i=" + i + " lastSuffixLeadLabel=" + lastSuffixLeadLabel;
+            assert lastSuffixLeadLabel == -1
+                : "i=" + i + " lastSuffixLeadLabel=" + lastSuffixLeadLabel;
             suffixLeadLabel = -1;
           } else {
             suffixLeadLabel = term.termBytes[prefixLength] & 0xff;
@@ -588,18 +642,31 @@ public final class BlockTreeTermsWriter extends FieldsConsumer {
           assert block.prefix.length > prefixLength;
           suffixLeadLabel = block.prefix.bytes[block.prefix.offset + prefixLength] & 0xff;
         }
-        // if (DEBUG) System.out.println("  i=" + i + " ent=" + ent + " suffixLeadLabel=" + suffixLeadLabel);
+        // if (DEBUG) System.out.println("  i=" + i + " ent=" + ent + " suffixLeadLabel=" +
+        // suffixLeadLabel);
 
         if (suffixLeadLabel != lastSuffixLeadLabel) {
           int itemsInBlock = i - nextBlockStart;
-          if (itemsInBlock >= minItemsInBlock && end-nextBlockStart > maxItemsInBlock) {
-            // The count is too large for one block, so we must break it into "floor" blocks, where we record
-            // the leading label of the suffix of the first term in each floor block, so at search time we can
-            // jump to the right floor block.  We just use a naive greedy segmenter here: make a new floor
-            // block as soon as we have at least minItemsInBlock.  This is not always best: it often produces
+          if (itemsInBlock >= minItemsInBlock && end - nextBlockStart > maxItemsInBlock) {
+            // The count is too large for one block, so we must break it into "floor" blocks, where
+            // we record
+            // the leading label of the suffix of the first term in each floor block, so at search
+            // time we can
+            // jump to the right floor block.  We just use a naive greedy segmenter here: make a new
+            // floor
+            // block as soon as we have at least minItemsInBlock.  This is not always best: it often
+            // produces
             // a too-small block as the final block:
             boolean isFloor = itemsInBlock < count;
-            newBlocks.add(writeBlock(prefixLength, isFloor, nextFloorLeadLabel, nextBlockStart, i, hasTerms, hasSubBlocks));
+            newBlocks.add(
+                writeBlock(
+                    prefixLength,
+                    isFloor,
+                    nextFloorLeadLabel,
+                    nextBlockStart,
+                    i,
+                    hasTerms,
+                    hasSubBlocks));
 
             hasTerms = false;
             hasSubBlocks = false;
@@ -621,7 +688,15 @@ public final class BlockTreeTermsWriter extends FieldsConsumer {
       if (nextBlockStart < end) {
         int itemsInBlock = end - nextBlockStart;
         boolean isFloor = itemsInBlock < count;
-        newBlocks.add(writeBlock(prefixLength, isFloor, nextFloorLeadLabel, nextBlockStart, end, hasTerms, hasSubBlocks));
+        newBlocks.add(
+            writeBlock(
+                prefixLength,
+                isFloor,
+                nextFloorLeadLabel,
+                nextBlockStart,
+                end,
+                hasTerms,
+                hasSubBlocks));
       }
 
       assert newBlocks.isEmpty() == false;
@@ -633,7 +708,7 @@ public final class BlockTreeTermsWriter extends FieldsConsumer {
       firstBlock.compileIndex(newBlocks, scratchBytes, scratchIntsRef);
 
       // Remove slice from the top of the pending stack, that we just wrote:
-      pending.subList(pending.size()-count, pending.size()).clear();
+      pending.subList(pending.size() - count, pending.size()).clear();
 
       // Append new block
       pending.add(firstBlock);
@@ -651,13 +726,21 @@ public final class BlockTreeTermsWriter extends FieldsConsumer {
       return true;
     }
 
-    /** Writes the specified slice (start is inclusive, end is exclusive)
-     *  from pending stack as a new block.  If isFloor is true, there
-     *  were too many (more than maxItemsInBlock) entries sharing the
-     *  same prefix, and so we broke it into multiple floor blocks where
-     *  we record the starting label of the suffix of each floor block. */
-    private PendingBlock writeBlock(int prefixLength, boolean isFloor, int floorLeadLabel, int start, int end,
-                                    boolean hasTerms, boolean hasSubBlocks) throws IOException {
+    /**
+     * Writes the specified slice (start is inclusive, end is exclusive) from pending stack as a new
+     * block. If isFloor is true, there were too many (more than maxItemsInBlock) entries sharing
+     * the same prefix, and so we broke it into multiple floor blocks where we record the starting
+     * label of the suffix of each floor block.
+     */
+    private PendingBlock writeBlock(
+        int prefixLength,
+        boolean isFloor,
+        int floorLeadLabel,
+        int start,
+        int end,
+        boolean hasTerms,
+        boolean hasSubBlocks)
+        throws IOException {
 
       assert end > start;
 
@@ -669,7 +752,10 @@ public final class BlockTreeTermsWriter extends FieldsConsumer {
       System.arraycopy(lastTerm.get().bytes, 0, prefix.bytes, 0, prefixLength);
       prefix.length = prefixLength;
 
-      //if (DEBUG2) System.out.println("    writeBlock field=" + fieldInfo.name + " prefix=" + brToString(prefix) + " fp=" + startFP + " isFloor=" + isFloor + " isLastInFloor=" + (end == pending.size()) + " floorLeadLabel=" + floorLeadLabel + " start=" + start + " end=" + end + " hasTerms=" + hasTerms + " hasSubBlocks=" + hasSubBlocks);
+      // if (DEBUG2) System.out.println("    writeBlock field=" + fieldInfo.name + " prefix=" +
+      // brToString(prefix) + " fp=" + startFP + " isFloor=" + isFloor + " isLastInFloor=" + (end ==
+      // pending.size()) + " floorLeadLabel=" + floorLeadLabel + " start=" + start + " end=" + end +
+      // " hasTerms=" + hasTerms + " hasSubBlocks=" + hasSubBlocks);
 
       // Write block header:
       int numEntries = end - start;
@@ -693,7 +779,7 @@ public final class BlockTreeTermsWriter extends FieldsConsumer {
       // compact format in this case:
       boolean isLeafBlock = hasSubBlocks == false;
 
-      //System.out.println("  isLeaf=" + isLeafBlock);
+      // System.out.println("  isLeaf=" + isLeafBlock);
 
       final List<FST<BytesRef>> subIndices;
 
@@ -702,22 +788,23 @@ public final class BlockTreeTermsWriter extends FieldsConsumer {
       if (isLeafBlock) {
         // Block contains only ordinary terms:
         subIndices = null;
-        StatsWriter statsWriter = new StatsWriter(this.statsWriter, fieldInfo.getIndexOptions() != IndexOptions.DOCS);
-        for (int i=start;i<end;i++) {
+        StatsWriter statsWriter =
+            new StatsWriter(this.statsWriter, fieldInfo.getIndexOptions() != IndexOptions.DOCS);
+        for (int i = start; i < end; i++) {
           PendingEntry ent = pending.get(i);
-          assert ent.isTerm: "i=" + i;
+          assert ent.isTerm : "i=" + i;
 
           PendingTerm term = (PendingTerm) ent;
 
-          assert StringHelper.startsWith(term.termBytes, prefix): term + " prefix=" + prefix;
+          assert StringHelper.startsWith(term.termBytes, prefix) : term + " prefix=" + prefix;
           BlockTermState state = term.state;
           final int suffix = term.termBytes.length - prefixLength;
-          //if (DEBUG2) {
+          // if (DEBUG2) {
           //  BytesRef suffixBytes = new BytesRef(suffix);
           //  System.arraycopy(term.termBytes, prefixLength, suffixBytes.bytes, 0, suffix);
           //  suffixBytes.length = suffix;
           //  System.out.println("    write term suffix=" + brToString(suffixBytes));
-          //}
+          // }
 
           // For leaf block we write suffix straight
           suffixLengthsWriter.writeVInt(suffix);
@@ -735,21 +822,22 @@ public final class BlockTreeTermsWriter extends FieldsConsumer {
       } else {
         // Block has at least one prefix term or a sub block:
         subIndices = new ArrayList<>();
-        StatsWriter statsWriter = new StatsWriter(this.statsWriter, fieldInfo.getIndexOptions() != IndexOptions.DOCS);
-        for (int i=start;i<end;i++) {
+        StatsWriter statsWriter =
+            new StatsWriter(this.statsWriter, fieldInfo.getIndexOptions() != IndexOptions.DOCS);
+        for (int i = start; i < end; i++) {
           PendingEntry ent = pending.get(i);
           if (ent.isTerm) {
             PendingTerm term = (PendingTerm) ent;
 
-            assert StringHelper.startsWith(term.termBytes, prefix): term + " prefix=" + prefix;
+            assert StringHelper.startsWith(term.termBytes, prefix) : term + " prefix=" + prefix;
             BlockTermState state = term.state;
             final int suffix = term.termBytes.length - prefixLength;
-            //if (DEBUG2) {
+            // if (DEBUG2) {
             //  BytesRef suffixBytes = new BytesRef(suffix);
             //  System.arraycopy(term.termBytes, prefixLength, suffixBytes.bytes, 0, suffix);
             //  suffixBytes.length = suffix;
             //  System.out.println("      write term suffix=" + brToString(suffixBytes));
-            //}
+            // }
 
             // For non-leaf block we borrow 1 bit to record
             // if entry is term or sub-block, and 1 bit to record if
@@ -783,17 +871,23 @@ public final class BlockTreeTermsWriter extends FieldsConsumer {
 
             // For non-leaf block we borrow 1 bit to record
             // if entry is term or sub-block:f
-            suffixLengthsWriter.writeVInt((suffix<<1)|1);
+            suffixLengthsWriter.writeVInt((suffix << 1) | 1);
             suffixWriter.append(block.prefix.bytes, prefixLength, suffix);
 
-            //if (DEBUG2) {
+            // if (DEBUG2) {
             //  BytesRef suffixBytes = new BytesRef(suffix);
             //  System.arraycopy(block.prefix.bytes, prefixLength, suffixBytes.bytes, 0, suffix);
             //  suffixBytes.length = suffix;
-            //  System.out.println("      write sub-block suffix=" + brToString(suffixBytes) + " subFP=" + block.fp + " subCode=" + (startFP-block.fp) + " floor=" + block.isFloor);
-            //}
-
-            assert floorLeadLabel == -1 || (block.prefix.bytes[prefixLength] & 0xff) >= floorLeadLabel: "floorLeadLabel=" + floorLeadLabel + " suffixLead=" + (block.prefix.bytes[prefixLength] & 0xff);
+            //  System.out.println("      write sub-block suffix=" + brToString(suffixBytes) + "
+            // subFP=" + block.fp + " subCode=" + (startFP-block.fp) + " floor=" + block.isFloor);
+            // }
+
+            assert floorLeadLabel == -1
+                    || (block.prefix.bytes[prefixLength] & 0xff) >= floorLeadLabel
+                : "floorLeadLabel="
+                    + floorLeadLabel
+                    + " suffixLead="
+                    + (block.prefix.bytes[prefixLength] & 0xff);
             assert block.fp < startFP;
 
             suffixLengthsWriter.writeVLong(startFP - block.fp);
@@ -805,18 +899,24 @@ public final class BlockTreeTermsWriter extends FieldsConsumer {
         assert subIndices.size() != 0;
       }
 
-      // Write suffixes byte[] blob to terms dict output, either uncompressed, compressed with LZ4 or with LowercaseAsciiCompression.
+      // Write suffixes byte[] blob to terms dict output, either uncompressed, compressed with LZ4
+      // or with LowercaseAsciiCompression.
       CompressionAlgorithm compressionAlg = CompressionAlgorithm.NO_COMPRESSION;
-      // If there are 2 suffix bytes or less per term, then we don't bother compressing as suffix are unlikely what
-      // makes the terms dictionary large, and it also tends to be frequently the case for dense IDs like
+      // If there are 2 suffix bytes or less per term, then we don't bother compressing as suffix
+      // are unlikely what
+      // makes the terms dictionary large, and it also tends to be frequently the case for dense IDs
+      // like
       // auto-increment IDs, so not compressing in that case helps not hurt ID lookups by too much.
-      // We also only start compressing when the prefix length is greater than 2 since blocks whose prefix length is
+      // We also only start compressing when the prefix length is greater than 2 since blocks whose
+      // prefix length is
       // 1 or 2 always all get visited when running a fuzzy query whose max number of edits is 2.
       if (suffixWriter.length() > 2L * numEntries && prefixLength > 2) {
-        // LZ4 inserts references whenever it sees duplicate strings of 4 chars or more, so only try it out if the
+        // LZ4 inserts references whenever it sees duplicate strings of 4 chars or more, so only try
+        // it out if the
         // average suffix length is greater than 6.
         if (suffixWriter.length() > 6L * numEntries) {
-          LZ4.compress(suffixWriter.bytes(), 0, suffixWriter.length(), spareWriter, compressionHashTable);
+          LZ4.compress(
+              suffixWriter.bytes(), 0, suffixWriter.length(), spareWriter, compressionHashTable);
           if (spareWriter.size() < suffixWriter.length() - (suffixWriter.length() >>> 2)) {
             // LZ4 saved more than 25%, go for it
             compressionAlg = CompressionAlgorithm.LZ4;
@@ -827,7 +927,8 @@ public final class BlockTreeTermsWriter extends FieldsConsumer {
           if (spareBytes.length < suffixWriter.length()) {
             spareBytes = new byte[ArrayUtil.oversize(suffixWriter.length(), 1)];
           }
-          if (LowercaseAsciiCompression.compress(suffixWriter.bytes(), suffixWriter.length(), spareBytes, spareWriter)) {
+          if (LowercaseAsciiCompression.compress(
+              suffixWriter.bytes(), suffixWriter.length(), spareBytes, spareWriter)) {
             compressionAlg = CompressionAlgorithm.LOWERCASE_ASCII;
           }
         }
@@ -889,7 +990,7 @@ public final class BlockTreeTermsWriter extends FieldsConsumer {
       docsSeen = new FixedBitSet(maxDoc);
       postingsWriter.setField(fieldInfo);
     }
-    
+
     /** Writes one term's worth of postings. */
     public void write(BytesRef text, TermsEnum termsEnum, NormsProducer norms) throws IOException {
       /*
@@ -904,12 +1005,15 @@ public final class BlockTreeTermsWriter extends FieldsConsumer {
       if (state != null) {
 
         assert state.docFreq != 0;
-        assert fieldInfo.getIndexOptions() == IndexOptions.DOCS || state.totalTermFreq >= state.docFreq: "postingsWriter=" + postingsWriter;
+        assert fieldInfo.getIndexOptions() == IndexOptions.DOCS
+                || state.totalTermFreq >= state.docFreq
+            : "postingsWriter=" + postingsWriter;
         pushTerm(text);
-       
+
         PendingTerm term = new PendingTerm(text, state);
         pending.add(term);
-        //if (DEBUG) System.out.println("    add pending term = " + text + " pending.size()=" + pending.size());
+        // if (DEBUG) System.out.println("    add pending term = " + text + " pending.size()=" +
+        // pending.size());
 
         sumDocFreq += state.docFreq;
         sumTotalTermFreq += state.totalTermFreq;
@@ -924,7 +1028,14 @@ public final class BlockTreeTermsWriter extends FieldsConsumer {
     /** Pushes the new term to the top of the stack, and writes new blocks. */
     private void pushTerm(BytesRef text) throws IOException {
       // Find common prefix between last term and current term:
-      int prefixLength = Arrays.mismatch(lastTerm.bytes(), 0, lastTerm.length(), text.bytes, text.offset, text.offset + text.length);
+      int prefixLength =
+          Arrays.mismatch(
+              lastTerm.bytes(),
+              0,
+              lastTerm.length(),
+              text.bytes,
+              text.offset,
+              text.offset + text.length);
       if (prefixLength == -1) { // Only happens for the first term, if it is empty
         assert lastTerm.length() == 0;
         prefixLength = 0;
@@ -933,15 +1044,16 @@ public final class BlockTreeTermsWriter extends FieldsConsumer {
       // if (DEBUG) System.out.println("  shared=" + pos + "  lastTerm.length=" + lastTerm.length);
 
       // Close the "abandoned" suffix now:
-      for(int i=lastTerm.length()-1;i>=prefixLength;i--) {
+      for (int i = lastTerm.length() - 1; i >= prefixLength; i--) {
 
         // How many items on top of the stack share the current suffix
         // we are closing:
         int prefixTopSize = pending.size() - prefixStarts[i];
         if (prefixTopSize >= minItemsInBlock) {
-          // if (DEBUG) System.out.println("pushTerm i=" + i + " prefixTopSize=" + prefixTopSize + " minItemsInBlock=" + minItemsInBlock);
-          writeBlocks(i+1, prefixTopSize);
-          prefixStarts[i] -= prefixTopSize-1;
+          // if (DEBUG) System.out.println("pushTerm i=" + i + " prefixTopSize=" + prefixTopSize + "
+          // minItemsInBlock=" + minItemsInBlock);
+          writeBlocks(i + 1, prefixTopSize);
+          prefixStarts[i] -= prefixTopSize - 1;
         }
       }
 
@@ -950,7 +1062,7 @@ public final class BlockTreeTermsWriter extends FieldsConsumer {
       }
 
       // Init new tail:
-      for(int i=prefixLength;i<text.length;i++) {
+      for (int i = prefixLength; i < text.length; i++) {
         prefixStarts[i] = pending.size();
       }
 
@@ -960,7 +1072,8 @@ public final class BlockTreeTermsWriter extends FieldsConsumer {
     // Finishes all terms in this field
     public void finish() throws IOException {
       if (numTerms > 0) {
-        // if (DEBUG) System.out.println("BTTW: finish prefixStarts=" + Arrays.toString(prefixStarts));
+        // if (DEBUG) System.out.println("BTTW: finish prefixStarts=" +
+        // Arrays.toString(prefixStarts));
 
         // Add empty term to force closing of all final blocks:
         pushTerm(new BytesRef());
@@ -972,7 +1085,8 @@ public final class BlockTreeTermsWriter extends FieldsConsumer {
         writeBlocks(0, pending.size());
 
         // We better have one final "root" block:
-        assert pending.size() == 1 && !pending.get(0).isTerm: "pending.size()=" + pending.size() + " pending=" + pending;
+        assert pending.size() == 1 && !pending.get(0).isTerm
+            : "pending.size()=" + pending.size() + " pending=" + pending;
         final PendingBlock root = (PendingBlock) pending.get(0);
         assert root.prefix.length == 0;
         final BytesRef rootCode = root.index.getEmptyOutput();
@@ -996,7 +1110,7 @@ public final class BlockTreeTermsWriter extends FieldsConsumer {
         metaOut.writeVLong(indexOut.getFilePointer());
         // Write FST to index
         root.index.save(metaOut, indexOut);
-        //System.out.println("  write FST " + indexStartFP + " field=" + fieldInfo.name);
+        // System.out.println("  write FST " + indexStartFP + " field=" + fieldInfo.name);
 
         /*
         if (DEBUG) {
@@ -1009,23 +1123,26 @@ public final class BlockTreeTermsWriter extends FieldsConsumer {
         */
 
       } else {
-        assert sumTotalTermFreq == 0 || fieldInfo.getIndexOptions() == IndexOptions.DOCS && sumTotalTermFreq == -1;
+        assert sumTotalTermFreq == 0
+            || fieldInfo.getIndexOptions() == IndexOptions.DOCS && sumTotalTermFreq == -1;
         assert sumDocFreq == 0;
         assert docsSeen.cardinality() == 0;
       }
     }
 
-    private final ByteBuffersDataOutput suffixLengthsWriter = ByteBuffersDataOutput.newResettableInstance();
+    private final ByteBuffersDataOutput suffixLengthsWriter =
+        ByteBuffersDataOutput.newResettableInstance();
     private final BytesRefBuilder suffixWriter = new BytesRefBuilder();
     private final ByteBuffersDataOutput statsWriter = ByteBuffersDataOutput.newResettableInstance();
     private final ByteBuffersDataOutput metaWriter = ByteBuffersDataOutput.newResettableInstance();
     private final ByteBuffersDataOutput spareWriter = ByteBuffersDataOutput.newResettableInstance();
     private byte[] spareBytes = BytesRef.EMPTY_BYTES;
-    private final LZ4.HighCompressionHashTable compressionHashTable = new LZ4.HighCompressionHashTable();
+    private final LZ4.HighCompressionHashTable compressionHashTable =
+        new LZ4.HighCompressionHashTable();
   }
 
   private boolean closed;
-  
+
   @Override
   public void close() throws IOException {
     if (closed) {
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/blocktree/CompressionAlgorithm.java b/lucene/core/src/java/org/apache/lucene/codecs/blocktree/CompressionAlgorithm.java
index a98a3ca..1cfcda2 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/blocktree/CompressionAlgorithm.java
+++ b/lucene/core/src/java/org/apache/lucene/codecs/blocktree/CompressionAlgorithm.java
@@ -17,22 +17,17 @@
 package org.apache.lucene.codecs.blocktree;
 
 import java.io.IOException;
-
 import org.apache.lucene.store.DataInput;
 import org.apache.lucene.util.compress.LowercaseAsciiCompression;
 
-/**
- * Compression algorithm used for suffixes of a block of terms.
- */
+/** Compression algorithm used for suffixes of a block of terms. */
 enum CompressionAlgorithm {
-
   NO_COMPRESSION(0x00) {
 
     @Override
     void read(DataInput in, byte[] out, int len) throws IOException {
       in.readBytes(out, 0, len);
     }
-
   },
 
   LOWERCASE_ASCII(0x01) {
@@ -41,7 +36,6 @@ enum CompressionAlgorithm {
     void read(DataInput in, byte[] out, int len) throws IOException {
       LowercaseAsciiCompression.decompress(in, out, len);
     }
-
   },
 
   LZ4(0x02) {
@@ -50,19 +44,17 @@ enum CompressionAlgorithm {
     void read(DataInput in, byte[] out, int len) throws IOException {
       org.apache.lucene.util.compress.LZ4.decompress(in, len, out, 0);
     }
-
   };
 
   private static final CompressionAlgorithm[] BY_CODE = new CompressionAlgorithm[3];
+
   static {
     for (CompressionAlgorithm alg : CompressionAlgorithm.values()) {
       BY_CODE[alg.code] = alg;
     }
   }
 
-  /**
-   * Look up a {@link CompressionAlgorithm} by its {@link CompressionAlgorithm#code}.
-   */
+  /** Look up a {@link CompressionAlgorithm} by its {@link CompressionAlgorithm#code}. */
   static final CompressionAlgorithm byCode(int code) {
     if (code < 0 || code >= BY_CODE.length) {
       throw new IllegalArgumentException("Illegal code for a compression algorithm: " + code);
@@ -77,5 +69,4 @@ enum CompressionAlgorithm {
   }
 
   abstract void read(DataInput in, byte[] out, int len) throws IOException;
-
 }
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/blocktree/FieldReader.java b/lucene/core/src/java/org/apache/lucene/codecs/blocktree/FieldReader.java
index 748fbbb..55d86df 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/blocktree/FieldReader.java
+++ b/lucene/core/src/java/org/apache/lucene/codecs/blocktree/FieldReader.java
@@ -19,7 +19,6 @@ package org.apache.lucene.codecs.blocktree;
 import java.io.IOException;
 import java.util.Collection;
 import java.util.Collections;
-
 import org.apache.lucene.index.FieldInfo;
 import org.apache.lucene.index.IndexOptions;
 import org.apache.lucene.index.Terms;
@@ -37,6 +36,7 @@ import org.apache.lucene.util.fst.OffHeapFSTStore;
 
 /**
  * BlockTree's implementation of {@link Terms}.
+ *
  * @lucene.internal
  */
 public final class FieldReader extends Terms implements Accountable {
@@ -45,7 +45,7 @@ public final class FieldReader extends Terms implements Accountable {
 
   private static final long BASE_RAM_BYTES_USED =
       RamUsageEstimator.shallowSizeOfInstance(FieldReader.class)
-      + 3 * RamUsageEstimator.shallowSizeOfInstance(BytesRef.class);
+          + 3 * RamUsageEstimator.shallowSizeOfInstance(BytesRef.class);
 
   final long numTerms;
   final FieldInfo fieldInfo;
@@ -59,13 +59,25 @@ public final class FieldReader extends Terms implements Accountable {
   final BlockTreeTermsReader parent;
 
   final FST<BytesRef> index;
-  //private boolean DEBUG;
-
-  FieldReader(BlockTreeTermsReader parent, FieldInfo fieldInfo, long numTerms, BytesRef rootCode, long sumTotalTermFreq, long sumDocFreq, int docCount,
-              long indexStartFP, IndexInput metaIn, IndexInput indexIn, BytesRef minTerm, BytesRef maxTerm) throws IOException {
+  // private boolean DEBUG;
+
+  FieldReader(
+      BlockTreeTermsReader parent,
+      FieldInfo fieldInfo,
+      long numTerms,
+      BytesRef rootCode,
+      long sumTotalTermFreq,
+      long sumDocFreq,
+      int docCount,
+      long indexStartFP,
+      IndexInput metaIn,
+      IndexInput indexIn,
+      BytesRef minTerm,
+      BytesRef maxTerm)
+      throws IOException {
     assert numTerms > 0;
     this.fieldInfo = fieldInfo;
-    //DEBUG = BlockTreeTermsReader.DEBUG && fieldInfo.name.equals("id");
+    // DEBUG = BlockTreeTermsReader.DEBUG && fieldInfo.name.equals("id");
     this.parent = parent;
     this.numTerms = numTerms;
     this.sumTotalTermFreq = sumTotalTermFreq;
@@ -75,9 +87,12 @@ public final class FieldReader extends Terms implements Accountable {
     this.minTerm = minTerm;
     this.maxTerm = maxTerm;
     // if (DEBUG) {
-    //   System.out.println("BTTR: seg=" + segment + " field=" + fieldInfo.name + " rootBlockCode=" + rootCode + " divisor=" + indexDivisor);
+    //   System.out.println("BTTR: seg=" + segment + " field=" + fieldInfo.name + " rootBlockCode="
+    // + rootCode + " divisor=" + indexDivisor);
     // }
-    rootBlockFP = (new ByteArrayDataInput(rootCode.bytes, rootCode.offset, rootCode.length)).readVLong() >>> BlockTreeTermsReader.OUTPUT_FLAGS_NUM_BITS;
+    rootBlockFP =
+        (new ByteArrayDataInput(rootCode.bytes, rootCode.offset, rootCode.length)).readVLong()
+            >>> BlockTreeTermsReader.OUTPUT_FLAGS_NUM_BITS;
     // Initialize FST always off-heap.
     final IndexInput clone = indexIn.clone();
     clone.seek(indexStartFP);
@@ -87,14 +102,14 @@ public final class FieldReader extends Terms implements Accountable {
       index = new FST<>(metaIn, clone, ByteSequenceOutputs.getSingleton(), new OffHeapFSTStore());
     }
     /*
-      if (false) {
-      final String dotFileName = segment + "_" + fieldInfo.name + ".dot";
-      Writer w = new OutputStreamWriter(new FileOutputStream(dotFileName));
-      Util.toDot(index, w, false, false);
-      System.out.println("FST INDEX: SAVED to " + dotFileName);
-      w.close();
-      }
-     */
+     if (false) {
+     final String dotFileName = segment + "_" + fieldInfo.name + ".dot";
+     Writer w = new OutputStreamWriter(new FileOutputStream(dotFileName));
+     Util.toDot(index, w, false, false);
+     System.out.println("FST INDEX: SAVED to " + dotFileName);
+     w.close();
+     }
+    */
   }
 
   @Override
@@ -117,7 +132,7 @@ public final class FieldReader extends Terms implements Accountable {
     }
   }
 
-  /** For debugging -- used by CheckIndex too*/
+  /** For debugging -- used by CheckIndex too */
   @Override
   public Stats getStats() throws IOException {
     return new SegmentTermsEnum(this).computeBlockStats();
@@ -130,14 +145,17 @@ public final class FieldReader extends Terms implements Accountable {
 
   @Override
   public boolean hasOffsets() {
-    return fieldInfo.getIndexOptions().compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0;
+    return fieldInfo
+            .getIndexOptions()
+            .compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS)
+        >= 0;
   }
 
   @Override
   public boolean hasPositions() {
     return fieldInfo.getIndexOptions().compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0;
   }
-    
+
   @Override
   public boolean hasPayloads() {
     return fieldInfo.hasPayloads();
@@ -170,19 +188,21 @@ public final class FieldReader extends Terms implements Accountable {
 
   @Override
   public TermsEnum intersect(CompiledAutomaton compiled, BytesRef startTerm) throws IOException {
-    // if (DEBUG) System.out.println("  FieldReader.intersect startTerm=" + BlockTreeTermsWriter.brToString(startTerm));
-    //System.out.println("intersect: " + compiled.type + " a=" + compiled.automaton);
+    // if (DEBUG) System.out.println("  FieldReader.intersect startTerm=" +
+    // BlockTreeTermsWriter.brToString(startTerm));
+    // System.out.println("intersect: " + compiled.type + " a=" + compiled.automaton);
     // TODO: we could push "it's a range" or "it's a prefix" down into IntersectTermsEnum?
     // can we optimize knowing that...?
     if (compiled.type != CompiledAutomaton.AUTOMATON_TYPE.NORMAL) {
       throw new IllegalArgumentException("please use CompiledAutomaton.getTermsEnum instead");
     }
-    return new IntersectTermsEnum(this, compiled.automaton, compiled.runAutomaton, compiled.commonSuffixRef, startTerm);
+    return new IntersectTermsEnum(
+        this, compiled.automaton, compiled.runAutomaton, compiled.commonSuffixRef, startTerm);
   }
-    
+
   @Override
   public long ramBytesUsed() {
-    return BASE_RAM_BYTES_USED + ((index!=null)? index.ramBytesUsed() : 0);
+    return BASE_RAM_BYTES_USED + ((index != null) ? index.ramBytesUsed() : 0);
   }
 
   @Override
@@ -196,6 +216,16 @@ public final class FieldReader extends Terms implements Accountable {
 
   @Override
   public String toString() {
-    return "BlockTreeTerms(seg=" + parent.segment +" terms=" + numTerms + ",postings=" + sumDocFreq + ",positions=" + sumTotalTermFreq + ",docs=" + docCount + ")";
+    return "BlockTreeTerms(seg="
+        + parent.segment
+        + " terms="
+        + numTerms
+        + ",postings="
+        + sumDocFreq
+        + ",positions="
+        + sumTotalTermFreq
+        + ",docs="
+        + docCount
+        + ")";
   }
 }
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/blocktree/IntersectTermsEnum.java b/lucene/core/src/java/org/apache/lucene/codecs/blocktree/IntersectTermsEnum.java
index 4e09548..5404a63 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/blocktree/IntersectTermsEnum.java
+++ b/lucene/core/src/java/org/apache/lucene/codecs/blocktree/IntersectTermsEnum.java
@@ -16,9 +16,7 @@
  */
 package org.apache.lucene.codecs.blocktree;
 
-
 import java.io.IOException;
-
 import org.apache.lucene.index.BaseTermsEnum;
 import org.apache.lucene.index.ImpactsEnum;
 import org.apache.lucene.index.PostingsEnum;
@@ -36,24 +34,24 @@ import org.apache.lucene.util.fst.ByteSequenceOutputs;
 import org.apache.lucene.util.fst.FST;
 import org.apache.lucene.util.fst.Outputs;
 
-/** This is used to implement efficient {@link Terms#intersect} for
- *  block-tree.  Note that it cannot seek, except for the initial term on
- *  init.  It just "nexts" through the intersection of the automaton and
- *  the terms.  It does not use the terms index at all: on init, it
- *  loads the root block, and scans its way to the initial term.
- *  Likewise, in next it scans until it finds a term that matches the
- *  current automaton transition. */
-
+/**
+ * This is used to implement efficient {@link Terms#intersect} for block-tree. Note that it cannot
+ * seek, except for the initial term on init. It just "nexts" through the intersection of the
+ * automaton and the terms. It does not use the terms index at all: on init, it loads the root
+ * block, and scans its way to the initial term. Likewise, in next it scans until it finds a term
+ * that matches the current automaton transition.
+ */
 final class IntersectTermsEnum extends BaseTermsEnum {
 
-  //static boolean DEBUG = BlockTreeTermsWriter.DEBUG;
+  // static boolean DEBUG = BlockTreeTermsWriter.DEBUG;
 
   final IndexInput in;
-  final static Outputs<BytesRef> fstOutputs = ByteSequenceOutputs.getSingleton();
+  static final Outputs<BytesRef> fstOutputs = ByteSequenceOutputs.getSingleton();
 
   IntersectTermsEnumFrame[] stack;
-      
-  @SuppressWarnings({"rawtypes","unchecked"}) private FST.Arc<BytesRef>[] arcs = new FST.Arc[5];
+
+  @SuppressWarnings({"rawtypes", "unchecked"})
+  private FST.Arc<BytesRef>[] arcs = new FST.Arc[5];
 
   final RunAutomaton runAutomaton;
   final Automaton automaton;
@@ -72,7 +70,13 @@ final class IntersectTermsEnum extends BaseTermsEnum {
 
   // TODO: in some cases we can filter by length?  eg
   // regexp foo*bar must be at least length 6 bytes
-  public IntersectTermsEnum(FieldReader fr, Automaton automaton, RunAutomaton runAutomaton, BytesRef commonSuffix, BytesRef startTerm) throws IOException {
+  public IntersectTermsEnum(
+      FieldReader fr,
+      Automaton automaton,
+      RunAutomaton runAutomaton,
+      BytesRef commonSuffix,
+      BytesRef startTerm)
+      throws IOException {
     this.fr = fr;
 
     assert automaton != null;
@@ -84,14 +88,13 @@ final class IntersectTermsEnum extends BaseTermsEnum {
 
     in = fr.parent.termsIn.clone();
     stack = new IntersectTermsEnumFrame[5];
-    for(int idx=0;idx<stack.length;idx++) {
+    for (int idx = 0; idx < stack.length; idx++) {
       stack[idx] = new IntersectTermsEnumFrame(this, idx);
     }
-    for(int arcIdx=0;arcIdx<arcs.length;arcIdx++) {
+    for (int arcIdx = 0; arcIdx < arcs.length; arcIdx++) {
       arcs[arcIdx] = new FST.Arc<>();
     }
 
-    
     fstReader = fr.index.getBytesReader();
 
     // TODO: if the automaton is "smallish" we really
@@ -138,9 +141,11 @@ final class IntersectTermsEnum extends BaseTermsEnum {
 
   private IntersectTermsEnumFrame getFrame(int ord) throws IOException {
     if (ord >= stack.length) {
-      final IntersectTermsEnumFrame[] next = new IntersectTermsEnumFrame[ArrayUtil.oversize(1+ord, RamUsageEstimator.NUM_BYTES_OBJECT_REF)];
+      final IntersectTermsEnumFrame[] next =
+          new IntersectTermsEnumFrame
+              [ArrayUtil.oversize(1 + ord, RamUsageEstimator.NUM_BYTES_OBJECT_REF)];
       System.arraycopy(stack, 0, next, 0, stack.length);
-      for(int stackOrd=stack.length;stackOrd<next.length;stackOrd++) {
+      for (int stackOrd = stack.length; stackOrd < next.length; stackOrd++) {
         next[stackOrd] = new IntersectTermsEnumFrame(this, stackOrd);
       }
       stack = next;
@@ -151,10 +156,11 @@ final class IntersectTermsEnum extends BaseTermsEnum {
 
   private FST.Arc<BytesRef> getArc(int ord) {
     if (ord >= arcs.length) {
-      @SuppressWarnings({"rawtypes","unchecked"}) final FST.Arc<BytesRef>[] next =
-      new FST.Arc[ArrayUtil.oversize(1+ord, RamUsageEstimator.NUM_BYTES_OBJECT_REF)];
+      @SuppressWarnings({"rawtypes", "unchecked"})
+      final FST.Arc<BytesRef>[] next =
+          new FST.Arc[ArrayUtil.oversize(1 + ord, RamUsageEstimator.NUM_BYTES_OBJECT_REF)];
       System.arraycopy(arcs, 0, next, 0, arcs.length);
-      for(int arcOrd=arcs.length;arcOrd<next.length;arcOrd++) {
+      for (int arcOrd = arcs.length; arcOrd < next.length; arcOrd++) {
         next[arcOrd] = new FST.Arc<>();
       }
       arcs = next;
@@ -165,8 +171,8 @@ final class IntersectTermsEnum extends BaseTermsEnum {
   private IntersectTermsEnumFrame pushFrame(int state) throws IOException {
     assert currentFrame != null;
 
-    final IntersectTermsEnumFrame f = getFrame(currentFrame == null ? 0 : 1+currentFrame.ord);
-        
+    final IntersectTermsEnumFrame f = getFrame(currentFrame == null ? 0 : 1 + currentFrame.ord);
+
     f.fp = f.fpOrig = currentFrame.lastSubFP;
     f.prefix = currentFrame.prefix + currentFrame.suffix;
     f.setState(state);
@@ -184,7 +190,7 @@ final class IntersectTermsEnum extends BaseTermsEnum {
       // TODO: we could be more efficient for the next()
       // case by using current arc as starting point,
       // passed to findTargetArc
-      arc = fr.index.findTargetArc(target, arc, getArc(1+idx), fstReader);
+      arc = fr.index.findTargetArc(target, arc, getArc(1 + idx), fstReader);
       assert arc != null;
       output = fstOutputs.add(output, arc.output());
       idx++;
@@ -228,8 +234,10 @@ final class IntersectTermsEnum extends BaseTermsEnum {
 
   private int getState() {
     int state = currentFrame.state;
-    for(int idx=0;idx<currentFrame.suffix;idx++) {
-      state = runAutomaton.step(state,  currentFrame.suffixBytes[currentFrame.startBytePos+idx] & 0xff);
+    for (int idx = 0; idx < currentFrame.suffix; idx++) {
+      state =
+          runAutomaton.step(
+              state, currentFrame.suffixBytes[currentFrame.startBytePos + idx] & 0xff);
       assert state != -1;
     }
     return state;
@@ -247,7 +255,7 @@ final class IntersectTermsEnum extends BaseTermsEnum {
     FST.Arc<BytesRef> arc = arcs[0];
     assert arc == currentFrame.arc;
 
-    for(int idx=0;idx<=target.length;idx++) {
+    for (int idx = 0; idx <= target.length; idx++) {
 
       while (true) {
         final int savNextEnt = currentFrame.nextEnt;
@@ -264,7 +272,12 @@ final class IntersectTermsEnum extends BaseTermsEnum {
         if (term.bytes.length < term.length) {
           term.bytes = ArrayUtil.grow(term.bytes, term.length);
         }
-        System.arraycopy(currentFrame.suffixBytes, currentFrame.startBytePos, term.bytes, currentFrame.prefix, currentFrame.suffix);
+        System.arraycopy(
+            currentFrame.suffixBytes,
+            currentFrame.startBytePos,
+            term.bytes,
+            currentFrame.prefix,
+            currentFrame.suffix);
 
         if (isSubBlock && StringHelper.startsWith(target, term)) {
           // Recurse
@@ -297,7 +310,12 @@ final class IntersectTermsEnum extends BaseTermsEnum {
             currentFrame.suffixesReader.setPosition(savePos);
             currentFrame.suffixLengthsReader.setPosition(saveLengthPos);
             currentFrame.termState.termBlockOrd = saveTermBlockOrd;
-            System.arraycopy(currentFrame.suffixBytes, currentFrame.startBytePos, term.bytes, currentFrame.prefix, currentFrame.suffix);
+            System.arraycopy(
+                currentFrame.suffixBytes,
+                currentFrame.startBytePos,
+                term.bytes,
+                currentFrame.prefix,
+                currentFrame.suffix);
             term.length = currentFrame.prefix + currentFrame.suffix;
             // If the last entry was a block we don't
             // need to bother recursing and pushing to
@@ -324,7 +342,7 @@ final class IntersectTermsEnum extends BaseTermsEnum {
           throw NoMoreTermsException.INSTANCE;
         }
         final long lastFP = currentFrame.fpOrig;
-        currentFrame = stack[currentFrame.ord-1];
+        currentFrame = stack[currentFrame.ord - 1];
         currentTransition = currentFrame.transition;
         assert currentFrame.lastSubFP == lastFP;
       }
@@ -339,14 +357,13 @@ final class IntersectTermsEnum extends BaseTermsEnum {
     // Only used internally when there are no more terms in next():
     public static final NoMoreTermsException INSTANCE = new NoMoreTermsException();
 
-    private NoMoreTermsException() {
-    }
+    private NoMoreTermsException() {}
 
     @Override
     public Throwable fillInStackTrace() {
       // Do nothing:
       return this;
-    }    
+    }
   }
 
   @Override
@@ -365,7 +382,6 @@ final class IntersectTermsEnum extends BaseTermsEnum {
     boolean isSubBlock = popPushNext();
 
     nextTerm:
-
     while (true) {
       assert currentFrame.transition == currentTransition;
 
@@ -402,7 +418,7 @@ final class IntersectTermsEnum extends BaseTermsEnum {
         // Advance where we are in the automaton to match this label:
 
         while (label > currentTransition.max) {
-          if (currentFrame.transitionIndex >= currentFrame.transitionCount-1) {
+          if (currentFrame.transitionIndex >= currentFrame.transitionCount - 1) {
             // Pop this frame: no further matches are possible because
             // we've moved beyond what the max transition will allow
             if (currentFrame.ord == 0) {
@@ -410,7 +426,7 @@ final class IntersectTermsEnum extends BaseTermsEnum {
               currentFrame = null;
               return null;
             }
-            currentFrame = stack[currentFrame.ord-1];
+            currentFrame = stack[currentFrame.ord - 1];
             currentTransition = currentFrame.transition;
             isSubBlock = popPushNext();
             continue nextTerm;
@@ -492,7 +508,7 @@ final class IntersectTermsEnum extends BaseTermsEnum {
         state = currentTransition.dest;
 
         int end = currentFrame.startBytePos + currentFrame.suffix;
-        for (int idx=currentFrame.startBytePos+1;idx<end;idx++) {
+        for (int idx = currentFrame.startBytePos + 1; idx < end; idx++) {
           lastState = state;
           state = runAutomaton.step(state, suffixBytes[idx] & 0xff);
           if (state == -1) {
@@ -514,7 +530,8 @@ final class IntersectTermsEnum extends BaseTermsEnum {
         currentFrame.lastState = lastState;
       } else if (runAutomaton.isAccept(state)) {
         copyTerm();
-        assert savedStartTerm == null || term.compareTo(savedStartTerm) > 0: "saveStartTerm=" + savedStartTerm.utf8ToString() + " term=" + term.utf8ToString();
+        assert savedStartTerm == null || term.compareTo(savedStartTerm) > 0
+            : "saveStartTerm=" + savedStartTerm.utf8ToString() + " term=" + term.utf8ToString();
         return term;
       } else {
         // This term is a prefix of a term accepted by the automaton, but is not itself accepted
@@ -542,7 +559,12 @@ final class IntersectTermsEnum extends BaseTermsEnum {
     if (term.bytes.length < len) {
       term.bytes = ArrayUtil.grow(term.bytes, len);
     }
-    System.arraycopy(currentFrame.suffixBytes, currentFrame.startBytePos, term.bytes, currentFrame.prefix, currentFrame.suffix);
+    System.arraycopy(
+        currentFrame.suffixBytes,
+        currentFrame.startBytePos,
+        term.bytes,
+        currentFrame.prefix,
+        currentFrame.suffix);
     term.length = len;
   }
 
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/blocktree/IntersectTermsEnumFrame.java b/lucene/core/src/java/org/apache/lucene/codecs/blocktree/IntersectTermsEnumFrame.java
index b4e5821..63265e4 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/blocktree/IntersectTermsEnumFrame.java
+++ b/lucene/core/src/java/org/apache/lucene/codecs/blocktree/IntersectTermsEnumFrame.java
@@ -16,10 +16,8 @@
  */
 package org.apache.lucene.codecs.blocktree;
 
-
 import java.io.IOException;
 import java.util.Arrays;
-
 import org.apache.lucene.codecs.BlockTermState;
 import org.apache.lucene.index.CorruptIndexException;
 import org.apache.lucene.index.IndexOptions;
@@ -78,7 +76,7 @@ final class IntersectTermsEnumFrame {
 
   int numFollowFloorBlocks;
   int nextFloorLabel;
-        
+
   final Transition transition = new Transition();
   int transitionIndex;
   int transitionCount;
@@ -117,7 +115,7 @@ final class IntersectTermsEnumFrame {
   }
 
   void loadNextFloorBlock() throws IOException {
-    assert numFollowFloorBlocks > 0: "nextFloorLabel=" + nextFloorLabel;
+    assert numFollowFloorBlocks > 0 : "nextFloorLabel=" + nextFloorLabel;
 
     do {
       fp = fpOrig + (floorDataReader.readVLong() >>> 1);
@@ -144,7 +142,8 @@ final class IntersectTermsEnumFrame {
       // Must set min to -1 so the "label < min" check never falsely triggers:
       transition.min = -1;
 
-      // Must set max to -1 so we immediately realize we need to step to the next transition and then pop this frame:
+      // Must set max to -1 so we immediately realize we need to step to the next transition and
+      // then pop this frame:
       transition.max = -1;
     }
   }
@@ -164,7 +163,7 @@ final class IntersectTermsEnumFrame {
         // first block in case it has empty suffix:
         if (ite.runAutomaton.isAccept(state) == false && transitionCount != 0) {
           // Maybe skip floor blocks:
-          assert transitionIndex == 0: "transitionIndex=" + transitionIndex;
+          assert transitionIndex == 0 : "transitionIndex=" + transitionIndex;
           while (numFollowFloorBlocks != 0 && nextFloorLabel <= transition.min) {
             fp = fpOrig + (floorDataReader.readVLong() >>> 1);
             numFollowFloorBlocks--;
@@ -265,7 +264,8 @@ final class IntersectTermsEnumFrame {
   }
 
   public void nextLeaf() {
-    assert nextEnt != -1 && nextEnt < entCount: "nextEnt=" + nextEnt + " entCount=" + entCount + " fp=" + fp;
+    assert nextEnt != -1 && nextEnt < entCount
+        : "nextEnt=" + nextEnt + " entCount=" + entCount + " fp=" + fp;
     nextEnt++;
     suffix = suffixLengthsReader.readVInt();
     startBytePos = suffixesReader.getPosition();
@@ -273,7 +273,8 @@ final class IntersectTermsEnumFrame {
   }
 
   public boolean nextNonLeaf() {
-    assert nextEnt != -1 && nextEnt < entCount: "nextEnt=" + nextEnt + " entCount=" + entCount + " fp=" + fp;
+    assert nextEnt != -1 && nextEnt < entCount
+        : "nextEnt=" + nextEnt + " entCount=" + entCount + " fp=" + fp;
     nextEnt++;
     final int code = suffixLengthsReader.readVInt();
     suffix = code >>> 1;
@@ -336,12 +337,12 @@ final class IntersectTermsEnumFrame {
         }
       } else {
         termState.docFreq = statsReader.readVInt();
-        //if (DEBUG) System.out.println("    dF=" + state.docFreq);
+        // if (DEBUG) System.out.println("    dF=" + state.docFreq);
         if (ite.fr.fieldInfo.getIndexOptions() == IndexOptions.DOCS) {
           termState.totalTermFreq = termState.docFreq; // all postings have freq=1
         } else {
           termState.totalTermFreq = termState.docFreq + statsReader.readVLong();
-          //if (DEBUG) System.out.println("    totTF=" + state.totalTermFreq);
+          // if (DEBUG) System.out.println("    totTF=" + state.totalTermFreq);
         }
       }
       // metadata
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/blocktree/SegmentTermsEnum.java b/lucene/core/src/java/org/apache/lucene/codecs/blocktree/SegmentTermsEnum.java
index 587aaeb..b583478 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/blocktree/SegmentTermsEnum.java
+++ b/lucene/core/src/java/org/apache/lucene/codecs/blocktree/SegmentTermsEnum.java
@@ -16,10 +16,8 @@
  */
 package org.apache.lucene.codecs.blocktree;
 
-
 import java.io.IOException;
 import java.io.PrintStream;
-
 import org.apache.lucene.codecs.BlockTermState;
 import org.apache.lucene.index.BaseTermsEnum;
 import org.apache.lucene.index.ImpactsEnum;
@@ -35,7 +33,6 @@ import org.apache.lucene.util.fst.FST;
 import org.apache.lucene.util.fst.Util;
 
 /** Iterates through terms in this field. */
-
 final class SegmentTermsEnum extends BaseTermsEnum {
 
   // Lazy init:
@@ -49,11 +46,12 @@ final class SegmentTermsEnum extends BaseTermsEnum {
 
   private int targetBeforeCurrentLength;
 
-  //static boolean DEBUG = BlockTreeTermsWriter.DEBUG;
+  // static boolean DEBUG = BlockTreeTermsWriter.DEBUG;
 
   private final ByteArrayDataInput scratchReader = new ByteArrayDataInput();
 
-  // What prefix of the current term was present in the index; when we only next() through the index, this stays at 0.  It's only set when
+  // What prefix of the current term was present in the index; when we only next() through the
+  // index, this stays at 0.  It's only set when
   // we seekCeil/Exact:
   private int validIndexPrefix;
 
@@ -63,7 +61,8 @@ final class SegmentTermsEnum extends BaseTermsEnum {
   final BytesRefBuilder term = new BytesRefBuilder();
   private final FST.BytesReader fstReader;
 
-  @SuppressWarnings({"rawtypes","unchecked"}) private FST.Arc<BytesRef>[] arcs = new FST.Arc[1];
+  @SuppressWarnings({"rawtypes", "unchecked"})
+  private FST.Arc<BytesRef>[] arcs = new FST.Arc[1];
 
   public SegmentTermsEnum(FieldReader fr) throws IOException {
     this.fr = fr;
@@ -72,7 +71,7 @@ final class SegmentTermsEnum extends BaseTermsEnum {
     //   System.out.println("BTTR.init seg=" + fr.parent.segment);
     // }
     stack = new SegmentTermsEnumFrame[0];
-        
+
     // Used to hold seek by TermState, or cached seek
     staticFrame = new SegmentTermsEnumFrame(this, -1);
 
@@ -84,7 +83,7 @@ final class SegmentTermsEnum extends BaseTermsEnum {
 
     // Init w/ root block; don't use index since it may
     // not (and need not) have been loaded
-    for(int arcIdx=0;arcIdx<arcs.length;arcIdx++) {
+    for (int arcIdx = 0; arcIdx < arcs.length; arcIdx++) {
       arcs[arcIdx] = new FST.Arc<>();
     }
 
@@ -97,18 +96,18 @@ final class SegmentTermsEnum extends BaseTermsEnum {
     } else {
       arc = null;
     }
-    //currentFrame = pushFrame(arc, rootCode, 0);
-    //currentFrame.loadBlock();
+    // currentFrame = pushFrame(arc, rootCode, 0);
+    // currentFrame.loadBlock();
     validIndexPrefix = 0;
     // if (DEBUG) {
     //   System.out.println("init frame state " + currentFrame.ord);
     //   printSeekState();
     // }
 
-    //System.out.println();
+    // System.out.println();
     // computeBlockStats().print(System.out);
   }
-      
+
   // Not private to avoid synthetic access$NNN methods
   void initIndexInput() {
     if (this.in == null) {
@@ -116,15 +115,14 @@ final class SegmentTermsEnum extends BaseTermsEnum {
     }
   }
 
-  /** Runs next() through the entire terms dict,
-   *  computing aggregate statistics. */
+  /** Runs next() through the entire terms dict, computing aggregate statistics. */
   public Stats computeBlockStats() throws IOException {
 
     Stats stats = new Stats(fr.parent.segment, fr.fieldInfo.name);
     if (fr.index != null) {
       stats.indexNumBytes = fr.index.ramBytesUsed();
     }
-        
+
     currentFrame = staticFrame;
     FST.Arc<BytesRef> arc;
     if (fr.index != null) {
@@ -160,7 +158,7 @@ final class SegmentTermsEnum extends BaseTermsEnum {
             break allTerms;
           }
           final long lastFP = currentFrame.fpOrig;
-          currentFrame = stack[currentFrame.ord-1];
+          currentFrame = stack[currentFrame.ord - 1];
           assert lastFP == currentFrame.lastSubFP;
           // if (DEBUG) {
           //   System.out.println("  reset validIndexPrefix=" + validIndexPrefix);
@@ -168,7 +166,7 @@ final class SegmentTermsEnum extends BaseTermsEnum {
         }
       }
 
-      while(true) {
+      while (true) {
         if (currentFrame.next()) {
           // Push to new block:
           currentFrame = pushFrame(null, currentFrame.lastSubFP, term.length());
@@ -207,9 +205,11 @@ final class SegmentTermsEnum extends BaseTermsEnum {
 
   private SegmentTermsEnumFrame getFrame(int ord) throws IOException {
     if (ord >= stack.length) {
-      final SegmentTermsEnumFrame[] next = new SegmentTermsEnumFrame[ArrayUtil.oversize(1+ord, RamUsageEstimator.NUM_BYTES_OBJECT_REF)];
+      final SegmentTermsEnumFrame[] next =
+          new SegmentTermsEnumFrame
+              [ArrayUtil.oversize(1 + ord, RamUsageEstimator.NUM_BYTES_OBJECT_REF)];
       System.arraycopy(stack, 0, next, 0, stack.length);
-      for(int stackOrd=stack.length;stackOrd<next.length;stackOrd++) {
+      for (int stackOrd = stack.length; stackOrd < next.length; stackOrd++) {
         next[stackOrd] = new SegmentTermsEnumFrame(this, stackOrd);
       }
       stack = next;
@@ -220,10 +220,11 @@ final class SegmentTermsEnum extends BaseTermsEnum {
 
   private FST.Arc<BytesRef> getArc(int ord) {
     if (ord >= arcs.length) {
-      @SuppressWarnings({"rawtypes","unchecked"}) final FST.Arc<BytesRef>[] next =
-      new FST.Arc[ArrayUtil.oversize(1+ord, RamUsageEstimator.NUM_BYTES_OBJECT_REF)];
+      @SuppressWarnings({"rawtypes", "unchecked"})
+      final FST.Arc<BytesRef>[] next =
+          new FST.Arc[ArrayUtil.oversize(1 + ord, RamUsageEstimator.NUM_BYTES_OBJECT_REF)];
       System.arraycopy(arcs, 0, next, 0, arcs.length);
-      for(int arcOrd=arcs.length;arcOrd<next.length;arcOrd++) {
+      for (int arcOrd = arcs.length; arcOrd < next.length; arcOrd++) {
         next[arcOrd] = new FST.Arc<>();
       }
       arcs = next;
@@ -232,11 +233,12 @@ final class SegmentTermsEnum extends BaseTermsEnum {
   }
 
   // Pushes a frame we seek'd to
-  SegmentTermsEnumFrame pushFrame(FST.Arc<BytesRef> arc, BytesRef frameData, int length) throws IOException {
+  SegmentTermsEnumFrame pushFrame(FST.Arc<BytesRef> arc, BytesRef frameData, int length)
+      throws IOException {
     scratchReader.reset(frameData.bytes, frameData.offset, frameData.length);
     final long code = scratchReader.readVLong();
     final long fpSeek = code >>> BlockTreeTermsReader.OUTPUT_FLAGS_NUM_BITS;
-    final SegmentTermsEnumFrame f = getFrame(1+currentFrame.ord);
+    final SegmentTermsEnumFrame f = getFrame(1 + currentFrame.ord);
     f.hasTerms = (code & BlockTreeTermsReader.OUTPUT_FLAG_HAS_TERMS) != 0;
     f.hasTermsOrig = f.hasTerms;
     f.isFloor = (code & BlockTreeTermsReader.OUTPUT_FLAG_IS_FLOOR) != 0;
@@ -251,11 +253,14 @@ final class SegmentTermsEnum extends BaseTermsEnum {
   // Pushes next'd frame or seek'd frame; we later
   // lazy-load the frame only when needed
   SegmentTermsEnumFrame pushFrame(FST.Arc<BytesRef> arc, long fp, int length) throws IOException {
-    final SegmentTermsEnumFrame f = getFrame(1+currentFrame.ord);
+    final SegmentTermsEnumFrame f = getFrame(1 + currentFrame.ord);
     f.arc = arc;
     if (f.fpOrig == fp && f.nextEnt != -1) {
-      //if (DEBUG) System.out.println("      push reused frame ord=" + f.ord + " fp=" + f.fp + " isFloor?=" + f.isFloor + " hasTerms=" + f.hasTerms + " pref=" + term + " nextEnt=" + f.nextEnt + " targetBeforeCurrentLength=" + targetBeforeCurrentLength + " term.length=" + term.length + " vs prefix=" + f.prefix);
-      //if (f.prefix > targetBeforeCurrentLength) {
+      // if (DEBUG) System.out.println("      push reused frame ord=" + f.ord + " fp=" + f.fp + "
+      // isFloor?=" + f.isFloor + " hasTerms=" + f.hasTerms + " pref=" + term + " nextEnt=" +
+      // f.nextEnt + " targetBeforeCurrentLength=" + targetBeforeCurrentLength + " term.length=" +
+      // term.length + " vs prefix=" + f.prefix);
+      // if (f.prefix > targetBeforeCurrentLength) {
       if (f.ord > targetBeforeCurrentLength) {
         f.rewind();
       } else {
@@ -273,7 +278,8 @@ final class SegmentTermsEnum extends BaseTermsEnum {
       // if (DEBUG) {
       //   final int sav = term.length;
       //   term.length = length;
-      //   System.out.println("      push new frame ord=" + f.ord + " fp=" + f.fp + " hasTerms=" + f.hasTerms + " isFloor=" + f.isFloor + " pref=" + brToString(term));
+      //   System.out.println("      push new frame ord=" + f.ord + " fp=" + f.fp + " hasTerms=" +
+      // f.hasTerms + " isFloor=" + f.isFloor + " pref=" + brToString(term));
       //   term.length = sav;
       // }
     }
@@ -322,7 +328,7 @@ final class SegmentTermsEnum extends BaseTermsEnum {
     }
 
     if (fr.size() > 0 && (target.compareTo(fr.getMin()) < 0 || target.compareTo(fr.getMax()) > 0)) {
-        return false;
+      return false;
     }
 
     term.grow(1 + target.length);
@@ -330,7 +336,9 @@ final class SegmentTermsEnum extends BaseTermsEnum {
     assert clearEOF();
 
     // if (DEBUG) {
-    //   System.out.println("\nBTTR.seekExact seg=" + fr.parent.segment + " target=" + fr.fieldInfo.name + ":" + brToString(target) + " current=" + brToString(term) + " (exists?=" + termExists + ") validIndexPrefix=" + validIndexPrefix);
+    //   System.out.println("\nBTTR.seekExact seg=" + fr.parent.segment + " target=" +
+    // fr.fieldInfo.name + ":" + brToString(target) + " current=" + brToString(term) + " (exists?="
+    // + termExists + ") validIndexPrefix=" + validIndexPrefix);
     //   printSeekState(System.out);
     // }
 
@@ -357,7 +365,7 @@ final class SegmentTermsEnum extends BaseTermsEnum {
       assert arc.isFinal();
       output = arc.output();
       targetUpto = 0;
-          
+
       SegmentTermsEnumFrame lastFrame = stack[0];
       assert validIndexPrefix <= term.length();
 
@@ -370,20 +378,27 @@ final class SegmentTermsEnum extends BaseTermsEnum {
 
       // First compare up to valid seek frames:
       while (targetUpto < targetLimit) {
-        cmp = (term.byteAt(targetUpto)&0xFF) - (target.bytes[target.offset + targetUpto]&0xFF);
+        cmp = (term.byteAt(targetUpto) & 0xFF) - (target.bytes[target.offset + targetUpto] & 0xFF);
         // if (DEBUG) {
-        //    System.out.println("    cycle targetUpto=" + targetUpto + " (vs limit=" + targetLimit + ") cmp=" + cmp + " (targetLabel=" + (char) (target.bytes[target.offset + targetUpto]) + " vs termLabel=" + (char) (term.bytes[targetUpto]) + ")"   + " arc.output=" + arc.output + " output=" + output);
+        //    System.out.println("    cycle targetUpto=" + targetUpto + " (vs limit=" + targetLimit
+        // + ") cmp=" + cmp + " (targetLabel=" + (char) (target.bytes[target.offset + targetUpto]) +
+        // " vs termLabel=" + (char) (term.bytes[targetUpto]) + ")"   + " arc.output=" + arc.output
+        // + " output=" + output);
         // }
         if (cmp != 0) {
           break;
         }
-        arc = arcs[1+targetUpto];
-        assert arc.label() == (target.bytes[target.offset + targetUpto] & 0xFF): "arc.label=" + (char) arc.label() + " targetLabel=" + (char) (target.bytes[target.offset + targetUpto] & 0xFF);
+        arc = arcs[1 + targetUpto];
+        assert arc.label() == (target.bytes[target.offset + targetUpto] & 0xFF)
+            : "arc.label="
+                + (char) arc.label()
+                + " targetLabel="
+                + (char) (target.bytes[target.offset + targetUpto] & 0xFF);
         if (arc.output() != BlockTreeTermsReader.NO_OUTPUT) {
           output = BlockTreeTermsReader.FST_OUTPUTS.add(output, arc.output());
         }
         if (arc.isFinal()) {
-          lastFrame = stack[1+lastFrame.ord];
+          lastFrame = stack[1 + lastFrame.ord];
         }
         targetUpto++;
       }
@@ -397,9 +412,12 @@ final class SegmentTermsEnum extends BaseTermsEnum {
         // equal or after the current term
         final int targetLimit2 = Math.min(target.length, term.length());
         while (targetUpto < targetLimit2) {
-          cmp = (term.byteAt(targetUpto)&0xFF) - (target.bytes[target.offset + targetUpto]&0xFF);
+          cmp =
+              (term.byteAt(targetUpto) & 0xFF) - (target.bytes[target.offset + targetUpto] & 0xFF);
           // if (DEBUG) {
-          //    System.out.println("    cycle2 targetUpto=" + targetUpto + " (vs limit=" + targetLimit + ") cmp=" + cmp + " (targetLabel=" + (char) (target.bytes[target.offset + targetUpto]) + " vs termLabel=" + (char) (term.bytes[targetUpto]) + ")");
+          //    System.out.println("    cycle2 targetUpto=" + targetUpto + " (vs limit=" +
+          // targetLimit + ") cmp=" + cmp + " (targetLabel=" + (char) (target.bytes[target.offset +
+          // targetUpto]) + " vs termLabel=" + (char) (term.bytes[targetUpto]) + ")");
           // }
           if (cmp != 0) {
             break;
@@ -418,7 +436,8 @@ final class SegmentTermsEnum extends BaseTermsEnum {
         // term, ie, app is seeking multiple terms
         // in sorted order
         // if (DEBUG) {
-        //   System.out.println("  target is after current (shares prefixLen=" + targetUpto + "); frame.ord=" + lastFrame.ord);
+        //   System.out.println("  target is after current (shares prefixLen=" + targetUpto + ");
+        // frame.ord=" + lastFrame.ord);
         // }
         currentFrame = lastFrame;
 
@@ -429,7 +448,8 @@ final class SegmentTermsEnum extends BaseTermsEnum {
         // (so we scan from the start)
         targetBeforeCurrentLength = lastFrame.ord;
         // if (DEBUG) {
-        //   System.out.println("  target is before current (shares prefixLen=" + targetUpto + "); rewind frame ord=" + lastFrame.ord);
+        //   System.out.println("  target is before current (shares prefixLen=" + targetUpto + ");
+        // rewind frame ord=" + lastFrame.ord);
         // }
         currentFrame = lastFrame;
         currentFrame.rewind();
@@ -446,9 +466,9 @@ final class SegmentTermsEnum extends BaseTermsEnum {
           //   System.out.println("  target is same as current but term doesn't exist");
           // }
         }
-        //validIndexPrefix = currentFrame.depth;
-        //term.length = target.length;
-        //return termExists;
+        // validIndexPrefix = currentFrame.depth;
+        // term.length = target.length;
+        // return termExists;
       }
 
     } else {
@@ -468,38 +488,44 @@ final class SegmentTermsEnum extends BaseTermsEnum {
 
       currentFrame = staticFrame;
 
-      //term.length = 0;
+      // term.length = 0;
       targetUpto = 0;
-      currentFrame = pushFrame(arc, BlockTreeTermsReader.FST_OUTPUTS.add(output, arc.nextFinalOutput()), 0);
+      currentFrame =
+          pushFrame(arc, BlockTreeTermsReader.FST_OUTPUTS.add(output, arc.nextFinalOutput()), 0);
     }
 
     // if (DEBUG) {
-    //   System.out.println("  start index loop targetUpto=" + targetUpto + " output=" + output + " currentFrame.ord=" + currentFrame.ord + " targetBeforeCurrentLength=" + targetBeforeCurrentLength);
+    //   System.out.println("  start index loop targetUpto=" + targetUpto + " output=" + output + "
+    // currentFrame.ord=" + currentFrame.ord + " targetBeforeCurrentLength=" +
+    // targetBeforeCurrentLength);
     // }
 
-    // We are done sharing the common prefix with the incoming target and where we are currently seek'd; now continue walking the index:
+    // We are done sharing the common prefix with the incoming target and where we are currently
+    // seek'd; now continue walking the index:
     while (targetUpto < target.length) {
 
       final int targetLabel = target.bytes[target.offset + targetUpto] & 0xFF;
 
-      final FST.Arc<BytesRef> nextArc = fr.index.findTargetArc(targetLabel, arc, getArc(1+targetUpto), fstReader);
+      final FST.Arc<BytesRef> nextArc =
+          fr.index.findTargetArc(targetLabel, arc, getArc(1 + targetUpto), fstReader);
 
       if (nextArc == null) {
 
         // Index is exhausted
         // if (DEBUG) {
-        //   System.out.println("    index: index exhausted label=" + ((char) targetLabel) + " " + toHex(targetLabel));
+        //   System.out.println("    index: index exhausted label=" + ((char) targetLabel) + " " +
+        // toHex(targetLabel));
         // }
-            
+
         validIndexPrefix = currentFrame.prefix;
-        //validIndexPrefix = targetUpto;
+        // validIndexPrefix = targetUpto;
 
         currentFrame.scanToFloorFrame(target);
 
         if (!currentFrame.hasTerms) {
           termExists = false;
           term.setByteAt(targetUpto, (byte) targetLabel);
-          term.setLength(1+targetUpto);
+          term.setLength(1 + targetUpto);
           // if (DEBUG) {
           //   System.out.println("  FAST NOT_FOUND term=" + brToString(term));
           // }
@@ -508,7 +534,7 @@ final class SegmentTermsEnum extends BaseTermsEnum {
 
         currentFrame.loadBlock();
 
-        final SeekStatus result = currentFrame.scanToTerm(target, true);            
+        final SeekStatus result = currentFrame.scanToTerm(target, true);
         if (result == SeekStatus.FOUND) {
           // if (DEBUG) {
           //   System.out.println("  return FOUND term=" + term.utf8ToString() + " " + term);
@@ -516,7 +542,8 @@ final class SegmentTermsEnum extends BaseTermsEnum {
           return true;
         } else {
           // if (DEBUG) {
-          //   System.out.println("  got " + result + "; return NOT_FOUND term=" + brToString(term));
+          //   System.out.println("  got " + result + "; return NOT_FOUND term=" +
+          // brToString(term));
           // }
           return false;
         }
@@ -531,19 +558,25 @@ final class SegmentTermsEnum extends BaseTermsEnum {
         }
 
         // if (DEBUG) {
-        //   System.out.println("    index: follow label=" + toHex(target.bytes[target.offset + targetUpto]&0xff) + " arc.output=" + arc.output + " arc.nfo=" + arc.nextFinalOutput);
+        //   System.out.println("    index: follow label=" + toHex(target.bytes[target.offset +
+        // targetUpto]&0xff) + " arc.output=" + arc.output + " arc.nfo=" + arc.nextFinalOutput);
         // }
         targetUpto++;
 
         if (arc.isFinal()) {
-          //if (DEBUG) System.out.println("    arc is final!");
-          currentFrame = pushFrame(arc, BlockTreeTermsReader.FST_OUTPUTS.add(output, arc.nextFinalOutput()), targetUpto);
-          //if (DEBUG) System.out.println("    curFrame.ord=" + currentFrame.ord + " hasTerms=" + currentFrame.hasTerms);
+          // if (DEBUG) System.out.println("    arc is final!");
+          currentFrame =
+              pushFrame(
+                  arc,
+                  BlockTreeTermsReader.FST_OUTPUTS.add(output, arc.nextFinalOutput()),
+                  targetUpto);
+          // if (DEBUG) System.out.println("    curFrame.ord=" + currentFrame.ord + " hasTerms=" +
+          // currentFrame.hasTerms);
         }
       }
     }
 
-    //validIndexPrefix = targetUpto;
+    // validIndexPrefix = targetUpto;
     validIndexPrefix = currentFrame.prefix;
 
     currentFrame.scanToFloorFrame(target);
@@ -560,7 +593,7 @@ final class SegmentTermsEnum extends BaseTermsEnum {
 
     currentFrame.loadBlock();
 
-    final SeekStatus result = currentFrame.scanToTerm(target, true);            
+    final SeekStatus result = currentFrame.scanToTerm(target, true);
     if (result == SeekStatus.FOUND) {
       // if (DEBUG) {
       //   System.out.println("  return FOUND term=" + term.utf8ToString() + " " + term);
@@ -568,7 +601,8 @@ final class SegmentTermsEnum extends BaseTermsEnum {
       return true;
     } else {
       // if (DEBUG) {
-      //   System.out.println("  got result " + result + "; return NOT_FOUND term=" + term.utf8ToString());
+      //   System.out.println("  got result " + result + "; return NOT_FOUND term=" +
+      // term.utf8ToString());
       // }
 
       return false;
@@ -587,7 +621,9 @@ final class SegmentTermsEnum extends BaseTermsEnum {
     assert clearEOF();
 
     // if (DEBUG) {
-    //   System.out.println("\nBTTR.seekCeil seg=" + fr.parent.segment + " target=" + fr.fieldInfo.name + ":" + brToString(target) + " " + target + " current=" + brToString(term) + " (exists?=" + termExists + ") validIndexPrefix=  " + validIndexPrefix);
+    //   System.out.println("\nBTTR.seekCeil seg=" + fr.parent.segment + " target=" +
+    // fr.fieldInfo.name + ":" + brToString(target) + " " + target + " current=" + brToString(term)
+    // + " (exists?=" + termExists + ") validIndexPrefix=  " + validIndexPrefix);
     //   printSeekState(System.out);
     // }
 
@@ -606,15 +642,15 @@ final class SegmentTermsEnum extends BaseTermsEnum {
       // seeks to foobaz, we can re-use the seek state
       // for the first 5 bytes.
 
-      //if (DEBUG) {
-      //System.out.println("  re-use current seek state validIndexPrefix=" + validIndexPrefix);
-      //}
+      // if (DEBUG) {
+      // System.out.println("  re-use current seek state validIndexPrefix=" + validIndexPrefix);
+      // }
 
       arc = arcs[0];
       assert arc.isFinal();
       output = arc.output();
       targetUpto = 0;
-          
+
       SegmentTermsEnumFrame lastFrame = stack[0];
       assert validIndexPrefix <= term.length();
 
@@ -627,15 +663,22 @@ final class SegmentTermsEnum extends BaseTermsEnum {
 
       // First compare up to valid seek frames:
       while (targetUpto < targetLimit) {
-        cmp = (term.byteAt(targetUpto)&0xFF) - (target.bytes[target.offset + targetUpto]&0xFF);
-        //if (DEBUG) {
-        //System.out.println("    cycle targetUpto=" + targetUpto + " (vs limit=" + targetLimit + ") cmp=" + cmp + " (targetLabel=" + (char) (target.bytes[target.offset + targetUpto]) + " vs termLabel=" + (char) (term.byteAt(targetUpto)) + ")"   + " arc.output=" + arc.output + " output=" + output);
-        //}
+        cmp = (term.byteAt(targetUpto) & 0xFF) - (target.bytes[target.offset + targetUpto] & 0xFF);
+        // if (DEBUG) {
+        // System.out.println("    cycle targetUpto=" + targetUpto + " (vs limit=" + targetLimit +
+        // ") cmp=" + cmp + " (targetLabel=" + (char) (target.bytes[target.offset + targetUpto]) + "
+        // vs termLabel=" + (char) (term.byteAt(targetUpto)) + ")"   + " arc.output=" + arc.output +
+        // " output=" + output);
+        // }
         if (cmp != 0) {
           break;
         }
-        arc = arcs[1+targetUpto];
-        assert arc.label() == (target.bytes[target.offset + targetUpto] & 0xFF): "arc.label=" + (char) arc.label() + " targetLabel=" + (char) (target.bytes[target.offset + targetUpto] & 0xFF);
+        arc = arcs[1 + targetUpto];
+        assert arc.label() == (target.bytes[target.offset + targetUpto] & 0xFF)
+            : "arc.label="
+                + (char) arc.label()
+                + " targetLabel="
+                + (char) (target.bytes[target.offset + targetUpto] & 0xFF);
         // TODO: we could save the outputs in local
         // byte[][] instead of making new objs ever
         // seek; but, often the FST doesn't have any
@@ -645,22 +688,24 @@ final class SegmentTermsEnum extends BaseTermsEnum {
           output = BlockTreeTermsReader.FST_OUTPUTS.add(output, arc.output());
         }
         if (arc.isFinal()) {
-          lastFrame = stack[1+lastFrame.ord];
+          lastFrame = stack[1 + lastFrame.ord];
         }
         targetUpto++;
       }
 
-
       if (cmp == 0) {
         final int targetUptoMid = targetUpto;
         // Second compare the rest of the term, but
         // don't save arc/output/frame:
         final int targetLimit2 = Math.min(target.length, term.length());
         while (targetUpto < targetLimit2) {
-          cmp = (term.byteAt(targetUpto)&0xFF) - (target.bytes[target.offset + targetUpto]&0xFF);
-          //if (DEBUG) {
-          //System.out.println("    cycle2 targetUpto=" + targetUpto + " (vs limit=" + targetLimit + ") cmp=" + cmp + " (targetLabel=" + (char) (target.bytes[target.offset + targetUpto]) + " vs termLabel=" + (char) (term.byteAt(targetUpto)) + ")");
-          //}
+          cmp =
+              (term.byteAt(targetUpto) & 0xFF) - (target.bytes[target.offset + targetUpto] & 0xFF);
+          // if (DEBUG) {
+          // System.out.println("    cycle2 targetUpto=" + targetUpto + " (vs limit=" + targetLimit
+          // + ") cmp=" + cmp + " (targetLabel=" + (char) (target.bytes[target.offset + targetUpto])
+          // + " vs termLabel=" + (char) (term.byteAt(targetUpto)) + ")");
+          // }
           if (cmp != 0) {
             break;
           }
@@ -677,9 +722,10 @@ final class SegmentTermsEnum extends BaseTermsEnum {
         // Common case: target term is after current
         // term, ie, app is seeking multiple terms
         // in sorted order
-        //if (DEBUG) {
-        //System.out.println("  target is after current (shares prefixLen=" + targetUpto + "); clear frame.scanned ord=" + lastFrame.ord);
-        //}
+        // if (DEBUG) {
+        // System.out.println("  target is after current (shares prefixLen=" + targetUpto + ");
+        // clear frame.scanned ord=" + lastFrame.ord);
+        // }
         currentFrame = lastFrame;
 
       } else if (cmp > 0) {
@@ -688,23 +734,24 @@ final class SegmentTermsEnum extends BaseTermsEnum {
         // keep the currentFrame but we must rewind it
         // (so we scan from the start)
         targetBeforeCurrentLength = 0;
-        //if (DEBUG) {
-        //System.out.println("  target is before current (shares prefixLen=" + targetUpto + "); rewind frame ord=" + lastFrame.ord);
-        //}
+        // if (DEBUG) {
+        // System.out.println("  target is before current (shares prefixLen=" + targetUpto + ");
+        // rewind frame ord=" + lastFrame.ord);
+        // }
         currentFrame = lastFrame;
         currentFrame.rewind();
       } else {
         // Target is exactly the same as current term
         assert term.length() == target.length;
         if (termExists) {
-          //if (DEBUG) {
-          //System.out.println("  target is same as current; return FOUND");
-          //}
+          // if (DEBUG) {
+          // System.out.println("  target is same as current; return FOUND");
+          // }
           return SeekStatus.FOUND;
         } else {
-          //if (DEBUG) {
-          //System.out.println("  target is same as current but term doesn't exist");
-          //}
+          // if (DEBUG) {
+          // System.out.println("  target is same as current but term doesn't exist");
+          // }
         }
       }
 
@@ -717,65 +764,71 @@ final class SegmentTermsEnum extends BaseTermsEnum {
       assert arc.isFinal();
       assert arc.output() != null;
 
-      //if (DEBUG) {
-      //System.out.println("    no seek state; push root frame");
-      //}
+      // if (DEBUG) {
+      // System.out.println("    no seek state; push root frame");
+      // }
 
       output = arc.output();
 
       currentFrame = staticFrame;
 
-      //term.length = 0;
+      // term.length = 0;
       targetUpto = 0;
-      currentFrame = pushFrame(arc, BlockTreeTermsReader.FST_OUTPUTS.add(output, arc.nextFinalOutput()), 0);
+      currentFrame =
+          pushFrame(arc, BlockTreeTermsReader.FST_OUTPUTS.add(output, arc.nextFinalOutput()), 0);
     }
 
-    //if (DEBUG) {
-    //System.out.println("  start index loop targetUpto=" + targetUpto + " output=" + output + " currentFrame.ord+1=" + currentFrame.ord + " targetBeforeCurrentLength=" + targetBeforeCurrentLength);
-    //}
+    // if (DEBUG) {
+    // System.out.println("  start index loop targetUpto=" + targetUpto + " output=" + output + "
+    // currentFrame.ord+1=" + currentFrame.ord + " targetBeforeCurrentLength=" +
+    // targetBeforeCurrentLength);
+    // }
 
-    // We are done sharing the common prefix with the incoming target and where we are currently seek'd; now continue walking the index:
+    // We are done sharing the common prefix with the incoming target and where we are currently
+    // seek'd; now continue walking the index:
     while (targetUpto < target.length) {
 
       final int targetLabel = target.bytes[target.offset + targetUpto] & 0xFF;
 
-      final FST.Arc<BytesRef> nextArc = fr.index.findTargetArc(targetLabel, arc, getArc(1+targetUpto), fstReader);
+      final FST.Arc<BytesRef> nextArc =
+          fr.index.findTargetArc(targetLabel, arc, getArc(1 + targetUpto), fstReader);
 
       if (nextArc == null) {
 
         // Index is exhausted
         // if (DEBUG) {
-        //   System.out.println("    index: index exhausted label=" + ((char) targetLabel) + " " + targetLabel);
+        //   System.out.println("    index: index exhausted label=" + ((char) targetLabel) + " " +
+        // targetLabel);
         // }
-            
+
         validIndexPrefix = currentFrame.prefix;
-        //validIndexPrefix = targetUpto;
+        // validIndexPrefix = targetUpto;
 
         currentFrame.scanToFloorFrame(target);
 
         currentFrame.loadBlock();
 
-        //if (DEBUG) System.out.println("  now scanToTerm");
+        // if (DEBUG) System.out.println("  now scanToTerm");
         final SeekStatus result = currentFrame.scanToTerm(target, false);
         if (result == SeekStatus.END) {
           term.copyBytes(target);
           termExists = false;
 
           if (next() != null) {
-            //if (DEBUG) {
-            //System.out.println("  return NOT_FOUND term=" + brToString(term));
-            //}
+            // if (DEBUG) {
+            // System.out.println("  return NOT_FOUND term=" + brToString(term));
+            // }
             return SeekStatus.NOT_FOUND;
           } else {
-            //if (DEBUG) {
-            //System.out.println("  return END");
-            //}
+            // if (DEBUG) {
+            // System.out.println("  return END");
+            // }
             return SeekStatus.END;
           }
         } else {
-          //if (DEBUG) {
-          //System.out.println("  return " + result + " term=" + brToString(term));
-          //}
+          // if (DEBUG) {
+          // System.out.println("  return " + result + " term=" + brToString(term));
+          // }
           return result;
         }
       } else {
@@ -788,20 +841,26 @@ final class SegmentTermsEnum extends BaseTermsEnum {
           output = BlockTreeTermsReader.FST_OUTPUTS.add(output, arc.output());
         }
 
-        //if (DEBUG) {
-        //System.out.println("    index: follow label=" + (target.bytes[target.offset + targetUpto]&0xff) + " arc.output=" + arc.output + " arc.nfo=" + arc.nextFinalOutput);
-        //}
+        // if (DEBUG) {
+        // System.out.println("    index: follow label=" + (target.bytes[target.offset +
+        // targetUpto]&0xff) + " arc.output=" + arc.output + " arc.nfo=" + arc.nextFinalOutput);
+        // }
         targetUpto++;
 
         if (arc.isFinal()) {
-          //if (DEBUG) System.out.println("    arc is final!");
-          currentFrame = pushFrame(arc, BlockTreeTermsReader.FST_OUTPUTS.add(output, arc.nextFinalOutput()), targetUpto);
-          //if (DEBUG) System.out.println("    curFrame.ord=" + currentFrame.ord + " hasTerms=" + currentFrame.hasTerms);
+          // if (DEBUG) System.out.println("    arc is final!");
+          currentFrame =
+              pushFrame(
+                  arc,
+                  BlockTreeTermsReader.FST_OUTPUTS.add(output, arc.nextFinalOutput()),
+                  targetUpto);
+          // if (DEBUG) System.out.println("    curFrame.ord=" + currentFrame.ord + " hasTerms=" +
+          // currentFrame.hasTerms);
         }
       }
     }
 
-    //validIndexPrefix = targetUpto;
+    // validIndexPrefix = targetUpto;
     validIndexPrefix = currentFrame.prefix;
 
     currentFrame.scanToFloorFrame(target);
@@ -814,14 +873,14 @@ final class SegmentTermsEnum extends BaseTermsEnum {
       term.copyBytes(target);
       termExists = false;
       if (next() != null) {
-        //if (DEBUG) {
-        //System.out.println("  return NOT_FOUND term=" + term.get().utf8ToString() + " " + term);
-        //}
+        // if (DEBUG) {
+        // System.out.println("  return NOT_FOUND term=" + term.get().utf8ToString() + " " + term);
+        // }
         return SeekStatus.NOT_FOUND;
       } else {
-        //if (DEBUG) {
-        //System.out.println("  return END");
-        //}
+        // if (DEBUG) {
+        // System.out.println("  return END");
+        // }
         return SeekStatus.END;
       }
     } else {
@@ -837,19 +896,79 @@ final class SegmentTermsEnum extends BaseTermsEnum {
       out.println("  prior seek state:");
       int ord = 0;
       boolean isSeekFrame = true;
-      while(true) {
+      while (true) {
         SegmentTermsEnumFrame f = getFrame(ord);
         assert f != null;
         final BytesRef prefix = new BytesRef(term.get().bytes, 0, f.prefix);
         if (f.nextEnt == -1) {
-          out.println("    frame " + (isSeekFrame ? "(seek)" : "(next)") + " ord=" + ord + " fp=" + f.fp + (f.isFloor ? (" (fpOrig=" + f.fpOrig + ")") : "") + " prefixLen=" + f.prefix + " prefix=" + prefix + (f.nextEnt == -1 ? "" : (" (of " + f.entCount + ")")) + " hasTerms=" + f.hasTerms + " isFloor=" + f.isFloor + " code=" + ((f.fp<< BlockTreeTermsReader.OUTPUT_FLAGS_NUM_BITS) + (f.hasTerms ? BlockTreeTermsReader.OUTPUT_FLAG_HAS_TERMS:0) + (f.isFloor ? BlockTreeTermsReader.OUTPUT_FLAG_ [...]
+          out.println(
+              "    frame "
+                  + (isSeekFrame ? "(seek)" : "(next)")
+                  + " ord="
+                  + ord
+                  + " fp="
+                  + f.fp
+                  + (f.isFloor ? (" (fpOrig=" + f.fpOrig + ")") : "")
+                  + " prefixLen="
+                  + f.prefix
+                  + " prefix="
+                  + prefix
+                  + (f.nextEnt == -1 ? "" : (" (of " + f.entCount + ")"))
+                  + " hasTerms="
+                  + f.hasTerms
+                  + " isFloor="
+                  + f.isFloor
+                  + " code="
+                  + ((f.fp << BlockTreeTermsReader.OUTPUT_FLAGS_NUM_BITS)
+                      + (f.hasTerms ? BlockTreeTermsReader.OUTPUT_FLAG_HAS_TERMS : 0)
+                      + (f.isFloor ? BlockTreeTermsReader.OUTPUT_FLAG_IS_FLOOR : 0))
+                  + " isLastInFloor="
+                  + f.isLastInFloor
+                  + " mdUpto="
+                  + f.metaDataUpto
+                  + " tbOrd="
+                  + f.getTermBlockOrd());
         } else {
-          out.println("    frame " + (isSeekFrame ? "(seek, loaded)" : "(next, loaded)") + " ord=" + ord + " fp=" + f.fp + (f.isFloor ? (" (fpOrig=" + f.fpOrig + ")") : "") + " prefixLen=" + f.prefix + " prefix=" + prefix + " nextEnt=" + f.nextEnt + (f.nextEnt == -1 ? "" : (" (of " + f.entCount + ")")) + " hasTerms=" + f.hasTerms + " isFloor=" + f.isFloor + " code=" + ((f.fp<< BlockTreeTermsReader.OUTPUT_FLAGS_NUM_BITS) + (f.hasTerms ? BlockTreeTermsReader.OUTPUT_FLAG_HAS_TERMS:0) + (f.i [...]
+          out.println(
+              "    frame "
+                  + (isSeekFrame ? "(seek, loaded)" : "(next, loaded)")
+                  + " ord="
+                  + ord
+                  + " fp="
+                  + f.fp
+                  + (f.isFloor ? (" (fpOrig=" + f.fpOrig + ")") : "")
+                  + " prefixLen="
+                  + f.prefix
+                  + " prefix="
+                  + prefix
+                  + " nextEnt="
+                  + f.nextEnt
+                  + (f.nextEnt == -1 ? "" : (" (of " + f.entCount + ")"))
+                  + " hasTerms="
+                  + f.hasTerms
+                  + " isFloor="
+                  + f.isFloor
+                  + " code="
+                  + ((f.fp << BlockTreeTermsReader.OUTPUT_FLAGS_NUM_BITS)
+                      + (f.hasTerms ? BlockTreeTermsReader.OUTPUT_FLAG_HAS_TERMS : 0)
+                      + (f.isFloor ? BlockTreeTermsReader.OUTPUT_FLAG_IS_FLOOR : 0))
+                  + " lastSubFP="
+                  + f.lastSubFP
+                  + " isLastInFloor="
+                  + f.isLastInFloor
+                  + " mdUpto="
+                  + f.metaDataUpto
+                  + " tbOrd="
+                  + f.getTermBlockOrd());
         }
         if (fr.index != null) {
-          assert !isSeekFrame || f.arc != null: "isSeekFrame=" + isSeekFrame + " f.arc=" + f.arc;
-          if (f.prefix > 0 && isSeekFrame && f.arc.label() != (term.byteAt(f.prefix-1)&0xFF)) {
-            out.println("      broken seek state: arc.label=" + (char) f.arc.label() + " vs term byte=" + (char) (term.byteAt(f.prefix-1)&0xFF));
+          assert !isSeekFrame || f.arc != null : "isSeekFrame=" + isSeekFrame + " f.arc=" + f.arc;
+          if (f.prefix > 0 && isSeekFrame && f.arc.label() != (term.byteAt(f.prefix - 1) & 0xFF)) {
+            out.println(
+                "      broken seek state: arc.label="
+                    + (char) f.arc.label()
+                    + " vs term byte="
+                    + (char) (term.byteAt(f.prefix - 1) & 0xFF));
             throw new RuntimeException("seek state is broken");
           }
           BytesRef output = Util.get(fr.index, prefix);
@@ -857,11 +976,19 @@ final class SegmentTermsEnum extends BaseTermsEnum {
             out.println("      broken seek state: prefix is not final in index");
             throw new RuntimeException("seek state is broken");
           } else if (isSeekFrame && !f.isFloor) {
-            final ByteArrayDataInput reader = new ByteArrayDataInput(output.bytes, output.offset, output.length);
+            final ByteArrayDataInput reader =
+                new ByteArrayDataInput(output.bytes, output.offset, output.length);
             final long codeOrig = reader.readVLong();
-            final long code = (f.fp << BlockTreeTermsReader.OUTPUT_FLAGS_NUM_BITS) | (f.hasTerms ? BlockTreeTermsReader.OUTPUT_FLAG_HAS_TERMS:0) | (f.isFloor ? BlockTreeTermsReader.OUTPUT_FLAG_IS_FLOOR:0);
+            final long code =
+                (f.fp << BlockTreeTermsReader.OUTPUT_FLAGS_NUM_BITS)
+                    | (f.hasTerms ? BlockTreeTermsReader.OUTPUT_FLAG_HAS_TERMS : 0)
+                    | (f.isFloor ? BlockTreeTermsReader.OUTPUT_FLAG_IS_FLOOR : 0);
             if (codeOrig != code) {
-              out.println("      broken seek state: output code=" + codeOrig + " doesn't match frame code=" + code);
+              out.println(
+                  "      broken seek state: output code="
+                      + codeOrig
+                      + " doesn't match frame code="
+                      + code);
               throw new RuntimeException("seek state is broken");
             }
           }
@@ -878,8 +1005,8 @@ final class SegmentTermsEnum extends BaseTermsEnum {
   }
 
   /* Decodes only the term bytes of the next term.  If caller then asks for
-     metadata, ie docFreq, totalTermFreq or pulls a D/&PEnum, we then (lazily)
-     decode all metadata up to the current term. */
+  metadata, ie docFreq, totalTermFreq or pulls a D/&PEnum, we then (lazily)
+  decode all metadata up to the current term. */
   @Override
   public BytesRef next() throws IOException {
     if (in == null) {
@@ -900,7 +1027,9 @@ final class SegmentTermsEnum extends BaseTermsEnum {
 
     assert !eof;
     // if (DEBUG) {
-    //   System.out.println("\nBTTR.next seg=" + fr.parent.segment + " term=" + brToString(term) + " termExists?=" + termExists + " field=" + fr.fieldInfo.name + " termBlockOrd=" + currentFrame.state.termBlockOrd + " validIndexPrefix=" + validIndexPrefix);
+    //   System.out.println("\nBTTR.next seg=" + fr.parent.segment + " term=" + brToString(term) + "
+    // termExists?=" + termExists + " field=" + fr.fieldInfo.name + " termBlockOrd=" +
+    // currentFrame.state.termBlockOrd + " validIndexPrefix=" + validIndexPrefix);
     //   printSeekState(System.out);
     // }
 
@@ -911,7 +1040,8 @@ final class SegmentTermsEnum extends BaseTermsEnum {
       // docFreq, etc.  But, if they then call next(),
       // this method catches up all internal state so next()
       // works properly:
-      //if (DEBUG) System.out.println("  re-seek to pending term=" + term.utf8ToString() + " " + term);
+      // if (DEBUG) System.out.println("  re-seek to pending term=" + term.utf8ToString() + " " +
+      // term);
       final boolean result = seekExact(term.get());
       assert result;
     }
@@ -923,9 +1053,9 @@ final class SegmentTermsEnum extends BaseTermsEnum {
         currentFrame.loadNextFloorBlock();
         break;
       } else {
-        //if (DEBUG) System.out.println("  pop frame");
+        // if (DEBUG) System.out.println("  pop frame");
         if (currentFrame.ord == 0) {
-          //if (DEBUG) System.out.println("  return null");
+          // if (DEBUG) System.out.println("  return null");
           assert setEOF();
           term.clear();
           validIndexPrefix = 0;
@@ -934,7 +1064,7 @@ final class SegmentTermsEnum extends BaseTermsEnum {
           return null;
         }
         final long lastFP = currentFrame.fpOrig;
-        currentFrame = stack[currentFrame.ord-1];
+        currentFrame = stack[currentFrame.ord - 1];
 
         if (currentFrame.nextEnt == -1 || currentFrame.lastSubFP != lastFP) {
           // We popped into a frame that's not loaded
@@ -947,23 +1077,24 @@ final class SegmentTermsEnum extends BaseTermsEnum {
         // Note that the seek state (last seek) has been
         // invalidated beyond this depth
         validIndexPrefix = Math.min(validIndexPrefix, currentFrame.prefix);
-        //if (DEBUG) {
-        //System.out.println("  reset validIndexPrefix=" + validIndexPrefix);
-        //}
+        // if (DEBUG) {
+        // System.out.println("  reset validIndexPrefix=" + validIndexPrefix);
+        // }
       }
     }
 
-    while(true) {
+    while (true) {
       if (currentFrame.next()) {
         // Push to new block:
-        //if (DEBUG) System.out.println("  push frame");
+        // if (DEBUG) System.out.println("  push frame");
         currentFrame = pushFrame(null, currentFrame.lastSubFP, term.length());
         // This is a "next" frame -- even if it's
         // floor'd we must pretend it isn't so we don't
         // try to scan to the right floor frame:
         currentFrame.loadBlock();
       } else {
-        //if (DEBUG) System.out.println("  return term=" + brToString(term) + " currentFrame.ord=" + currentFrame.ord);
+        // if (DEBUG) System.out.println("  return term=" + brToString(term) + " currentFrame.ord="
+        // + currentFrame.ord);
         return term.get();
       }
     }
@@ -978,9 +1109,9 @@ final class SegmentTermsEnum extends BaseTermsEnum {
   @Override
   public int docFreq() throws IOException {
     assert !eof;
-    //if (DEBUG) System.out.println("BTR.docFreq");
+    // if (DEBUG) System.out.println("BTR.docFreq");
     currentFrame.decodeMetaData();
-    //if (DEBUG) System.out.println("  return " + currentFrame.state.docFreq);
+    // if (DEBUG) System.out.println("  return " + currentFrame.state.docFreq);
     return currentFrame.state.docFreq;
   }
 
@@ -994,33 +1125,34 @@ final class SegmentTermsEnum extends BaseTermsEnum {
   @Override
   public PostingsEnum postings(PostingsEnum reuse, int flags) throws IOException {
     assert !eof;
-    //if (DEBUG) {
-    //System.out.println("BTTR.docs seg=" + segment);
-    //}
+    // if (DEBUG) {
+    // System.out.println("BTTR.docs seg=" + segment);
+    // }
     currentFrame.decodeMetaData();
-    //if (DEBUG) {
-    //System.out.println("  state=" + currentFrame.state);
-    //}
+    // if (DEBUG) {
+    // System.out.println("  state=" + currentFrame.state);
+    // }
     return fr.parent.postingsReader.postings(fr.fieldInfo, currentFrame.state, reuse, flags);
   }
 
   @Override
   public ImpactsEnum impacts(int flags) throws IOException {
     assert !eof;
-    //if (DEBUG) {
-    //System.out.println("BTTR.docs seg=" + segment);
-    //}
+    // if (DEBUG) {
+    // System.out.println("BTTR.docs seg=" + segment);
+    // }
     currentFrame.decodeMetaData();
-    //if (DEBUG) {
-    //System.out.println("  state=" + currentFrame.state);
-    //}
+    // if (DEBUG) {
+    // System.out.println("  state=" + currentFrame.state);
+    // }
     return fr.parent.postingsReader.impacts(fr.fieldInfo, currentFrame.state, flags);
   }
 
   @Override
   public void seekExact(BytesRef target, TermState otherState) {
     // if (DEBUG) {
-    //   System.out.println("BTTR.seekExact termState seg=" + segment + " target=" + target.utf8ToString() + " " + target + " state=" + otherState);
+    //   System.out.println("BTTR.seekExact termState seg=" + segment + " target=" +
+    // target.utf8ToString() + " " + target + " state=" + otherState);
     // }
     assert clearEOF();
     if (target.compareTo(term.get()) != 0 || !termExists) {
@@ -1037,13 +1169,13 @@ final class SegmentTermsEnum extends BaseTermsEnum {
       // }
     }
   }
-      
+
   @Override
   public TermState termState() throws IOException {
     assert !eof;
     currentFrame.decodeMetaData();
     TermState ts = currentFrame.state.clone();
-    //if (DEBUG) System.out.println("BTTR.termState seg=" + segment + " state=" + ts);
+    // if (DEBUG) System.out.println("BTTR.termState seg=" + segment + " state=" + ts);
     return ts;
   }
 
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/blocktree/SegmentTermsEnumFrame.java b/lucene/core/src/java/org/apache/lucene/codecs/blocktree/SegmentTermsEnumFrame.java
index 19c321c..eb91b04 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/blocktree/SegmentTermsEnumFrame.java
+++ b/lucene/core/src/java/org/apache/lucene/codecs/blocktree/SegmentTermsEnumFrame.java
@@ -16,10 +16,8 @@
  */
 package org.apache.lucene.codecs.blocktree;
 
-
 import java.io.IOException;
 import java.util.Arrays;
-
 import org.apache.lucene.codecs.BlockTermState;
 import org.apache.lucene.index.CorruptIndexException;
 import org.apache.lucene.index.IndexOptions;
@@ -39,7 +37,7 @@ final class SegmentTermsEnumFrame {
 
   FST.Arc<BytesRef> arc;
 
-  //static boolean DEBUG = BlockTreeTermsWriter.DEBUG;
+  // static boolean DEBUG = BlockTreeTermsWriter.DEBUG;
 
   // File pointer where this block was loaded from
   long fp;
@@ -118,13 +116,15 @@ final class SegmentTermsEnumFrame {
     if (numBytes > floorData.length) {
       floorData = new byte[ArrayUtil.oversize(numBytes, 1)];
     }
-    System.arraycopy(source.bytes, source.offset+in.getPosition(), floorData, 0, numBytes);
+    System.arraycopy(source.bytes, source.offset + in.getPosition(), floorData, 0, numBytes);
     floorDataReader.reset(floorData, 0, numBytes);
     numFollowFloorBlocks = floorDataReader.readVInt();
     nextFloorLabel = floorDataReader.readByte() & 0xff;
-    //if (DEBUG) {
-    //System.out.println("    setFloorData fpOrig=" + fpOrig + " bytes=" + new BytesRef(source.bytes, source.offset + in.getPosition(), numBytes) + " numFollowFloorBlocks=" + numFollowFloorBlocks + " nextFloorLabel=" + toHex(nextFloorLabel));
-    //}
+    // if (DEBUG) {
+    // System.out.println("    setFloorData fpOrig=" + fpOrig + " bytes=" + new
+    // BytesRef(source.bytes, source.offset + in.getPosition(), numBytes) + " numFollowFloorBlocks="
+    // + numFollowFloorBlocks + " nextFloorLabel=" + toHex(nextFloorLabel));
+    // }
   }
 
   public int getTermBlockOrd() {
@@ -132,24 +132,24 @@ final class SegmentTermsEnumFrame {
   }
 
   void loadNextFloorBlock() throws IOException {
-    //if (DEBUG) {
-    //System.out.println("    loadNextFloorBlock fp=" + fp + " fpEnd=" + fpEnd);
-    //}
-    assert arc == null || isFloor: "arc=" + arc + " isFloor=" + isFloor;
+    // if (DEBUG) {
+    // System.out.println("    loadNextFloorBlock fp=" + fp + " fpEnd=" + fpEnd);
+    // }
+    assert arc == null || isFloor : "arc=" + arc + " isFloor=" + isFloor;
     fp = fpEnd;
     nextEnt = -1;
     loadBlock();
   }
 
   /* Does initial decode of next block of terms; this
-     doesn't actually decode the docFreq, totalTermFreq,
-     postings details (frq/prx offset, etc.) metadata;
-     it just loads them as byte[] blobs which are then      
-     decoded on-demand if the metadata is ever requested
-     for any term in this block.  This enables terms-only
-     intensive consumes (eg certain MTQs, respelling) to
-     not pay the price of decoding metadata they won't
-     use. */
+  doesn't actually decode the docFreq, totalTermFreq,
+  postings details (frq/prx offset, etc.) metadata;
+  it just loads them as byte[] blobs which are then
+  decoded on-demand if the metadata is ever requested
+  for any term in this block.  This enables terms-only
+  intensive consumes (eg certain MTQs, respelling) to
+  not pay the price of decoding metadata they won't
+  use. */
   void loadBlock() throws IOException {
 
     // Clone the IndexInput lazily, so that consumers
@@ -161,7 +161,7 @@ final class SegmentTermsEnumFrame {
       // Already loaded
       return;
     }
-    //System.out.println("blc=" + blockLoadCount);
+    // System.out.println("blc=" + blockLoadCount);
 
     ste.in.seek(fp);
     int code = ste.in.readVInt();
@@ -169,7 +169,8 @@ final class SegmentTermsEnumFrame {
     assert entCount > 0;
     isLastInFloor = (code & 1) != 0;
 
-    assert arc == null || (isLastInFloor || isFloor): "fp=" + fp + " arc=" + arc + " isFloor=" + isFloor + " isLastInFloor=" + isLastInFloor;
+    assert arc == null || (isLastInFloor || isFloor)
+        : "fp=" + fp + " arc=" + arc + " isFloor=" + isFloor + " isLastInFloor=" + isLastInFloor;
 
     // TODO: if suffixes were stored in random-access
     // array structure, then we could do binary search
@@ -218,12 +219,12 @@ final class SegmentTermsEnumFrame {
     totalSuffixBytes = ste.in.getFilePointer() - startSuffixFP;
 
     /*if (DEBUG) {
-      if (arc == null) {
-      System.out.println("    loadBlock (next) fp=" + fp + " entCount=" + entCount + " prefixLen=" + prefix + " isLastInFloor=" + isLastInFloor + " leaf?=" + isLeafBlock);
-      } else {
-      System.out.println("    loadBlock (seek) fp=" + fp + " entCount=" + entCount + " prefixLen=" + prefix + " hasTerms?=" + hasTerms + " isFloor?=" + isFloor + " isLastInFloor=" + isLastInFloor + " leaf?=" + isLeafBlock);
-      }
-      }*/
+    if (arc == null) {
+    System.out.println("    loadBlock (next) fp=" + fp + " entCount=" + entCount + " prefixLen=" + prefix + " isLastInFloor=" + isLastInFloor + " leaf?=" + isLeafBlock);
+    } else {
+    System.out.println("    loadBlock (seek) fp=" + fp + " entCount=" + entCount + " prefixLen=" + prefix + " hasTerms?=" + hasTerms + " isFloor?=" + isFloor + " isLastInFloor=" + isLastInFloor + " leaf?=" + isLeafBlock);
+    }
+    }*/
 
     // stats
     int numBytes = ste.in.readVInt();
@@ -316,8 +317,10 @@ final class SegmentTermsEnumFrame {
   }
 
   public void nextLeaf() {
-    //if (DEBUG) System.out.println("  frame.next ord=" + ord + " nextEnt=" + nextEnt + " entCount=" + entCount);
-    assert nextEnt != -1 && nextEnt < entCount: "nextEnt=" + nextEnt + " entCount=" + entCount + " fp=" + fp;
+    // if (DEBUG) System.out.println("  frame.next ord=" + ord + " nextEnt=" + nextEnt + "
+    // entCount=" + entCount);
+    assert nextEnt != -1 && nextEnt < entCount
+        : "nextEnt=" + nextEnt + " entCount=" + entCount + " fp=" + fp;
     nextEnt++;
     suffix = suffixLengthsReader.readVInt();
     startBytePos = suffixesReader.getPosition();
@@ -328,10 +331,12 @@ final class SegmentTermsEnumFrame {
   }
 
   public boolean nextNonLeaf() throws IOException {
-    //if (DEBUG) System.out.println("  stef.next ord=" + ord + " nextEnt=" + nextEnt + " entCount=" + entCount + " fp=" + suffixesReader.getPosition());
+    // if (DEBUG) System.out.println("  stef.next ord=" + ord + " nextEnt=" + nextEnt + " entCount="
+    // + entCount + " fp=" + suffixesReader.getPosition());
     while (true) {
       if (nextEnt == entCount) {
-        assert arc == null || (isFloor && isLastInFloor == false): "isFloor=" + isFloor + " isLastInFloor=" + isLastInFloor;
+        assert arc == null || (isFloor && isLastInFloor == false)
+            : "isFloor=" + isFloor + " isLastInFloor=" + isLastInFloor;
         loadNextFloorBlock();
         if (isLeafBlock) {
           nextLeaf();
@@ -340,8 +345,9 @@ final class SegmentTermsEnumFrame {
           continue;
         }
       }
-        
-      assert nextEnt != -1 && nextEnt < entCount: "nextEnt=" + nextEnt + " entCount=" + entCount + " fp=" + fp;
+
+      assert nextEnt != -1 && nextEnt < entCount
+          : "nextEnt=" + nextEnt + " entCount=" + entCount + " fp=" + fp;
       nextEnt++;
       final int code = suffixLengthsReader.readVInt();
       suffix = code >>> 1;
@@ -360,14 +366,14 @@ final class SegmentTermsEnumFrame {
         ste.termExists = false;
         subCode = suffixLengthsReader.readVLong();
         lastSubFP = fp - subCode;
-        //if (DEBUG) {
-        //System.out.println("    lastSubFP=" + lastSubFP);
-        //}
+        // if (DEBUG) {
+        // System.out.println("    lastSubFP=" + lastSubFP);
+        // }
         return true;
       }
     }
   }
-        
+
   // TODO: make this array'd so we can do bin search?
   // likely not worth it?  need to measure how many
   // floor blocks we "typically" get
@@ -375,7 +381,8 @@ final class SegmentTermsEnumFrame {
 
     if (!isFloor || target.length <= prefix) {
       // if (DEBUG) {
-      //   System.out.println("    scanToFloorFrame skip: isFloor=" + isFloor + " target.length=" + target.length + " vs prefix=" + prefix);
+      //   System.out.println("    scanToFloorFrame skip: isFloor=" + isFloor + " target.length=" +
+      // target.length + " vs prefix=" + prefix);
       // }
       return;
     }
@@ -383,7 +390,9 @@ final class SegmentTermsEnumFrame {
     final int targetLabel = target.bytes[target.offset + prefix] & 0xFF;
 
     // if (DEBUG) {
-    //   System.out.println("    scanToFloorFrame fpOrig=" + fpOrig + " targetLabel=" + toHex(targetLabel) + " vs nextFloorLabel=" + toHex(nextFloorLabel) + " numFollowFloorBlocks=" + numFollowFloorBlocks);
+    //   System.out.println("    scanToFloorFrame fpOrig=" + fpOrig + " targetLabel=" +
+    // toHex(targetLabel) + " vs nextFloorLabel=" + toHex(nextFloorLabel) + " numFollowFloorBlocks="
+    // + numFollowFloorBlocks);
     // }
 
     if (targetLabel < nextFloorLabel) {
@@ -401,16 +410,18 @@ final class SegmentTermsEnumFrame {
       newFP = fpOrig + (code >>> 1);
       hasTerms = (code & 1) != 0;
       // if (DEBUG) {
-      //   System.out.println("      label=" + toHex(nextFloorLabel) + " fp=" + newFP + " hasTerms?=" + hasTerms + " numFollowFloor=" + numFollowFloorBlocks);
+      //   System.out.println("      label=" + toHex(nextFloorLabel) + " fp=" + newFP + "
+      // hasTerms?=" + hasTerms + " numFollowFloor=" + numFollowFloorBlocks);
       // }
-            
+
       isLastInFloor = numFollowFloorBlocks == 1;
       numFollowFloorBlocks--;
 
       if (isLastInFloor) {
         nextFloorLabel = 256;
         // if (DEBUG) {
-        //   System.out.println("        stop!  last block nextFloorLabel=" + toHex(nextFloorLabel));
+        //   System.out.println("        stop!  last block nextFloorLabel=" +
+        // toHex(nextFloorLabel));
         // }
         break;
       } else {
@@ -437,10 +448,11 @@ final class SegmentTermsEnumFrame {
       // }
     }
   }
-    
+
   public void decodeMetaData() throws IOException {
 
-    //if (DEBUG) System.out.println("\nBTTR.decodeMetadata seg=" + segment + " mdUpto=" + metaDataUpto + " vs termBlockOrd=" + state.termBlockOrd);
+    // if (DEBUG) System.out.println("\nBTTR.decodeMetadata seg=" + segment + " mdUpto=" +
+    // metaDataUpto + " vs termBlockOrd=" + state.termBlockOrd);
 
     // lazily catch up on metadata decode:
     final int limit = getTermBlockOrd();
@@ -482,12 +494,12 @@ final class SegmentTermsEnumFrame {
       } else {
         assert statsSingletonRunLength == 0;
         state.docFreq = statsReader.readVInt();
-        //if (DEBUG) System.out.println("    dF=" + state.docFreq);
+        // if (DEBUG) System.out.println("    dF=" + state.docFreq);
         if (ste.fr.fieldInfo.getIndexOptions() == IndexOptions.DOCS) {
           state.totalTermFreq = state.docFreq; // all postings have freq=1
         } else {
           state.totalTermFreq = state.docFreq + statsReader.readVLong();
-          //if (DEBUG) System.out.println("    totTF=" + state.totalTermFreq);
+          // if (DEBUG) System.out.println("    totTF=" + state.totalTermFreq);
         }
       }
 
@@ -502,7 +514,7 @@ final class SegmentTermsEnumFrame {
 
   // Used only by assert
   private boolean prefixMatches(BytesRef target) {
-    for(int bytePos=0;bytePos<prefix;bytePos++) {
+    for (int bytePos = 0; bytePos < prefix; bytePos++) {
       if (target.bytes[target.offset + bytePos] != ste.term.byteAt(bytePos)) {
         return false;
       }
@@ -516,16 +528,17 @@ final class SegmentTermsEnumFrame {
   // startBytePos/suffix as a side effect
   public void scanToSubBlock(long subFP) {
     assert !isLeafBlock;
-    //if (DEBUG) System.out.println("  scanToSubBlock fp=" + fp + " subFP=" + subFP + " entCount=" + entCount + " lastSubFP=" + lastSubFP);
-    //assert nextEnt == 0;
+    // if (DEBUG) System.out.println("  scanToSubBlock fp=" + fp + " subFP=" + subFP + " entCount="
+    // + entCount + " lastSubFP=" + lastSubFP);
+    // assert nextEnt == 0;
     if (lastSubFP == subFP) {
-      //if (DEBUG) System.out.println("    already positioned");
+      // if (DEBUG) System.out.println("    already positioned");
       return;
     }
     assert subFP < fp : "fp=" + fp + " subFP=" + subFP;
     final long targetSubCode = fp - subFP;
-    //if (DEBUG) System.out.println("    targetSubCode=" + targetSubCode);
-    while(true) {
+    // if (DEBUG) System.out.println("    targetSubCode=" + targetSubCode);
+    while (true) {
       assert nextEnt < entCount;
       nextEnt++;
       final int code = suffixLengthsReader.readVInt();
@@ -533,7 +546,7 @@ final class SegmentTermsEnumFrame {
       if ((code & 1) != 0) {
         final long subCode = suffixLengthsReader.readVLong();
         if (targetSubCode == subCode) {
-          //if (DEBUG) System.out.println("        match!");
+          // if (DEBUG) System.out.println("        match!");
           lastSubFP = subFP;
           return;
         }
@@ -572,7 +585,9 @@ final class SegmentTermsEnumFrame {
   // scan the entries check if the suffix matches.
   public SeekStatus scanToTermLeaf(BytesRef target, boolean exactOnly) throws IOException {
 
-    // if (DEBUG) System.out.println("    scanToTermLeaf: block fp=" + fp + " prefix=" + prefix + " nextEnt=" + nextEnt + " (of " + entCount + ") target=" + brToString(target) + " term=" + brToString(term));
+    // if (DEBUG) System.out.println("    scanToTermLeaf: block fp=" + fp + " prefix=" + prefix + "
+    // nextEnt=" + nextEnt + " (of " + entCount + ") target=" + brToString(target) + " term=" +
+    // brToString(term));
 
     assert nextEnt != -1;
 
@@ -601,16 +616,22 @@ final class SegmentTermsEnumFrame {
       //   suffixBytesRef.bytes = suffixBytes;
       //   suffixBytesRef.offset = suffixesReader.getPosition();
       //   suffixBytesRef.length = suffix;
-      //   System.out.println("      cycle: term " + (nextEnt-1) + " (of " + entCount + ") suffix=" + brToString(suffixBytesRef));
+      //   System.out.println("      cycle: term " + (nextEnt-1) + " (of " + entCount + ") suffix="
+      // + brToString(suffixBytesRef));
       // }
 
       startBytePos = suffixesReader.getPosition();
       suffixesReader.skipBytes(suffix);
 
       // Loop over bytes in the suffix, comparing to the target
-      final int cmp = Arrays.compareUnsigned(
-          suffixBytes, startBytePos, startBytePos + suffix,
-          target.bytes, target.offset + prefix, target.offset + target.length);
+      final int cmp =
+          Arrays.compareUnsigned(
+              suffixBytes,
+              startBytePos,
+              startBytePos + suffix,
+              target.bytes,
+              target.offset + prefix,
+              target.offset + target.length);
 
       if (cmp < 0) {
         // Current entry is still before the target;
@@ -620,7 +641,7 @@ final class SegmentTermsEnumFrame {
         // return NOT_FOUND:
         fillTerm();
 
-        //if (DEBUG) System.out.println("        not found");
+        // if (DEBUG) System.out.println("        not found");
         return SeekStatus.NOT_FOUND;
       } else {
         // Exact match!
@@ -631,7 +652,7 @@ final class SegmentTermsEnumFrame {
 
         assert ste.termExists;
         fillTerm();
-        //if (DEBUG) System.out.println("        found!");
+        // if (DEBUG) System.out.println("        found!");
         return SeekStatus.FOUND;
       }
     } while (nextEnt < entCount);
@@ -645,7 +666,7 @@ final class SegmentTermsEnumFrame {
     // to the foo* block, but the last term in this block
     // was fooz (and, eg, first term in the next block will
     // bee fop).
-    //if (DEBUG) System.out.println("      block end");
+    // if (DEBUG) System.out.println("      block end");
     if (exactOnly) {
       fillTerm();
     }
@@ -660,7 +681,9 @@ final class SegmentTermsEnumFrame {
   // scan the entries check if the suffix matches.
   public SeekStatus scanToTermNonLeaf(BytesRef target, boolean exactOnly) throws IOException {
 
-    //if (DEBUG) System.out.println("    scanToTermNonLeaf: block fp=" + fp + " prefix=" + prefix + " nextEnt=" + nextEnt + " (of " + entCount + ") target=" + brToString(target) + " term=" + brToString(target));
+    // if (DEBUG) System.out.println("    scanToTermNonLeaf: block fp=" + fp + " prefix=" + prefix +
+    // " nextEnt=" + nextEnt + " (of " + entCount + ") target=" + brToString(target) + " term=" +
+    // brToString(target));
 
     assert nextEnt != -1;
 
@@ -675,20 +698,21 @@ final class SegmentTermsEnumFrame {
     assert prefixMatches(target);
 
     // Loop over each entry (term or sub-block) in this block:
-    while(nextEnt < entCount) {
+    while (nextEnt < entCount) {
 
       nextEnt++;
 
       final int code = suffixLengthsReader.readVInt();
       suffix = code >>> 1;
 
-      //if (DEBUG) {
+      // if (DEBUG) {
       //  BytesRef suffixBytesRef = new BytesRef();
       //  suffixBytesRef.bytes = suffixBytes;
       //  suffixBytesRef.offset = suffixesReader.getPosition();
       //  suffixBytesRef.length = suffix;
-      //  System.out.println("      cycle: " + ((code&1)==1 ? "sub-block" : "term") + " " + (nextEnt-1) + " (of " + entCount + ") suffix=" + brToString(suffixBytesRef));
-      //}
+      //  System.out.println("      cycle: " + ((code&1)==1 ? "sub-block" : "term") + " " +
+      // (nextEnt-1) + " (of " + entCount + ") suffix=" + brToString(suffixBytesRef));
+      // }
 
       final int termLen = prefix + suffix;
       startBytePos = suffixesReader.getPosition();
@@ -702,9 +726,14 @@ final class SegmentTermsEnumFrame {
         lastSubFP = fp - subCode;
       }
 
-      final int cmp = Arrays.compareUnsigned(
-          suffixBytes, startBytePos, startBytePos + suffix,
-          target.bytes, target.offset + prefix, target.offset + target.length);
+      final int cmp =
+          Arrays.compareUnsigned(
+              suffixBytes,
+              startBytePos,
+              startBytePos + suffix,
+              target.bytes,
+              target.offset + prefix,
+              target.offset + target.length);
 
       if (cmp < 0) {
         // Current entry is still before the target;
@@ -714,11 +743,12 @@ final class SegmentTermsEnumFrame {
         // return NOT_FOUND:
         fillTerm();
 
-        //if (DEBUG) System.out.println("        maybe done exactOnly=" + exactOnly + " ste.termExists=" + ste.termExists);
+        // if (DEBUG) System.out.println("        maybe done exactOnly=" + exactOnly + "
+        // ste.termExists=" + ste.termExists);
 
         if (!exactOnly && !ste.termExists) {
-          //System.out.println("  now pushFrame");
-          // TODO this 
+          // System.out.println("  now pushFrame");
+          // TODO this
           // We are on a sub-block, and caller wants
           // us to position to the next term after
           // the target, so we must recurse into the
@@ -731,7 +761,7 @@ final class SegmentTermsEnumFrame {
           }
         }
 
-        //if (DEBUG) System.out.println("        not found");
+        // if (DEBUG) System.out.println("        not found");
         return SeekStatus.NOT_FOUND;
       } else {
         // Exact match!
@@ -742,7 +772,7 @@ final class SegmentTermsEnumFrame {
 
         assert ste.termExists;
         fillTerm();
-        //if (DEBUG) System.out.println("        found!");
+        // if (DEBUG) System.out.println("        found!");
         return SeekStatus.FOUND;
       }
     }
@@ -756,7 +786,7 @@ final class SegmentTermsEnumFrame {
     // to the foo* block, but the last term in this block
     // was fooz (and, eg, first term in the next block will
     // bee fop).
-    //if (DEBUG) System.out.println("      block end");
+    // if (DEBUG) System.out.println("      block end");
     if (exactOnly) {
       fillTerm();
     }
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/blocktree/Stats.java b/lucene/core/src/java/org/apache/lucene/codecs/blocktree/Stats.java
index c6d1293..4ea4357 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/blocktree/Stats.java
+++ b/lucene/core/src/java/org/apache/lucene/codecs/blocktree/Stats.java
@@ -16,20 +16,18 @@
  */
 package org.apache.lucene.codecs.blocktree;
 
-
 import java.io.ByteArrayOutputStream;
 import java.io.PrintStream;
 import java.io.UnsupportedEncodingException;
 import java.util.Locale;
-
 import org.apache.lucene.codecs.PostingsReaderBase;
 import org.apache.lucene.util.ArrayUtil;
 import org.apache.lucene.util.BytesRef;
 import org.apache.lucene.util.IOUtils;
 
 /**
- * BlockTree statistics for a single field 
- * returned by {@link FieldReader#getStats()}.
+ * BlockTree statistics for a single field returned by {@link FieldReader#getStats()}.
+ *
  * @lucene.internal
  */
 public class Stats {
@@ -45,23 +43,22 @@ public class Stats {
   /** The number of normal (non-floor) blocks in the terms file. */
   public int nonFloorBlockCount;
 
-  /** The number of floor blocks (meta-blocks larger than the
-   *  allowed {@code maxItemsPerBlock}) in the terms file. */
+  /**
+   * The number of floor blocks (meta-blocks larger than the allowed {@code maxItemsPerBlock}) in
+   * the terms file.
+   */
   public int floorBlockCount;
-    
+
   /** The number of sub-blocks within the floor blocks. */
   public int floorSubBlockCount;
 
-  /** The number of "internal" blocks (that have both
-   *  terms and sub-blocks). */
+  /** The number of "internal" blocks (that have both terms and sub-blocks). */
   public int mixedBlockCount;
 
-  /** The number of "leaf" blocks (blocks that have only
-   *  terms). */
+  /** The number of "leaf" blocks (blocks that have only terms). */
   public int termsOnlyBlockCount;
 
-  /** The number of "internal" blocks that do not contain
-   *  terms (have only sub-blocks). */
+  /** The number of "internal" blocks that do not contain terms (have only sub-blocks). */
   public int subBlocksOnlyBlockCount;
 
   /** Total number of blocks. */
@@ -69,6 +66,7 @@ public class Stats {
 
   /** Number of blocks at each prefix depth. */
   public int[] blockCountByPrefixLen = new int[10];
+
   private int startBlockCount;
   private int endBlockCount;
 
@@ -76,23 +74,24 @@ public class Stats {
   public long totalBlockSuffixBytes;
 
   /**
-   * Number of times each compression method has been used.
-   * 0 = uncompressed
-   * 1 = lowercase_ascii
-   * 2 = LZ4
+   * Number of times each compression method has been used. 0 = uncompressed 1 = lowercase_ascii 2 =
+   * LZ4
    */
   public final long[] compressionAlgorithms = new long[3];
 
   /** Total number of suffix bytes before compression. */
   public long totalUncompressedBlockSuffixBytes;
 
-  /** Total number of bytes used to store term stats (not
-   *  including what the {@link PostingsReaderBase}
-   *  stores. */
+  /**
+   * Total number of bytes used to store term stats (not including what the {@link
+   * PostingsReaderBase} stores.
+   */
   public long totalBlockStatsBytes;
 
-  /** Total bytes stored by the {@link PostingsReaderBase},
-   *  plus the other few vInts stored in the frame. */
+  /**
+   * Total bytes stored by the {@link PostingsReaderBase}, plus the other few vInts stored in the
+   * frame.
+   */
   public long totalBlockOtherBytes;
 
   /** Segment name. */
@@ -118,7 +117,7 @@ public class Stats {
     }
 
     if (blockCountByPrefixLen.length <= frame.prefix) {
-      blockCountByPrefixLen = ArrayUtil.grow(blockCountByPrefixLen, 1+frame.prefix);
+      blockCountByPrefixLen = ArrayUtil.grow(blockCountByPrefixLen, 1 + frame.prefix);
     }
     blockCountByPrefixLen[frame.prefix]++;
     startBlockCount++;
@@ -145,8 +144,10 @@ public class Stats {
       throw new IllegalStateException();
     }
     endBlockCount++;
-    final long otherBytes = frame.fpEnd - frame.fp - frame.totalSuffixBytes - frame.statsReader.length();
-    assert otherBytes > 0 : "otherBytes=" + otherBytes + " frame.fp=" + frame.fp + " frame.fpEnd=" + frame.fpEnd;
+    final long otherBytes =
+        frame.fpEnd - frame.fp - frame.totalSuffixBytes - frame.statsReader.length();
+    assert otherBytes > 0
+        : "otherBytes=" + otherBytes + " frame.fp=" + frame.fp + " frame.fpEnd=" + frame.fpEnd;
     totalBlockOtherBytes += otherBytes;
   }
 
@@ -155,9 +156,24 @@ public class Stats {
   }
 
   void finish() {
-    assert startBlockCount == endBlockCount: "startBlockCount=" + startBlockCount + " endBlockCount=" + endBlockCount;
-    assert totalBlockCount == floorSubBlockCount + nonFloorBlockCount: "floorSubBlockCount=" + floorSubBlockCount + " nonFloorBlockCount=" + nonFloorBlockCount + " totalBlockCount=" + totalBlockCount;
-    assert totalBlockCount == mixedBlockCount + termsOnlyBlockCount + subBlocksOnlyBlockCount: "totalBlockCount=" + totalBlockCount + " mixedBlockCount=" + mixedBlockCount + " subBlocksOnlyBlockCount=" + subBlocksOnlyBlockCount + " termsOnlyBlockCount=" + termsOnlyBlockCount;
+    assert startBlockCount == endBlockCount
+        : "startBlockCount=" + startBlockCount + " endBlockCount=" + endBlockCount;
+    assert totalBlockCount == floorSubBlockCount + nonFloorBlockCount
+        : "floorSubBlockCount="
+            + floorSubBlockCount
+            + " nonFloorBlockCount="
+            + nonFloorBlockCount
+            + " totalBlockCount="
+            + totalBlockCount;
+    assert totalBlockCount == mixedBlockCount + termsOnlyBlockCount + subBlocksOnlyBlockCount
+        : "totalBlockCount="
+            + totalBlockCount
+            + " mixedBlockCount="
+            + mixedBlockCount
+            + " subBlocksOnlyBlockCount="
+            + subBlocksOnlyBlockCount
+            + " termsOnlyBlockCount="
+            + termsOnlyBlockCount;
   }
 
   @Override
@@ -169,21 +185,38 @@ public class Stats {
     } catch (UnsupportedEncodingException bogus) {
       throw new RuntimeException(bogus);
     }
-      
+
     out.println("  index FST:");
     out.println("    " + indexNumBytes + " bytes");
     out.println("  terms:");
     out.println("    " + totalTermCount + " terms");
-    out.println("    " + totalTermBytes + " bytes" + (totalTermCount != 0 ? " (" + String.format(Locale.ROOT, "%.1f", ((double) totalTermBytes)/totalTermCount) + " bytes/term)" : ""));
+    out.println(
+        "    "
+            + totalTermBytes
+            + " bytes"
+            + (totalTermCount != 0
+                ? " ("
+                    + String.format(Locale.ROOT, "%.1f", ((double) totalTermBytes) / totalTermCount)
+                    + " bytes/term)"
+                : ""));
     out.println("  blocks:");
     out.println("    " + totalBlockCount + " blocks");
     out.println("    " + termsOnlyBlockCount + " terms-only blocks");
     out.println("    " + subBlocksOnlyBlockCount + " sub-block-only blocks");
     out.println("    " + mixedBlockCount + " mixed blocks");
     out.println("    " + floorBlockCount + " floor blocks");
-    out.println("    " + (totalBlockCount-floorSubBlockCount) + " non-floor blocks");
+    out.println("    " + (totalBlockCount - floorSubBlockCount) + " non-floor blocks");
     out.println("    " + floorSubBlockCount + " floor sub-blocks");
-    out.println("    " + totalUncompressedBlockSuffixBytes + " term suffix bytes before compression" + (totalBlockCount != 0 ? " (" + String.format(Locale.ROOT, "%.1f", ((double) totalBlockSuffixBytes)/totalBlockCount) + " suffix-bytes/block)" : ""));
+    out.println(
+        "    "
+            + totalUncompressedBlockSuffixBytes
+            + " term suffix bytes before compression"
+            + (totalBlockCount != 0
+                ? " ("
+                    + String.format(
+                        Locale.ROOT, "%.1f", ((double) totalBlockSuffixBytes) / totalBlockCount)
+                    + " suffix-bytes/block)"
+                : ""));
     StringBuilder compressionCounts = new StringBuilder();
     for (int code = 0; code < compressionAlgorithms.length; ++code) {
       if (compressionAlgorithms[code] == 0) {
@@ -196,14 +229,44 @@ public class Stats {
       compressionCounts.append(": ");
       compressionCounts.append(compressionAlgorithms[code]);
     }
-    out.println("    " + totalBlockSuffixBytes + " compressed term suffix bytes" + (totalBlockCount != 0 ? " (" + String.format(Locale.ROOT, "%.2f", ((double) totalBlockSuffixBytes)/totalUncompressedBlockSuffixBytes) +
-        " compression ratio - compression count by algorithm: " + compressionCounts : "") + ")");
-    out.println("    " + totalBlockStatsBytes + " term stats bytes " + (totalBlockCount != 0 ? " (" + String.format(Locale.ROOT, "%.1f", ((double) totalBlockStatsBytes)/totalBlockCount) + " stats-bytes/block)" : ""));
-    out.println("    " + totalBlockOtherBytes + " other bytes" + (totalBlockCount != 0 ? " (" + String.format(Locale.ROOT, "%.1f", ((double) totalBlockOtherBytes)/totalBlockCount) + " other-bytes/block)" : ""));
+    out.println(
+        "    "
+            + totalBlockSuffixBytes
+            + " compressed term suffix bytes"
+            + (totalBlockCount != 0
+                ? " ("
+                    + String.format(
+                        Locale.ROOT,
+                        "%.2f",
+                        ((double) totalBlockSuffixBytes) / totalUncompressedBlockSuffixBytes)
+                    + " compression ratio - compression count by algorithm: "
+                    + compressionCounts
+                : "")
+            + ")");
+    out.println(
+        "    "
+            + totalBlockStatsBytes
+            + " term stats bytes "
+            + (totalBlockCount != 0
+                ? " ("
+                    + String.format(
+                        Locale.ROOT, "%.1f", ((double) totalBlockStatsBytes) / totalBlockCount)
+                    + " stats-bytes/block)"
+                : ""));
+    out.println(
+        "    "
+            + totalBlockOtherBytes
+            + " other bytes"
+            + (totalBlockCount != 0
+                ? " ("
+                    + String.format(
+                        Locale.ROOT, "%.1f", ((double) totalBlockOtherBytes) / totalBlockCount)
+                    + " other-bytes/block)"
+                : ""));
     if (totalBlockCount != 0) {
       out.println("    by prefix length:");
       int total = 0;
-      for(int prefix=0;prefix<blockCountByPrefixLen.length;prefix++) {
+      for (int prefix = 0; prefix < blockCountByPrefixLen.length; prefix++) {
         final int blockCount = blockCountByPrefixLen[prefix];
         total += blockCount;
         if (blockCount != 0) {
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/blocktree/package-info.java b/lucene/core/src/java/org/apache/lucene/codecs/blocktree/package-info.java
index 9cdbb02..dec1f2c 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/blocktree/package-info.java
+++ b/lucene/core/src/java/org/apache/lucene/codecs/blocktree/package-info.java
@@ -17,18 +17,12 @@
 
 /**
  * BlockTree terms dictionary.
- * 
- * <p>
- * This terms dictionary organizes all terms into blocks according to
- * shared prefix, such that each block has enough terms, and then stores
- * the prefix trie in memory as an FST as the index structure.  It allows
- * you to plug in your own {@link
- * org.apache.lucene.codecs.PostingsWriterBase} to implement the
- * postings.
- * </p>
- * 
- * <p>See {@link org.apache.lucene.codecs.blocktree.BlockTreeTermsWriter}
- *   for the file format.
- * </p>
+ *
+ * <p>This terms dictionary organizes all terms into blocks according to shared prefix, such that
+ * each block has enough terms, and then stores the prefix trie in memory as an FST as the index
+ * structure. It allows you to plug in your own {@link org.apache.lucene.codecs.PostingsWriterBase}
+ * to implement the postings.
+ *
+ * <p>See {@link org.apache.lucene.codecs.blocktree.BlockTreeTermsWriter} for the file format.
  */
 package org.apache.lucene.codecs.blocktree;
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/compressing/CompressingStoredFieldsFormat.java b/lucene/core/src/java/org/apache/lucene/codecs/compressing/CompressingStoredFieldsFormat.java
index 5773c16..bc63504 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/compressing/CompressingStoredFieldsFormat.java
+++ b/lucene/core/src/java/org/apache/lucene/codecs/compressing/CompressingStoredFieldsFormat.java
@@ -16,9 +16,7 @@
  */
 package org.apache.lucene.codecs.compressing;
 
-
 import java.io.IOException;
-
 import org.apache.lucene.codecs.CodecUtil;
 import org.apache.lucene.codecs.StoredFieldsFormat;
 import org.apache.lucene.codecs.StoredFieldsReader;
@@ -30,17 +28,16 @@ import org.apache.lucene.store.Directory;
 import org.apache.lucene.store.IOContext;
 import org.apache.lucene.util.packed.DirectMonotonicWriter;
 
-
 /**
- * A {@link StoredFieldsFormat} that compresses documents in chunks in
- * order to improve the compression ratio.
- * <p>
- * For a chunk size of <var>chunkSize</var> bytes, this {@link StoredFieldsFormat}
- * does not support documents larger than (<code>2<sup>31</sup> - chunkSize</code>)
- * bytes.
- * <p>
- * For optimal performance, you should use a {@link MergePolicy} that returns
- * segments that have the biggest byte size first.
+ * A {@link StoredFieldsFormat} that compresses documents in chunks in order to improve the
+ * compression ratio.
+ *
+ * <p>For a chunk size of <var>chunkSize</var> bytes, this {@link StoredFieldsFormat} does not
+ * support documents larger than (<code>2<sup>31</sup> - chunkSize</code>) bytes.
+ *
+ * <p>For optimal performance, you should use a {@link MergePolicy} that returns segments that have
+ * the biggest byte size first.
+ *
  * @lucene.experimental
  */
 public class CompressingStoredFieldsFormat extends StoredFieldsFormat {
@@ -53,42 +50,42 @@ public class CompressingStoredFieldsFormat extends StoredFieldsFormat {
   private final int blockShift;
 
   /**
-   * Create a new {@link CompressingStoredFieldsFormat} with an empty segment 
-   * suffix.
-   * 
-   * @see CompressingStoredFieldsFormat#CompressingStoredFieldsFormat(String, String, CompressionMode, int, int, int)
+   * Create a new {@link CompressingStoredFieldsFormat} with an empty segment suffix.
+   *
+   * @see CompressingStoredFieldsFormat#CompressingStoredFieldsFormat(String, String,
+   *     CompressionMode, int, int, int)
    */
-  public CompressingStoredFieldsFormat(String formatName, CompressionMode compressionMode, int chunkSize, int maxDocsPerChunk, int blockShift) {
+  public CompressingStoredFieldsFormat(
+      String formatName,
+      CompressionMode compressionMode,
+      int chunkSize,
+      int maxDocsPerChunk,
+      int blockShift) {
     this(formatName, "", compressionMode, chunkSize, maxDocsPerChunk, blockShift);
   }
-  
+
   /**
    * Create a new {@link CompressingStoredFieldsFormat}.
-   * <p>
-   * <code>formatName</code> is the name of the format. This name will be used
-   * in the file formats to perform
-   * {@link CodecUtil#checkIndexHeader codec header checks}.
-   * <p>
-   * <code>segmentSuffix</code> is the segment suffix. This suffix is added to 
-   * the result file name only if it's not the empty string.
-   * <p>
-   * The <code>compressionMode</code> parameter allows you to choose between
-   * compression algorithms that have various compression and decompression
-   * speeds so that you can pick the one that best fits your indexing and
-   * searching throughput. You should never instantiate two
-   * {@link CompressingStoredFieldsFormat}s that have the same name but
-   * different {@link CompressionMode}s.
-   * <p>
-   * <code>chunkSize</code> is the minimum byte size of a chunk of documents.
-   * A value of <code>1</code> can make sense if there is redundancy across
-   * fields.
-   * <code>maxDocsPerChunk</code> is an upperbound on how many docs may be stored
-   * in a single chunk. This is to bound the cpu costs for highly compressible data.
-   * <p>
-   * Higher values of <code>chunkSize</code> should improve the compression
-   * ratio but will require more memory at indexing time and might make document
-   * loading a little slower (depending on the size of your OS cache compared
-   * to the size of your index).
+   *
+   * <p><code>formatName</code> is the name of the format. This name will be used in the file
+   * formats to perform {@link CodecUtil#checkIndexHeader codec header checks}.
+   *
+   * <p><code>segmentSuffix</code> is the segment suffix. This suffix is added to the result file
+   * name only if it's not the empty string.
+   *
+   * <p>The <code>compressionMode</code> parameter allows you to choose between compression
+   * algorithms that have various compression and decompression speeds so that you can pick the one
+   * that best fits your indexing and searching throughput. You should never instantiate two {@link
+   * CompressingStoredFieldsFormat}s that have the same name but different {@link CompressionMode}s.
+   *
+   * <p><code>chunkSize</code> is the minimum byte size of a chunk of documents. A value of <code>1
+   * </code> can make sense if there is redundancy across fields. <code>maxDocsPerChunk</code> is an
+   * upperbound on how many docs may be stored in a single chunk. This is to bound the cpu costs for
+   * highly compressible data.
+   *
+   * <p>Higher values of <code>chunkSize</code> should improve the compression ratio but will
+   * require more memory at indexing time and might make document loading a little slower (depending
+   * on the size of your OS cache compared to the size of your index).
    *
    * @param formatName the name of the {@link StoredFieldsFormat}
    * @param compressionMode the {@link CompressionMode} to use
@@ -97,8 +94,13 @@ public class CompressingStoredFieldsFormat extends StoredFieldsFormat {
    * @param blockShift the log in base 2 of number of chunks to store in an index block
    * @see CompressionMode
    */
-  public CompressingStoredFieldsFormat(String formatName, String segmentSuffix, 
-                                       CompressionMode compressionMode, int chunkSize, int maxDocsPerChunk, int blockShift) {
+  public CompressingStoredFieldsFormat(
+      String formatName,
+      String segmentSuffix,
+      CompressionMode compressionMode,
+      int chunkSize,
+      int maxDocsPerChunk,
+      int blockShift) {
     this.formatName = formatName;
     this.segmentSuffix = segmentSuffix;
     this.compressionMode = compressionMode;
@@ -110,31 +112,52 @@ public class CompressingStoredFieldsFormat extends StoredFieldsFormat {
       throw new IllegalArgumentException("maxDocsPerChunk must be >= 1");
     }
     this.maxDocsPerChunk = maxDocsPerChunk;
-    if (blockShift < DirectMonotonicWriter.MIN_BLOCK_SHIFT || blockShift > DirectMonotonicWriter.MAX_BLOCK_SHIFT) {
-      throw new IllegalArgumentException("blockSize must be in " + DirectMonotonicWriter.MIN_BLOCK_SHIFT + "-" +
-          DirectMonotonicWriter.MAX_BLOCK_SHIFT + ", got " + blockShift);
+    if (blockShift < DirectMonotonicWriter.MIN_BLOCK_SHIFT
+        || blockShift > DirectMonotonicWriter.MAX_BLOCK_SHIFT) {
+      throw new IllegalArgumentException(
+          "blockSize must be in "
+              + DirectMonotonicWriter.MIN_BLOCK_SHIFT
+              + "-"
+              + DirectMonotonicWriter.MAX_BLOCK_SHIFT
+              + ", got "
+              + blockShift);
     }
     this.blockShift = blockShift;
   }
 
   @Override
-  public StoredFieldsReader fieldsReader(Directory directory, SegmentInfo si,
-      FieldInfos fn, IOContext context) throws IOException {
-    return new CompressingStoredFieldsReader(directory, si, segmentSuffix, fn, 
-        context, formatName, compressionMode);
+  public StoredFieldsReader fieldsReader(
+      Directory directory, SegmentInfo si, FieldInfos fn, IOContext context) throws IOException {
+    return new CompressingStoredFieldsReader(
+        directory, si, segmentSuffix, fn, context, formatName, compressionMode);
   }
 
   @Override
-  public StoredFieldsWriter fieldsWriter(Directory directory, SegmentInfo si,
-      IOContext context) throws IOException {
-    return new CompressingStoredFieldsWriter(directory, si, segmentSuffix, context,
-        formatName, compressionMode, chunkSize, maxDocsPerChunk, blockShift);
+  public StoredFieldsWriter fieldsWriter(Directory directory, SegmentInfo si, IOContext context)
+      throws IOException {
+    return new CompressingStoredFieldsWriter(
+        directory,
+        si,
+        segmentSuffix,
+        context,
+        formatName,
+        compressionMode,
+        chunkSize,
+        maxDocsPerChunk,
+        blockShift);
   }
 
   @Override
   public String toString() {
-    return getClass().getSimpleName() + "(compressionMode=" + compressionMode
-        + ", chunkSize=" + chunkSize + ", maxDocsPerChunk=" + maxDocsPerChunk + ", blockShift=" + blockShift + ")";
+    return getClass().getSimpleName()
+        + "(compressionMode="
+        + compressionMode
+        + ", chunkSize="
+        + chunkSize
+        + ", maxDocsPerChunk="
+        + maxDocsPerChunk
+        + ", blockShift="
+        + blockShift
+        + ")";
   }
-
 }
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/compressing/CompressingStoredFieldsReader.java b/lucene/core/src/java/org/apache/lucene/codecs/compressing/CompressingStoredFieldsReader.java
index 1258eb7..850a023 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/compressing/CompressingStoredFieldsReader.java
+++ b/lucene/core/src/java/org/apache/lucene/codecs/compressing/CompressingStoredFieldsReader.java
@@ -16,7 +16,6 @@
  */
 package org.apache.lucene.codecs.compressing;
 
-
... 18272 lines suppressed ...


[lucene-solr] 08/11: Merge remote-tracking branch 'origin/master' into jira/LUCENE-9570

Posted by dw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

dweiss pushed a commit to branch jira/LUCENE-9570
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git

commit 36dd8b03a3d526f882f4caf09945fab6bbefc118
Merge: 61146b3 98f12f4
Author: Dawid Weiss <da...@carrotsearch.com>
AuthorDate: Wed Dec 23 12:40:47 2020 +0100

    Merge remote-tracking branch 'origin/master' into jira/LUCENE-9570

 .../function/valuesource/QueryValueSource.java     |   4 +
 solr/CHANGES.txt                                   |   3 +
 .../org/apache/solr/search/FunctionQParser.java    |   4 +-
 .../solr/search/function/TestFunctionQuery.java    | 127 ++++++++++++---------
 .../src/indexing-nested-documents.adoc             |  16 +--
 5 files changed, 88 insertions(+), 66 deletions(-)


[lucene-solr] 05/11: Simplify includes a bit.

Posted by dw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

dweiss pushed a commit to branch jira/LUCENE-9570
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git

commit 8b76dd4599f552a6bc1f8e97d423a83dab03f135
Author: Dawid Weiss <da...@carrotsearch.com>
AuthorDate: Wed Dec 23 11:20:04 2020 +0100

    Simplify includes a bit.
---
 gradle/validation/spotless.gradle | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/gradle/validation/spotless.gradle b/gradle/validation/spotless.gradle
index 318a2c9..7276c9d 100644
--- a/gradle/validation/spotless.gradle
+++ b/gradle/validation/spotless.gradle
@@ -38,15 +38,14 @@ allprojects { prj ->
         switch (project.path) {
           // These modules are complete - all sources scanned.
           case ":lucene:highlighter":
-            target "src/**"
-            targetExclude "**/resources/**", "**/overview.html", "**/CambridgeMA.utf8"
+            target "src/java/**", "src/test/**"
+            targetExclude "**/overview.html", "**/CambridgeMA.utf8"
             break
 
           // Partially complete.
           case ":lucene:core":
             target "src/java/**", "src/test/**"
-            targetExclude "**/resources/**",
-                "**/overview.html",
+            targetExclude "**/overview.html",
                 "**/META-INF/**",
                 "**/StandardTokenizerImpl.jflex",
                 "**/StandardTokenizerImpl.java",


[lucene-solr] 11/11: Merge branch 'master' into jira/LUCENE-9570

Posted by dw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

dweiss pushed a commit to branch jira/LUCENE-9570
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git

commit 6af9a8f1227eff4cef25fc5a3d8cae3387567965
Merge: f0e7225 b376b1b
Author: Dawid Weiss <da...@carrotsearch.com>
AuthorDate: Wed Dec 23 12:43:48 2020 +0100

    Merge branch 'master' into jira/LUCENE-9570

 lucene/core/src/java/org/apache/lucene/LucenePackage.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


[lucene-solr] 07/11: End tag for dd is optional.

Posted by dw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

dweiss pushed a commit to branch jira/LUCENE-9570
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git

commit 61146b361df122361b66eb9c4443d1b02cb5d203
Author: Dawid Weiss <da...@carrotsearch.com>
AuthorDate: Wed Dec 23 11:54:33 2020 +0100

    End tag for dd is optional.
---
 dev-tools/scripts/checkJavadocLinks.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/dev-tools/scripts/checkJavadocLinks.py b/dev-tools/scripts/checkJavadocLinks.py
index 5d07e27..6eaff12 100644
--- a/dev-tools/scripts/checkJavadocLinks.py
+++ b/dev-tools/scripts/checkJavadocLinks.py
@@ -41,7 +41,7 @@ class FindHyperlinks(HTMLParser):
   def handle_starttag(self, tag, attrs):
     # NOTE: I don't think 'a' should be in here. But try debugging 
     # NumericRangeQuery.html. (Could be javadocs bug, it's a generic type...)
-    if tag not in ('link', 'meta', 'frame', 'br', 'hr', 'p', 'li', 'img', 'col', 'a'):
+    if tag not in ('link', 'meta', 'frame', 'br', 'hr', 'p', 'li', 'img', 'col', 'a', 'dd'):
       self.stack.append(tag)
     if tag == 'a':
       id = None
@@ -79,7 +79,7 @@ class FindHyperlinks(HTMLParser):
         raise RuntimeError('couldn\'t find an href nor name in link in %s: only got these attrs: %s' % (self.baseURL, attrs))
 
   def handle_endtag(self, tag):
-    if tag in ('link', 'meta', 'frame', 'br', 'hr', 'p', 'li', 'img', 'col', 'a'):
+    if tag in ('link', 'meta', 'frame', 'br', 'hr', 'p', 'li', 'img', 'col', 'a', 'dd'):
       return
     
     if len(self.stack) == 0:


[lucene-solr] 10/11: Correct extra * in javadoc.

Posted by dw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

dweiss pushed a commit to branch jira/LUCENE-9570
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git

commit b376b1b9c285525f65787c0b1ff3dc5a574b023f
Author: Dawid Weiss <da...@carrotsearch.com>
AuthorDate: Wed Dec 23 12:43:39 2020 +0100

    Correct extra * in javadoc.
---
 lucene/core/src/java/org/apache/lucene/LucenePackage.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lucene/core/src/java/org/apache/lucene/LucenePackage.java b/lucene/core/src/java/org/apache/lucene/LucenePackage.java
index 4e44edd..da903f4 100644
--- a/lucene/core/src/java/org/apache/lucene/LucenePackage.java
+++ b/lucene/core/src/java/org/apache/lucene/LucenePackage.java
@@ -16,7 +16,7 @@
  */
 package org.apache.lucene;
 
-/** Lucene's package information, including version. * */
+/** Lucene's package information, including version. */
 public final class LucenePackage {
 
   private LucenePackage() {} // can't construct


[lucene-solr] 06/11: Workaround for an apparent javac bug.

Posted by dw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

dweiss pushed a commit to branch jira/LUCENE-9570
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git

commit 1674bb0fe9d1b5d61c45d1d16b4f49e054d4735e
Author: Dawid Weiss <da...@carrotsearch.com>
AuthorDate: Wed Dec 23 11:42:08 2020 +0100

    Workaround for an apparent javac bug.
---
 lucene/core/src/java/org/apache/lucene/search/package-info.java | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/lucene/core/src/java/org/apache/lucene/search/package-info.java b/lucene/core/src/java/org/apache/lucene/search/package-info.java
index 14cecc6..06e4370 100644
--- a/lucene/core/src/java/org/apache/lucene/search/package-info.java
+++ b/lucene/core/src/java/org/apache/lucene/search/package-info.java
@@ -185,10 +185,9 @@
  * <p>Lucene scoring is the heart of why we all love Lucene. It is blazingly fast and it hides
  * almost all of the complexity from the user. In a nutshell, it works. At least, that is, until it
  * doesn't work, or doesn't work as one would expect it to work. Then we are left digging into
- * Lucene internals or asking for help on <a
- * href="mailto:java-user@lucene.apache.org">java-user@lucene.apache.org</a> to figure out why a
- * document with five of our query terms scores lower than a different document with only one of the
- * query terms.
+ * Lucene internals or asking for help on <code>java-user@lucene.apache.org</code> to figure out why
+ * a document with five of our query terms scores lower than a different document with only one of
+ * the query terms.
  *
  * <p>While this document won't answer your specific scoring issues, it will, hopefully, point you
  * to the places that can help you figure out the <i>what</i> and <i>why</i> of Lucene scoring.


[lucene-solr] 02/11: :lucene:core - src/**/org/apache/lucene/document/**

Posted by dw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

dweiss pushed a commit to branch jira/LUCENE-9570
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git

commit c405405defa3b6d36d7907d7b8e20d3007d470b9
Author: Dawid Weiss <da...@carrotsearch.com>
AuthorDate: Wed Dec 23 10:25:09 2020 +0100

    :lucene:core - src/**/org/apache/lucene/document/**
---
 gradle/validation/spotless.gradle                  |   4 +-
 .../lucene/document/BinaryDocValuesField.java      |  33 +-
 .../org/apache/lucene/document/BinaryPoint.java    | 167 ++++----
 .../lucene/document/BinaryRangeDocValues.java      |   7 +-
 .../lucene/document/BinaryRangeDocValuesField.java |   5 +-
 .../document/BinaryRangeFieldRangeQuery.java       |  41 +-
 .../java/org/apache/lucene/document/DateTools.java | 166 ++++----
 .../java/org/apache/lucene/document/Document.java  | 172 ++++----
 .../document/DocumentStoredFieldVisitor.java       |  39 +-
 .../lucene/document/DoubleDocValuesField.java      |  25 +-
 .../org/apache/lucene/document/DoublePoint.java    | 182 ++++----
 .../org/apache/lucene/document/DoubleRange.java    | 121 +++---
 .../lucene/document/DoubleRangeDocValuesField.java |  23 +-
 .../lucene/document/DoubleRangeSlowRangeQuery.java |  10 +-
 .../lucene/document/FeatureDoubleValuesSource.java |  25 +-
 .../org/apache/lucene/document/FeatureField.java   | 353 +++++++++-------
 .../org/apache/lucene/document/FeatureQuery.java   |  20 +-
 .../apache/lucene/document/FeatureSortField.java   |  24 +-
 .../src/java/org/apache/lucene/document/Field.java | 308 +++++++-------
 .../java/org/apache/lucene/document/FieldType.java | 229 +++++-----
 .../lucene/document/FloatDocValuesField.java       |  26 +-
 .../org/apache/lucene/document/FloatPoint.java     | 176 ++++----
 .../org/apache/lucene/document/FloatRange.java     | 121 +++---
 .../lucene/document/FloatRangeDocValuesField.java  |  23 +-
 .../lucene/document/FloatRangeSlowRangeQuery.java  |   7 +-
 .../apache/lucene/document/InetAddressPoint.java   | 172 ++++----
 .../apache/lucene/document/InetAddressRange.java   |  61 ++-
 .../java/org/apache/lucene/document/IntPoint.java  | 159 ++++---
 .../java/org/apache/lucene/document/IntRange.java  | 121 +++---
 .../lucene/document/IntRangeDocValuesField.java    |  26 +-
 .../lucene/document/IntRangeSlowRangeQuery.java    |   6 +-
 .../lucene/document/LatLonDocValuesBoxQuery.java   |  88 ++--
 .../lucene/document/LatLonDocValuesField.java      | 167 +++++---
 .../LatLonDocValuesPointInGeometryQuery.java       |  60 +--
 .../org/apache/lucene/document/LatLonPoint.java    | 180 ++++----
 .../document/LatLonPointDistanceComparator.java    |  72 ++--
 .../document/LatLonPointDistanceFeatureQuery.java  | 321 +++++++++-----
 .../lucene/document/LatLonPointDistanceQuery.java  | 119 ++++--
 .../document/LatLonPointInGeometryQuery.java       | 158 ++++---
 .../lucene/document/LatLonPointSortField.java      |  15 +-
 .../org/apache/lucene/document/LatLonShape.java    | 140 +++---
 .../document/LatLonShapeBoundingBoxQuery.java      | 459 +++++++++++---------
 .../apache/lucene/document/LatLonShapeQuery.java   | 200 +++++----
 .../lucene/document/LongDistanceFeatureQuery.java  | 163 ++++---
 .../java/org/apache/lucene/document/LongPoint.java | 186 ++++----
 .../java/org/apache/lucene/document/LongRange.java | 117 +++--
 .../lucene/document/LongRangeDocValuesField.java   |  23 +-
 .../lucene/document/LongRangeSlowRangeQuery.java   |   7 +-
 .../lucene/document/NumericDocValuesField.java     |  66 ++-
 .../apache/lucene/document/RangeFieldQuery.java    | 319 +++++++++++---
 .../org/apache/lucene/document/ShapeField.java     | 147 ++++---
 .../org/apache/lucene/document/ShapeQuery.java     | 310 +++++++++-----
 .../lucene/document/SortedDocValuesField.java      |  68 ++-
 .../document/SortedNumericDocValuesField.java      |  79 ++--
 .../document/SortedNumericDocValuesRangeQuery.java |  68 +--
 .../lucene/document/SortedSetDocValuesField.java   |  72 ++--
 .../document/SortedSetDocValuesRangeQuery.java     |  80 ++--
 .../org/apache/lucene/document/StoredField.java    |  88 ++--
 .../org/apache/lucene/document/StringField.java    |  46 +-
 .../java/org/apache/lucene/document/TextField.java |  24 +-
 .../org/apache/lucene/document/VectorField.java    |  57 +--
 .../apache/lucene/document/XYDocValuesField.java   | 141 ++++---
 .../document/XYDocValuesPointInGeometryQuery.java  |  44 +-
 .../lucene/document/XYPointDistanceComparator.java |  43 +-
 .../org/apache/lucene/document/XYPointField.java   |  89 ++--
 .../lucene/document/XYPointInGeometryQuery.java    |  94 ++---
 .../apache/lucene/document/XYPointSortField.java   |  12 +-
 .../java/org/apache/lucene/document/XYShape.java   | 105 +++--
 .../org/apache/lucene/document/XYShapeQuery.java   | 177 ++++----
 .../org/apache/lucene/document/package-info.java   |  55 ++-
 .../lucene/document/BaseLatLonShapeTestCase.java   | 144 +++++--
 .../lucene/document/BaseShapeEncodingTestCase.java | 169 ++++++--
 .../apache/lucene/document/BaseShapeTestCase.java  | 275 +++++++-----
 .../lucene/document/BaseXYShapeTestCase.java       |  47 ++-
 .../apache/lucene/document/TestBinaryDocument.java |  37 +-
 .../org/apache/lucene/document/TestDateTools.java  | 104 ++---
 .../org/apache/lucene/document/TestDocument.java   | 164 +++----
 .../apache/lucene/document/TestDoubleRange.java    |   6 +-
 .../lucene/document/TestFeatureDoubleValues.java   | 109 ++---
 .../apache/lucene/document/TestFeatureField.java   |  77 ++--
 .../apache/lucene/document/TestFeatureSort.java    |  48 ++-
 .../test/org/apache/lucene/document/TestField.java | 251 ++++++-----
 .../org/apache/lucene/document/TestFieldType.java  |  40 +-
 .../org/apache/lucene/document/TestFloatRange.java |   8 +-
 .../lucene/document/TestInetAddressPoint.java      | 177 +++++---
 .../org/apache/lucene/document/TestIntRange.java   |   2 +-
 .../lucene/document/TestLatLonDocValuesField.java  |  10 +-
 .../document/TestLatLonLineShapeQueries.java       |  13 +-
 .../document/TestLatLonMultiLineShapeQueries.java  |  11 +-
 .../document/TestLatLonMultiPointShapeQueries.java |  11 +-
 .../TestLatLonMultiPolygonShapeQueries.java        |  16 +-
 .../apache/lucene/document/TestLatLonPoint.java    |  21 +-
 .../TestLatLonPointDistanceFeatureQuery.java       | 226 +++++++---
 .../document/TestLatLonPointDistanceSort.java      |  87 ++--
 .../document/TestLatLonPointShapeQueries.java      |  21 +-
 .../document/TestLatLonPolygonShapeQueries.java    |   5 +-
 .../apache/lucene/document/TestLatLonShape.java    | 469 ++++++++++++---------
 .../lucene/document/TestLatLonShapeEncoding.java   |   2 +-
 .../document/TestLongDistanceFeatureQuery.java     | 117 +++--
 .../org/apache/lucene/document/TestLongRange.java  |   2 +-
 .../lucene/document/TestXYLineShapeQueries.java    |  19 +-
 .../document/TestXYMultiLineShapeQueries.java      |  14 +-
 .../document/TestXYMultiPointShapeQueries.java     |   9 +-
 .../document/TestXYMultiPolygonShapeQueries.java   |  15 +-
 .../lucene/document/TestXYPointShapeQueries.java   |  23 +-
 .../lucene/document/TestXYPolygonShapeQueries.java |  13 +-
 .../org/apache/lucene/document/TestXYShape.java    |  54 ++-
 .../lucene/document/TestXYShapeEncoding.java       |   2 +-
 108 files changed, 6036 insertions(+), 4293 deletions(-)

diff --git a/gradle/validation/spotless.gradle b/gradle/validation/spotless.gradle
index 084b3e5..6e35970 100644
--- a/gradle/validation/spotless.gradle
+++ b/gradle/validation/spotless.gradle
@@ -25,8 +25,6 @@ allprojects { prj ->
   plugins.withType(JavaPlugin) {
     prj.apply plugin: 'com.diffplug.spotless'
 
-    println "case \"" + prj.path + '"'
-
     spotless {
       java {
         // TODO: work out how to have multiple different header files (we have
@@ -49,7 +47,7 @@ allprojects { prj ->
             target "src/**/org/apache/lucene/*.java",
                    "src/**/org/apache/lucene/analysis/**",
                    // "src/**/org/apache/lucene/codecs/**",
-                   // "src/**/org/apache/lucene/document/**",
+                   "src/**/org/apache/lucene/document/**",
                    "src/**/org/apache/lucene/geo/**",
                    "src/**/org/apache/lucene/index/**",
                    // "src/**/org/apache/lucene/search/**",
diff --git a/lucene/core/src/java/org/apache/lucene/document/BinaryDocValuesField.java b/lucene/core/src/java/org/apache/lucene/document/BinaryDocValuesField.java
index 94093b2..ffebe97 100644
--- a/lucene/core/src/java/org/apache/lucene/document/BinaryDocValuesField.java
+++ b/lucene/core/src/java/org/apache/lucene/document/BinaryDocValuesField.java
@@ -21,36 +21,33 @@ import org.apache.lucene.index.DocValuesType;
 import org.apache.lucene.util.BytesRef;
 
 /**
- * Field that stores a per-document {@link BytesRef} value.  
- * <p>
- * The values are stored directly with no sharing, which is a good fit when
- * the fields don't share (many) values, such as a title field.  If values 
- * may be shared and sorted it's better to use {@link SortedDocValuesField}.  
- * Here's an example usage:
- * 
+ * Field that stores a per-document {@link BytesRef} value.
+ *
+ * <p>The values are stored directly with no sharing, which is a good fit when the fields don't
+ * share (many) values, such as a title field. If values may be shared and sorted it's better to use
+ * {@link SortedDocValuesField}. Here's an example usage:
+ *
  * <pre class="prettyprint">
  *   document.add(new BinaryDocValuesField(name, new BytesRef("hello")));
  * </pre>
- * 
- * <p>
- * If you also need to store the value, you should add a
- * separate {@link StoredField} instance.
- * 
+ *
+ * <p>If you also need to store the value, you should add a separate {@link StoredField} instance.
+ *
  * @see BinaryDocValues
- * */
+ */
 public class BinaryDocValuesField extends Field {
-  
-  /**
-   * Type for straight bytes DocValues.
-   */
+
+  /** Type for straight bytes DocValues. */
   public static final FieldType TYPE = new FieldType();
+
   static {
     TYPE.setDocValuesType(DocValuesType.BINARY);
     TYPE.freeze();
   }
-  
+
   /**
    * Create a new binary DocValues field.
+   *
    * @param name field name
    * @param value binary content
    * @throws IllegalArgumentException if the field name is null
diff --git a/lucene/core/src/java/org/apache/lucene/document/BinaryPoint.java b/lucene/core/src/java/org/apache/lucene/document/BinaryPoint.java
index dd47f59..cede07c 100644
--- a/lucene/core/src/java/org/apache/lucene/document/BinaryPoint.java
+++ b/lucene/core/src/java/org/apache/lucene/document/BinaryPoint.java
@@ -18,7 +18,6 @@ package org.apache.lucene.document;
 
 import java.util.Arrays;
 import java.util.Comparator;
-
 import org.apache.lucene.index.IndexableFieldType;
 import org.apache.lucene.index.PointValues;
 import org.apache.lucene.search.MatchNoDocsQuery;
@@ -27,21 +26,24 @@ import org.apache.lucene.search.PointRangeQuery;
 import org.apache.lucene.search.Query;
 import org.apache.lucene.util.BytesRef;
 
-/** 
- * An indexed binary field for fast range filters.  If you also
- * need to store the value, you should add a separate {@link StoredField} instance.
- * <p>
- * Finding all documents within an N-dimensional shape or range at search time is
- * efficient.  Multiple values for the same field in one document
- * is allowed.
- * <p>
- * This field defines static factory methods for creating common queries:
+/**
+ * An indexed binary field for fast range filters. If you also need to store the value, you should
+ * add a separate {@link StoredField} instance.
+ *
+ * <p>Finding all documents within an N-dimensional shape or range at search time is efficient.
+ * Multiple values for the same field in one document is allowed.
+ *
+ * <p>This field defines static factory methods for creating common queries:
+ *
  * <ul>
  *   <li>{@link #newExactQuery(String, byte[])} for matching an exact 1D point.
- *   <li>{@link #newSetQuery(String, byte[][]) newSetQuery(String, byte[]...)} for matching a set of 1D values.
+ *   <li>{@link #newSetQuery(String, byte[][]) newSetQuery(String, byte[]...)} for matching a set of
+ *       1D values.
  *   <li>{@link #newRangeQuery(String, byte[], byte[])} for matching a 1D range.
- *   <li>{@link #newRangeQuery(String, byte[][], byte[][])} for matching points/ranges in n-dimensional space.
- * </ul> 
+ *   <li>{@link #newRangeQuery(String, byte[][], byte[][])} for matching points/ranges in
+ *       n-dimensional space.
+ * </ul>
+ *
  * @see PointValues
  */
 public final class BinaryPoint extends Field {
@@ -54,7 +56,7 @@ public final class BinaryPoint extends Field {
       throw new IllegalArgumentException("point must not be 0 dimensions");
     }
     int bytesPerDim = -1;
-    for(int i=0;i<point.length;i++) {
+    for (int i = 0; i < point.length; i++) {
       byte[] oneDim = point[i];
       if (oneDim == null) {
         throw new IllegalArgumentException("point must not have null values");
@@ -65,7 +67,11 @@ public final class BinaryPoint extends Field {
       if (bytesPerDim == -1) {
         bytesPerDim = oneDim.length;
       } else if (bytesPerDim != oneDim.length) {
-        throw new IllegalArgumentException("all dimensions must have same bytes length; got " + bytesPerDim + " and " + oneDim.length);
+        throw new IllegalArgumentException(
+            "all dimensions must have same bytes length; got "
+                + bytesPerDim
+                + " and "
+                + oneDim.length);
       }
     }
     return getType(point.length, bytesPerDim);
@@ -89,7 +95,7 @@ public final class BinaryPoint extends Field {
       return new BytesRef(point[0]);
     }
     int bytesPerDim = -1;
-    for(byte[] dim : point) {
+    for (byte[] dim : point) {
       if (dim == null) {
         throw new IllegalArgumentException("point must not have null values");
       }
@@ -99,22 +105,27 @@ public final class BinaryPoint extends Field {
         }
         bytesPerDim = dim.length;
       } else if (dim.length != bytesPerDim) {
-        throw new IllegalArgumentException("all dimensions must have same bytes length; got " + bytesPerDim + " and " + dim.length);
+        throw new IllegalArgumentException(
+            "all dimensions must have same bytes length; got "
+                + bytesPerDim
+                + " and "
+                + dim.length);
       }
     }
-    byte[] packed = new byte[bytesPerDim*point.length];
-    for(int i=0;i<point.length;i++) {
-      System.arraycopy(point[i], 0, packed, i*bytesPerDim, bytesPerDim);
+    byte[] packed = new byte[bytesPerDim * point.length];
+    for (int i = 0; i < point.length; i++) {
+      System.arraycopy(point[i], 0, packed, i * bytesPerDim, bytesPerDim);
     }
     return new BytesRef(packed);
   }
 
-  /** General purpose API: creates a new BinaryPoint, indexing the
-   *  provided N-dimensional binary point.
+  /**
+   * General purpose API: creates a new BinaryPoint, indexing the provided N-dimensional binary
+   * point.
    *
-   *  @param name field name
-   *  @param point byte[][] value
-   *  @throws IllegalArgumentException if the field name or value is null.
+   * @param name field name
+   * @param point byte[][] value
+   * @throws IllegalArgumentException if the field name or value is null.
    */
   public BinaryPoint(String name, byte[]... point) {
     super(name, pack(point), getType(point));
@@ -124,17 +135,23 @@ public final class BinaryPoint extends Field {
   public BinaryPoint(String name, byte[] packedPoint, IndexableFieldType type) {
     super(name, packedPoint, type);
     if (packedPoint.length != type.pointDimensionCount() * type.pointNumBytes()) {
-      throw new IllegalArgumentException("packedPoint is length=" + packedPoint.length + " but type.pointDimensionCount()=" + type.pointDimensionCount() + " and type.pointNumBytes()=" + type.pointNumBytes());
+      throw new IllegalArgumentException(
+          "packedPoint is length="
+              + packedPoint.length
+              + " but type.pointDimensionCount()="
+              + type.pointDimensionCount()
+              + " and type.pointNumBytes()="
+              + type.pointNumBytes());
     }
   }
-  
+
   // static methods for generating queries
 
-  /** 
+  /**
    * Create a query for matching an exact binary value.
-   * <p>
-   * This is for simple one-dimension points, for multidimensional points use
-   * {@link #newRangeQuery(String, byte[][], byte[][])} instead.
+   *
+   * <p>This is for simple one-dimension points, for multidimensional points use {@link
+   * #newRangeQuery(String, byte[][], byte[][])} instead.
    *
    * @param field field name. must not be {@code null}.
    * @param value binary value
@@ -145,36 +162,37 @@ public final class BinaryPoint extends Field {
     return newRangeQuery(field, value, value);
   }
 
-  /** 
+  /**
    * Create a range query for binary values.
-   * <p>
-   * This is for simple one-dimension ranges, for multidimensional ranges use
-   * {@link #newRangeQuery(String, byte[][], byte[][])} instead.
+   *
+   * <p>This is for simple one-dimension ranges, for multidimensional ranges use {@link
+   * #newRangeQuery(String, byte[][], byte[][])} instead.
    *
    * @param field field name. must not be {@code null}.
    * @param lowerValue lower portion of the range (inclusive). must not be {@code null}
    * @param upperValue upper portion of the range (inclusive). must not be {@code null}
-   * @throws IllegalArgumentException if {@code field} is null, if {@code lowerValue} is null,
-   *                                  or if {@code upperValue} is null
+   * @throws IllegalArgumentException if {@code field} is null, if {@code lowerValue} is null, or if
+   *     {@code upperValue} is null
    * @return a query matching documents within this range.
    */
   public static Query newRangeQuery(String field, byte[] lowerValue, byte[] upperValue) {
     PointRangeQuery.checkArgs(field, lowerValue, upperValue);
     return newRangeQuery(field, new byte[][] {lowerValue}, new byte[][] {upperValue});
   }
-  
-  /** 
+
+  /**
    * Create a range query for n-dimensional binary values.
    *
    * @param field field name. must not be {@code null}.
    * @param lowerValue lower portion of the range (inclusive). must not be null.
    * @param upperValue upper portion of the range (inclusive). must not be null.
-   * @throws IllegalArgumentException if {@code field} is null, if {@code lowerValue} is null, if {@code upperValue} is null, 
-   *                                  or if {@code lowerValue.length != upperValue.length}
+   * @throws IllegalArgumentException if {@code field} is null, if {@code lowerValue} is null, if
+   *     {@code upperValue} is null, or if {@code lowerValue.length != upperValue.length}
    * @return a query matching documents within this range.
    */
   public static Query newRangeQuery(String field, byte[][] lowerValue, byte[][] upperValue) {
-    return new PointRangeQuery(field, pack(lowerValue).bytes, pack(upperValue).bytes, lowerValue.length) {
+    return new PointRangeQuery(
+        field, pack(lowerValue).bytes, pack(upperValue).bytes, lowerValue.length) {
       @Override
       protected String toString(int dimension, byte[] value) {
         assert value != null;
@@ -193,8 +211,9 @@ public final class BinaryPoint extends Field {
   }
 
   /**
-   * Create a query matching any of the specified 1D values.  This is the points equivalent of {@code TermsQuery}.
-   * 
+   * Create a query matching any of the specified 1D values. This is the points equivalent of {@code
+   * TermsQuery}.
+   *
    * @param field field name. must not be {@code null}.
    * @param values all values to match
    */
@@ -202,47 +221,53 @@ public final class BinaryPoint extends Field {
 
     // Make sure all byte[] have the same length
     int bytesPerDim = -1;
-    for(byte[] value : values) {
+    for (byte[] value : values) {
       if (bytesPerDim == -1) {
         bytesPerDim = value.length;
       } else if (value.length != bytesPerDim) {
-        throw new IllegalArgumentException("all byte[] must be the same length, but saw " + bytesPerDim + " and " + value.length);
+        throw new IllegalArgumentException(
+            "all byte[] must be the same length, but saw " + bytesPerDim + " and " + value.length);
       }
     }
 
     if (bytesPerDim == -1) {
-      // There are no points, and we cannot guess the bytesPerDim here, so we return an equivalent query:
+      // There are no points, and we cannot guess the bytesPerDim here, so we return an equivalent
+      // query:
       return new MatchNoDocsQuery("empty BinaryPoint.newSetQuery");
     }
 
     // Don't unexpectedly change the user's incoming values array:
     byte[][] sortedValues = values.clone();
-    Arrays.sort(sortedValues,
-                new Comparator<byte[]>() {
-                  @Override
-                  public int compare(byte[] a, byte[] b) {
-                    return Arrays.compareUnsigned(a, 0, a.length, b, 0, b.length);
-                  }
-                });
+    Arrays.sort(
+        sortedValues,
+        new Comparator<byte[]>() {
+          @Override
+          public int compare(byte[] a, byte[] b) {
+            return Arrays.compareUnsigned(a, 0, a.length, b, 0, b.length);
+          }
+        });
 
     final BytesRef encoded = new BytesRef(new byte[bytesPerDim]);
-    
-    return new PointInSetQuery(field, 1, bytesPerDim,
-                               new PointInSetQuery.Stream() {
-
-                                 int upto;
-
-                                 @Override
-                                 public BytesRef next() {
-                                   if (upto == sortedValues.length) {
-                                     return null;
-                                   } else {
-                                     encoded.bytes = sortedValues[upto];
-                                     upto++;
-                                     return encoded;
-                                   }
-                                 }
-                               }) {
+
+    return new PointInSetQuery(
+        field,
+        1,
+        bytesPerDim,
+        new PointInSetQuery.Stream() {
+
+          int upto;
+
+          @Override
+          public BytesRef next() {
+            if (upto == sortedValues.length) {
+              return null;
+            } else {
+              encoded.bytes = sortedValues[upto];
+              upto++;
+              return encoded;
+            }
+          }
+        }) {
       @Override
       protected String toString(byte[] value) {
         return new BytesRef(value).toString();
diff --git a/lucene/core/src/java/org/apache/lucene/document/BinaryRangeDocValues.java b/lucene/core/src/java/org/apache/lucene/document/BinaryRangeDocValues.java
index d5e511f..e057e1d 100644
--- a/lucene/core/src/java/org/apache/lucene/document/BinaryRangeDocValues.java
+++ b/lucene/core/src/java/org/apache/lucene/document/BinaryRangeDocValues.java
@@ -18,7 +18,6 @@
 package org.apache.lucene.document;
 
 import java.io.IOException;
-
 import org.apache.lucene.index.BinaryDocValues;
 import org.apache.lucene.util.BytesRef;
 
@@ -90,7 +89,9 @@ class BinaryRangeDocValues extends BinaryDocValues {
     BytesRef bytesRef = in.binaryValue();
 
     // We reuse the existing allocated memory for packed values since all docvalues in this iterator
-    // should be exactly same in indexed structure, hence the byte representations in length should be identical
-    System.arraycopy(bytesRef.bytes, bytesRef.offset, packedValue, 0, 2 * numDims * numBytesPerDimension);
+    // should be exactly same in indexed structure, hence the byte representations in length should
+    // be identical
+    System.arraycopy(
+        bytesRef.bytes, bytesRef.offset, packedValue, 0, 2 * numDims * numBytesPerDimension);
   }
 }
diff --git a/lucene/core/src/java/org/apache/lucene/document/BinaryRangeDocValuesField.java b/lucene/core/src/java/org/apache/lucene/document/BinaryRangeDocValuesField.java
index 1d0504a..999aa8d 100644
--- a/lucene/core/src/java/org/apache/lucene/document/BinaryRangeDocValuesField.java
+++ b/lucene/core/src/java/org/apache/lucene/document/BinaryRangeDocValuesField.java
@@ -20,13 +20,14 @@ package org.apache.lucene.document;
 import org.apache.lucene.util.BytesRef;
 
 abstract class BinaryRangeDocValuesField extends BinaryDocValuesField {
-  
+
   final String field;
   final byte[] packedValue;
   final int numDims;
   final int numBytesPerDimension;
 
-  BinaryRangeDocValuesField(String field, byte[] packedValue, int numDims, int numBytesPerDimension) {
+  BinaryRangeDocValuesField(
+      String field, byte[] packedValue, int numDims, int numBytesPerDimension) {
     super(field, new BytesRef(packedValue));
     this.field = field;
     this.packedValue = packedValue;
diff --git a/lucene/core/src/java/org/apache/lucene/document/BinaryRangeFieldRangeQuery.java b/lucene/core/src/java/org/apache/lucene/document/BinaryRangeFieldRangeQuery.java
index 9134bb0..f5ceb64 100644
--- a/lucene/core/src/java/org/apache/lucene/document/BinaryRangeFieldRangeQuery.java
+++ b/lucene/core/src/java/org/apache/lucene/document/BinaryRangeFieldRangeQuery.java
@@ -20,7 +20,6 @@ package org.apache.lucene.document;
 import java.io.IOException;
 import java.util.Arrays;
 import java.util.Objects;
-
 import org.apache.lucene.index.BinaryDocValues;
 import org.apache.lucene.index.DocValues;
 import org.apache.lucene.index.IndexReader;
@@ -43,15 +42,20 @@ abstract class BinaryRangeFieldRangeQuery extends Query {
   private final int numDims;
   private final RangeFieldQuery.QueryType queryType;
 
-  BinaryRangeFieldRangeQuery(String field, byte[] queryPackedValue, int numBytesPerDimension, int numDims,
-                             RangeFieldQuery.QueryType queryType) {
+  BinaryRangeFieldRangeQuery(
+      String field,
+      byte[] queryPackedValue,
+      int numBytesPerDimension,
+      int numDims,
+      RangeFieldQuery.QueryType queryType) {
     this.field = field;
     this.queryPackedValue = queryPackedValue;
     this.numBytesPerDimension = numBytesPerDimension;
     this.numDims = numDims;
 
     if (!(queryType == RangeFieldQuery.QueryType.INTERSECTS)) {
-      throw new UnsupportedOperationException("INTERSECTS is the only query type supported for this field type right now");
+      throw new UnsupportedOperationException(
+          "INTERSECTS is the only query type supported for this field type right now");
     }
 
     this.queryType = queryType;
@@ -93,9 +97,9 @@ abstract class BinaryRangeFieldRangeQuery extends Query {
     return new BinaryRangeDocValues(binaryDocValues, numDims, numBytesPerDimension);
   }
 
-
   @Override
-  public Weight createWeight(IndexSearcher searcher, ScoreMode scoreMode, float boost) throws IOException {
+  public Weight createWeight(IndexSearcher searcher, ScoreMode scoreMode, float boost)
+      throws IOException {
     return new ConstantScoreWeight(this, boost) {
 
       @Override
@@ -106,17 +110,19 @@ abstract class BinaryRangeFieldRangeQuery extends Query {
         }
 
         final TwoPhaseIterator iterator;
-        iterator = new TwoPhaseIterator(values) {
-          @Override
-          public boolean matches() {
-            return queryType.matches(queryPackedValue, values.getPackedValue(), numDims, numBytesPerDimension);
-          }
-
-          @Override
-          public float matchCost() {
-            return queryPackedValue.length;
-          }
-        };
+        iterator =
+            new TwoPhaseIterator(values) {
+              @Override
+              public boolean matches() {
+                return queryType.matches(
+                    queryPackedValue, values.getPackedValue(), numDims, numBytesPerDimension);
+              }
+
+              @Override
+              public float matchCost() {
+                return queryPackedValue.length;
+              }
+            };
 
         return new ConstantScoreScorer(this, score(), scoreMode, iterator);
       }
@@ -125,7 +131,6 @@ abstract class BinaryRangeFieldRangeQuery extends Query {
       public boolean isCacheable(LeafReaderContext ctx) {
         return DocValues.isCacheable(ctx, field);
       }
-
     };
   }
 }
diff --git a/lucene/core/src/java/org/apache/lucene/document/DateTools.java b/lucene/core/src/java/org/apache/lucene/document/DateTools.java
index e7ac4c5..49e404b 100644
--- a/lucene/core/src/java/org/apache/lucene/document/DateTools.java
+++ b/lucene/core/src/java/org/apache/lucene/document/DateTools.java
@@ -16,69 +16,64 @@
  */
 package org.apache.lucene.document;
 
-
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.Calendar;
 import java.util.Date;
 import java.util.Locale;
 import java.util.TimeZone;
-
 import org.apache.lucene.search.PrefixQuery;
 import org.apache.lucene.search.TermRangeQuery;
 
 /**
- * Provides support for converting dates to strings and vice-versa.
- * The strings are structured so that lexicographic sorting orders 
- * them by date, which makes them suitable for use as field values 
+ * Provides support for converting dates to strings and vice-versa. The strings are structured so
+ * that lexicographic sorting orders them by date, which makes them suitable for use as field values
  * and search terms.
- * 
- * <P>This class also helps you to limit the resolution of your dates. Do not
- * save dates with a finer resolution than you really need, as then
- * {@link TermRangeQuery} and {@link PrefixQuery} will require more memory and become slower.
- * 
- * <P>
- * Another approach is {@link LongPoint}, which indexes the
- * values in sorted order.
- * For indexing a {@link Date} or {@link Calendar}, just get the unix timestamp as
- * <code>long</code> using {@link Date#getTime} or {@link Calendar#getTimeInMillis} and
- * index this as a numeric value with {@link LongPoint}
- * and use {@link org.apache.lucene.search.PointRangeQuery} to query it.
+ *
+ * <p>This class also helps you to limit the resolution of your dates. Do not save dates with a
+ * finer resolution than you really need, as then {@link TermRangeQuery} and {@link PrefixQuery}
+ * will require more memory and become slower.
+ *
+ * <p>Another approach is {@link LongPoint}, which indexes the values in sorted order. For indexing
+ * a {@link Date} or {@link Calendar}, just get the unix timestamp as <code>long</code> using {@link
+ * Date#getTime} or {@link Calendar#getTimeInMillis} and index this as a numeric value with {@link
+ * LongPoint} and use {@link org.apache.lucene.search.PointRangeQuery} to query it.
  */
 public class DateTools {
-  
-  final static TimeZone GMT = TimeZone.getTimeZone("GMT");
 
-  private static final ThreadLocal<Calendar> TL_CAL = new ThreadLocal<Calendar>() {
-    @Override
-    protected Calendar initialValue() {
-      return Calendar.getInstance(GMT, Locale.ROOT);
-    }
-  };
-
-  //indexed by format length
-  private static final ThreadLocal<SimpleDateFormat[]> TL_FORMATS = new ThreadLocal<SimpleDateFormat[]>() {
-    @Override
-    protected SimpleDateFormat[] initialValue() {
-      SimpleDateFormat[] arr = new SimpleDateFormat[Resolution.MILLISECOND.formatLen+1];
-      for (Resolution resolution : Resolution.values()) {
-        arr[resolution.formatLen] = (SimpleDateFormat)resolution.format.clone();
-      }
-      return arr;
-    }
-  };
+  static final TimeZone GMT = TimeZone.getTimeZone("GMT");
+
+  private static final ThreadLocal<Calendar> TL_CAL =
+      new ThreadLocal<Calendar>() {
+        @Override
+        protected Calendar initialValue() {
+          return Calendar.getInstance(GMT, Locale.ROOT);
+        }
+      };
+
+  // indexed by format length
+  private static final ThreadLocal<SimpleDateFormat[]> TL_FORMATS =
+      new ThreadLocal<SimpleDateFormat[]>() {
+        @Override
+        protected SimpleDateFormat[] initialValue() {
+          SimpleDateFormat[] arr = new SimpleDateFormat[Resolution.MILLISECOND.formatLen + 1];
+          for (Resolution resolution : Resolution.values()) {
+            arr[resolution.formatLen] = (SimpleDateFormat) resolution.format.clone();
+          }
+          return arr;
+        }
+      };
 
   // cannot create, the class has static methods only
   private DateTools() {}
 
   /**
    * Converts a Date to a string suitable for indexing.
-   * 
+   *
    * @param date the date to be converted
-   * @param resolution the desired resolution, see
-   *  {@link #round(Date, DateTools.Resolution)}
-   * @return a string in format <code>yyyyMMddHHmmssSSS</code> or shorter,
-   *  depending on <code>resolution</code>; using GMT as timezone 
+   * @param resolution the desired resolution, see {@link #round(Date, DateTools.Resolution)}
+   * @return a string in format <code>yyyyMMddHHmmssSSS</code> or shorter, depending on <code>
+   *     resolution</code>; using GMT as timezone
    */
   public static String dateToString(Date date, Resolution resolution) {
     return timeToString(date.getTime(), resolution);
@@ -86,41 +81,36 @@ public class DateTools {
 
   /**
    * Converts a millisecond time to a string suitable for indexing.
-   * 
+   *
    * @param time the date expressed as milliseconds since January 1, 1970, 00:00:00 GMT
-   * @param resolution the desired resolution, see
-   *  {@link #round(long, DateTools.Resolution)}
-   * @return a string in format <code>yyyyMMddHHmmssSSS</code> or shorter,
-   *  depending on <code>resolution</code>; using GMT as timezone
+   * @param resolution the desired resolution, see {@link #round(long, DateTools.Resolution)}
+   * @return a string in format <code>yyyyMMddHHmmssSSS</code> or shorter, depending on <code>
+   *     resolution</code>; using GMT as timezone
    */
   public static String timeToString(long time, Resolution resolution) {
     final Date date = new Date(round(time, resolution));
     return TL_FORMATS.get()[resolution.formatLen].format(date);
   }
-  
+
   /**
-   * Converts a string produced by <code>timeToString</code> or
-   * <code>dateToString</code> back to a time, represented as the
-   * number of milliseconds since January 1, 1970, 00:00:00 GMT.
-   * 
+   * Converts a string produced by <code>timeToString</code> or <code>dateToString</code> back to a
+   * time, represented as the number of milliseconds since January 1, 1970, 00:00:00 GMT.
+   *
    * @param dateString the date string to be converted
    * @return the number of milliseconds since January 1, 1970, 00:00:00 GMT
-   * @throws ParseException if <code>dateString</code> is not in the 
-   *  expected format 
+   * @throws ParseException if <code>dateString</code> is not in the expected format
    */
   public static long stringToTime(String dateString) throws ParseException {
     return stringToDate(dateString).getTime();
   }
 
   /**
-   * Converts a string produced by <code>timeToString</code> or
-   * <code>dateToString</code> back to a time, represented as a
-   * Date object.
-   * 
+   * Converts a string produced by <code>timeToString</code> or <code>dateToString</code> back to a
+   * time, represented as a Date object.
+   *
    * @param dateString the date string to be converted
-   * @return the parsed time as a Date object 
-   * @throws ParseException if <code>dateString</code> is not in the 
-   *  expected format 
+   * @return the parsed time as a Date object
+   * @throws ParseException if <code>dateString</code> is not in the expected format
    */
   public static Date stringToDate(String dateString) throws ParseException {
     try {
@@ -129,37 +119,34 @@ public class DateTools {
       throw new ParseException("Input is not a valid date string: " + dateString, 0);
     }
   }
-  
+
   /**
-   * Limit a date's resolution. For example, the date <code>2004-09-21 13:50:11</code>
-   * will be changed to <code>2004-09-01 00:00:00</code> when using
-   * <code>Resolution.MONTH</code>. 
-   * 
+   * Limit a date's resolution. For example, the date <code>2004-09-21 13:50:11</code> will be
+   * changed to <code>2004-09-01 00:00:00</code> when using <code>Resolution.MONTH</code>.
+   *
    * @param resolution The desired resolution of the date to be returned
-   * @return the date with all values more precise than <code>resolution</code>
-   *  set to 0 or 1
+   * @return the date with all values more precise than <code>resolution</code> set to 0 or 1
    */
   public static Date round(Date date, Resolution resolution) {
     return new Date(round(date.getTime(), resolution));
   }
-  
+
   /**
-   * Limit a date's resolution. For example, the date <code>1095767411000</code>
-   * (which represents 2004-09-21 13:50:11) will be changed to 
-   * <code>1093989600000</code> (2004-09-01 00:00:00) when using
-   * <code>Resolution.MONTH</code>.
-   * 
+   * Limit a date's resolution. For example, the date <code>1095767411000</code> (which represents
+   * 2004-09-21 13:50:11) will be changed to <code>1093989600000</code> (2004-09-01 00:00:00) when
+   * using <code>Resolution.MONTH</code>.
+   *
    * @param resolution The desired resolution of the date to be returned
-   * @return the date with all values more precise than <code>resolution</code>
-   *  set to 0 or 1, expressed as milliseconds since January 1, 1970, 00:00:00 GMT
+   * @return the date with all values more precise than <code>resolution</code> set to 0 or 1,
+   *     expressed as milliseconds since January 1, 1970, 00:00:00 GMT
    */
   @SuppressWarnings("fallthrough")
   public static long round(long time, Resolution resolution) {
     final Calendar calInstance = TL_CAL.get();
     calInstance.setTimeInMillis(time);
-    
+
     switch (resolution) {
-      //NOTE: switch statement fall-through is deliberate
+        // NOTE: switch statement fall-through is deliberate
       case YEAR:
         calInstance.set(Calendar.MONTH, 0);
       case MONTH:
@@ -183,40 +170,37 @@ public class DateTools {
 
   /** Specifies the time granularity. */
   public static enum Resolution {
-    
+
     /** Limit a date's resolution to year granularity. */
-    YEAR(4), 
+    YEAR(4),
     /** Limit a date's resolution to month granularity. */
-    MONTH(6), 
+    MONTH(6),
     /** Limit a date's resolution to day granularity. */
-    DAY(8), 
+    DAY(8),
     /** Limit a date's resolution to hour granularity. */
-    HOUR(10), 
+    HOUR(10),
     /** Limit a date's resolution to minute granularity. */
-    MINUTE(12), 
+    MINUTE(12),
     /** Limit a date's resolution to second granularity. */
-    SECOND(14), 
+    SECOND(14),
     /** Limit a date's resolution to millisecond granularity. */
     MILLISECOND(17);
 
     final int formatLen;
-    final SimpleDateFormat format;//should be cloned before use, since it's not threadsafe
+    final SimpleDateFormat format; // should be cloned before use, since it's not threadsafe
 
     Resolution(int formatLen) {
       this.formatLen = formatLen;
       // formatLen 10's place:                     11111111
       // formatLen  1's place:            12345678901234567
-      this.format = new SimpleDateFormat("yyyyMMddHHmmssSSS".substring(0,formatLen),Locale.ROOT);
+      this.format = new SimpleDateFormat("yyyyMMddHHmmssSSS".substring(0, formatLen), Locale.ROOT);
       this.format.setTimeZone(GMT);
     }
 
-    /** this method returns the name of the resolution
-     * in lowercase (for backwards compatibility) */
+    /** this method returns the name of the resolution in lowercase (for backwards compatibility) */
     @Override
     public String toString() {
       return super.toString().toLowerCase(Locale.ROOT);
     }
-
   }
-
 }
diff --git a/lucene/core/src/java/org/apache/lucene/document/Document.java b/lucene/core/src/java/org/apache/lucene/document/Document.java
index 2f44444..57061e2 100644
--- a/lucene/core/src/java/org/apache/lucene/document/Document.java
+++ b/lucene/core/src/java/org/apache/lucene/document/Document.java
@@ -16,63 +16,59 @@
  */
 package org.apache.lucene.document;
 
-
 import java.util.*;
-
-import org.apache.lucene.index.IndexReader;  // for javadoc
+import org.apache.lucene.index.IndexReader; // for javadoc
 import org.apache.lucene.index.IndexableField;
-import org.apache.lucene.search.IndexSearcher;  // for javadoc
+import org.apache.lucene.search.IndexSearcher; // for javadoc
 import org.apache.lucene.search.ScoreDoc; // for javadoc
 import org.apache.lucene.util.BytesRef;
 
-/** Documents are the unit of indexing and search.
+/**
+ * Documents are the unit of indexing and search.
  *
- * A Document is a set of fields.  Each field has a name and a textual value.
- * A field may be {@link org.apache.lucene.index.IndexableFieldType#stored() stored} with the document, in which
- * case it is returned with search hits on the document.  Thus each document
- * should typically contain one or more stored fields which uniquely identify
- * it.
+ * <p>A Document is a set of fields. Each field has a name and a textual value. A field may be
+ * {@link org.apache.lucene.index.IndexableFieldType#stored() stored} with the document, in which
+ * case it is returned with search hits on the document. Thus each document should typically contain
+ * one or more stored fields which uniquely identify it.
  *
- * <p>Note that fields which are <i>not</i> {@link org.apache.lucene.index.IndexableFieldType#stored() stored} are
- * <i>not</i> available in documents retrieved from the index, e.g. with {@link
- * ScoreDoc#doc} or {@link IndexReader#document(int)}.
+ * <p>Note that fields which are <i>not</i> {@link
+ * org.apache.lucene.index.IndexableFieldType#stored() stored} are <i>not</i> available in documents
+ * retrieved from the index, e.g. with {@link ScoreDoc#doc} or {@link IndexReader#document(int)}.
  */
-
 public final class Document implements Iterable<IndexableField> {
 
   private final List<IndexableField> fields = new ArrayList<>();
 
   /** Constructs a new document with no fields. */
   public Document() {}
-  
+
   @Override
   public Iterator<IndexableField> iterator() {
     return fields.iterator();
   }
 
   /**
-   * <p>Adds a field to a document.  Several fields may be added with
-   * the same name.  In this case, if the fields are indexed, their text is
-   * treated as though appended for the purposes of search.</p>
-   * <p> Note that add like the removeField(s) methods only makes sense 
-   * prior to adding a document to an index. These methods cannot
-   * be used to change the content of an existing index! In order to achieve this,
-   * a document has to be deleted from an index and a new changed version of that
-   * document has to be added.</p>
+   * Adds a field to a document. Several fields may be added with the same name. In this case, if
+   * the fields are indexed, their text is treated as though appended for the purposes of search.
+   *
+   * <p>Note that add like the removeField(s) methods only makes sense prior to adding a document to
+   * an index. These methods cannot be used to change the content of an existing index! In order to
+   * achieve this, a document has to be deleted from an index and a new changed version of that
+   * document has to be added.
    */
   public final void add(IndexableField field) {
     fields.add(field);
   }
-  
+
   /**
-   * <p>Removes field with the specified name from the document.
-   * If multiple fields exist with this name, this method removes the first field that has been added.
-   * If there is no field with the specified name, the document remains unchanged.</p>
-   * <p> Note that the removeField(s) methods like the add method only make sense 
-   * prior to adding a document to an index. These methods cannot
-   * be used to change the content of an existing index! In order to achieve this,
-   * a document has to be deleted from an index and a new changed version of that
-   * document has to be added.</p>
+   * Removes field with the specified name from the document. If multiple fields exist with this
+   * name, this method removes the first field that has been added. If there is no field with the
+   * specified name, the document remains unchanged.
+   *
+   * <p>Note that the removeField(s) methods like the add method only make sense prior to adding a
+   * document to an index. These methods cannot be used to change the content of an existing index!
+   * In order to achieve this, a document has to be deleted from an index and a new changed version
+   * of that document has to be added.
    */
   public final void removeField(String name) {
     Iterator<IndexableField> it = fields.iterator();
@@ -84,15 +80,15 @@ public final class Document implements Iterable<IndexableField> {
       }
     }
   }
-  
+
   /**
-   * <p>Removes all fields with the given name from the document.
-   * If there is no field with the specified name, the document remains unchanged.</p>
-   * <p> Note that the removeField(s) methods like the add method only make sense 
-   * prior to adding a document to an index. These methods cannot
-   * be used to change the content of an existing index! In order to achieve this,
-   * a document has to be deleted from an index and a new changed version of that
-   * document has to be added.</p>
+   * Removes all fields with the given name from the document. If there is no field with the
+   * specified name, the document remains unchanged.
+   *
+   * <p>Note that the removeField(s) methods like the add method only make sense prior to adding a
+   * document to an index. These methods cannot be used to change the content of an existing index!
+   * In order to achieve this, a document has to be deleted from an index and a new changed version
+   * of that document has to be added.
    */
   public final void removeFields(String name) {
     Iterator<IndexableField> it = fields.iterator();
@@ -104,16 +100,14 @@ public final class Document implements Iterable<IndexableField> {
     }
   }
 
-
   /**
-  * Returns an array of byte arrays for of the fields that have the name specified
-  * as the method parameter.  This method returns an empty
-  * array when there are no matching fields.  It never
-  * returns null.
-  *
-  * @param name the name of the field
-  * @return a <code>BytesRef[]</code> of binary field values
-  */
+   * Returns an array of byte arrays for of the fields that have the name specified as the method
+   * parameter. This method returns an empty array when there are no matching fields. It never
+   * returns null.
+   *
+   * @param name the name of the field
+   * @return a <code>BytesRef[]</code> of binary field values
+   */
   public final BytesRef[] getBinaryValues(String name) {
     final List<BytesRef> result = new ArrayList<>();
     for (IndexableField field : fields) {
@@ -124,19 +118,18 @@ public final class Document implements Iterable<IndexableField> {
         }
       }
     }
-  
+
     return result.toArray(new BytesRef[result.size()]);
   }
-  
+
   /**
-  * Returns an array of bytes for the first (or only) field that has the name
-  * specified as the method parameter. This method will return <code>null</code>
-  * if no binary fields with the specified name are available.
-  * There may be non-binary fields with the same name.
-  *
-  * @param name the name of the field.
-  * @return a <code>BytesRef</code> containing the binary field value or <code>null</code>
-  */
+   * Returns an array of bytes for the first (or only) field that has the name specified as the
+   * method parameter. This method will return <code>null</code> if no binary fields with the
+   * specified name are available. There may be non-binary fields with the same name.
+   *
+   * @param name the name of the field.
+   * @return a <code>BytesRef</code> containing the binary field value or <code>null</code>
+   */
   public final BytesRef getBinaryValue(String name) {
     for (IndexableField field : fields) {
       if (field.name().equals(name)) {
@@ -149,9 +142,9 @@ public final class Document implements Iterable<IndexableField> {
     return null;
   }
 
-  /** Returns a field with the given name if any exist in this document, or
-   * null.  If multiple fields exists with this name, this method returns the
-   * first value added.
+  /**
+   * Returns a field with the given name if any exist in this document, or null. If multiple fields
+   * exists with this name, this method returns the first value added.
    */
   public final IndexableField getField(String name) {
     for (IndexableField field : fields) {
@@ -163,9 +156,8 @@ public final class Document implements Iterable<IndexableField> {
   }
 
   /**
-   * Returns an array of {@link IndexableField}s with the given name.
-   * This method returns an empty array when there are no
-   * matching fields.  It never returns null.
+   * Returns an array of {@link IndexableField}s with the given name. This method returns an empty
+   * array when there are no matching fields. It never returns null.
    *
    * @param name the name of the field
    * @return a <code>Field[]</code> array
@@ -180,27 +172,27 @@ public final class Document implements Iterable<IndexableField> {
 
     return result.toArray(new IndexableField[result.size()]);
   }
-  
-  /** Returns a List of all the fields in a document.
-   * <p>Note that fields which are <i>not</i> stored are
-   * <i>not</i> available in documents retrieved from the
-   * index, e.g. {@link IndexSearcher#doc(int)} or {@link
-   * IndexReader#document(int)}.
-   * 
-   * @return an immutable <code>List&lt;Field&gt;</code> 
+
+  /**
+   * Returns a List of all the fields in a document.
+   *
+   * <p>Note that fields which are <i>not</i> stored are <i>not</i> available in documents retrieved
+   * from the index, e.g. {@link IndexSearcher#doc(int)} or {@link IndexReader#document(int)}.
+   *
+   * @return an immutable <code>List&lt;Field&gt;</code>
    */
   public final List<IndexableField> getFields() {
     return Collections.unmodifiableList(fields);
   }
-  
-  private final static String[] NO_STRINGS = new String[0];
+
+  private static final String[] NO_STRINGS = new String[0];
 
   /**
-   * Returns an array of values of the field specified as the method parameter.
-   * This method returns an empty array when there are no
-   * matching fields.  It never returns null.
-   * For a numeric {@link StoredField} it returns the string value of the number. If you want
-   * the actual numeric field instances back, use {@link #getFields}.
+   * Returns an array of values of the field specified as the method parameter. This method returns
+   * an empty array when there are no matching fields. It never returns null. For a numeric {@link
+   * StoredField} it returns the string value of the number. If you want the actual numeric field
+   * instances back, use {@link #getFields}.
+   *
    * @param name the name of the field
    * @return a <code>String[]</code> of field values
    */
@@ -211,20 +203,20 @@ public final class Document implements Iterable<IndexableField> {
         result.add(field.stringValue());
       }
     }
-    
+
     if (result.size() == 0) {
       return NO_STRINGS;
     }
-    
+
     return result.toArray(new String[result.size()]);
   }
 
-  /** Returns the string value of the field with the given name if any exist in
-   * this document, or null.  If multiple fields exist with this name, this
-   * method returns the first value added. If only binary fields with this name
-   * exist, returns null.
-   * For a numeric {@link StoredField} it returns the string value of the number. If you want
-   * the actual numeric field instance back, use {@link #getField}.
+  /**
+   * Returns the string value of the field with the given name if any exist in this document, or
+   * null. If multiple fields exist with this name, this method returns the first value added. If
+   * only binary fields with this name exist, returns null. For a numeric {@link StoredField} it
+   * returns the string value of the number. If you want the actual numeric field instance back, use
+   * {@link #getField}.
    */
   public final String get(String name) {
     for (IndexableField field : fields) {
@@ -234,7 +226,7 @@ public final class Document implements Iterable<IndexableField> {
     }
     return null;
   }
-  
+
   /** Prints the fields of a document for human consumption. */
   @Override
   public final String toString() {
@@ -243,7 +235,7 @@ public final class Document implements Iterable<IndexableField> {
     for (int i = 0; i < fields.size(); i++) {
       IndexableField field = fields.get(i);
       buffer.append(field.toString());
-      if (i != fields.size()-1) {
+      if (i != fields.size() - 1) {
         buffer.append(" ");
       }
     }
diff --git a/lucene/core/src/java/org/apache/lucene/document/DocumentStoredFieldVisitor.java b/lucene/core/src/java/org/apache/lucene/document/DocumentStoredFieldVisitor.java
index 1a9b9e7..39aa5e9 100644
--- a/lucene/core/src/java/org/apache/lucene/document/DocumentStoredFieldVisitor.java
+++ b/lucene/core/src/java/org/apache/lucene/document/DocumentStoredFieldVisitor.java
@@ -20,28 +20,27 @@ import java.io.IOException;
 import java.util.HashSet;
 import java.util.Objects;
 import java.util.Set;
-
 import org.apache.lucene.index.FieldInfo;
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.StoredFieldVisitor;
 
-/** A {@link StoredFieldVisitor} that creates a {@link
- *  Document} from stored fields.
- *  <p>
- *  This visitor supports loading all stored fields, or only specific
- *  requested fields provided from a {@link Set}.
- *  <p>
- *  This is used by {@link IndexReader#document(int)} to load a
- *  document.
+/**
+ * A {@link StoredFieldVisitor} that creates a {@link Document} from stored fields.
  *
- * @lucene.experimental */
-
+ * <p>This visitor supports loading all stored fields, or only specific requested fields provided
+ * from a {@link Set}.
+ *
+ * <p>This is used by {@link IndexReader#document(int)} to load a document.
+ *
+ * @lucene.experimental
+ */
 public class DocumentStoredFieldVisitor extends StoredFieldVisitor {
   private final Document doc = new Document();
   private final Set<String> fieldsToAdd;
 
-  /** 
-   * Load only fields named in the provided <code>Set&lt;String&gt;</code>. 
+  /**
+   * Load only fields named in the provided <code>Set&lt;String&gt;</code>.
+   *
    * @param fieldsToAdd Set of fields to load, or <code>null</code> (all fields).
    */
   public DocumentStoredFieldVisitor(Set<String> fieldsToAdd) {
@@ -51,7 +50,7 @@ public class DocumentStoredFieldVisitor extends StoredFieldVisitor {
   /** Load only fields named in the provided fields. */
   public DocumentStoredFieldVisitor(String... fields) {
     fieldsToAdd = new HashSet<>(fields.length);
-    for(String field : fields) {
+    for (String field : fields) {
       fieldsToAdd.add(field);
     }
   }
@@ -72,7 +71,9 @@ public class DocumentStoredFieldVisitor extends StoredFieldVisitor {
     ft.setStoreTermVectors(fieldInfo.hasVectors());
     ft.setOmitNorms(fieldInfo.omitsNorms());
     ft.setIndexOptions(fieldInfo.getIndexOptions());
-    doc.add(new StoredField(fieldInfo.name, Objects.requireNonNull(value, "String value should not be null"), ft));
+    doc.add(
+        new StoredField(
+            fieldInfo.name, Objects.requireNonNull(value, "String value should not be null"), ft));
   }
 
   @Override
@@ -102,10 +103,10 @@ public class DocumentStoredFieldVisitor extends StoredFieldVisitor {
 
   /**
    * Retrieve the visited document.
-   * @return {@link Document} populated with stored fields. Note that only
-   *         the stored information in the field instances is valid,
-   *         data such as indexing options, term vector options,
-   *         etc is not set.
+   *
+   * @return {@link Document} populated with stored fields. Note that only the stored information in
+   *     the field instances is valid, data such as indexing options, term vector options, etc is
+   *     not set.
    */
   public Document getDocument() {
     return doc;
diff --git a/lucene/core/src/java/org/apache/lucene/document/DoubleDocValuesField.java b/lucene/core/src/java/org/apache/lucene/document/DoubleDocValuesField.java
index 3c24ca4..3103c86 100644
--- a/lucene/core/src/java/org/apache/lucene/document/DoubleDocValuesField.java
+++ b/lucene/core/src/java/org/apache/lucene/document/DoubleDocValuesField.java
@@ -16,22 +16,21 @@
  */
 package org.apache.lucene.document;
 
-
 /**
- * Syntactic sugar for encoding doubles as NumericDocValues
- * via {@link Double#doubleToRawLongBits(double)}.
- * <p>
- * Per-document double values can be retrieved via
- * {@link org.apache.lucene.index.LeafReader#getNumericDocValues(String)}.
- * <p>
- * <b>NOTE</b>: In most all cases this will be rather inefficient,
- * requiring eight bytes per document. Consider encoding double
- * values yourself with only as much precision as you require.
+ * Syntactic sugar for encoding doubles as NumericDocValues via {@link
+ * Double#doubleToRawLongBits(double)}.
+ *
+ * <p>Per-document double values can be retrieved via {@link
+ * org.apache.lucene.index.LeafReader#getNumericDocValues(String)}.
+ *
+ * <p><b>NOTE</b>: In most all cases this will be rather inefficient, requiring eight bytes per
+ * document. Consider encoding double values yourself with only as much precision as you require.
  */
 public class DoubleDocValuesField extends NumericDocValuesField {
 
-  /** 
-   * Creates a new DocValues field with the specified 64-bit double value 
+  /**
+   * Creates a new DocValues field with the specified 64-bit double value
+   *
    * @param name field name
    * @param value 64-bit double value
    * @throws IllegalArgumentException if the field name is null
@@ -44,7 +43,7 @@ public class DoubleDocValuesField extends NumericDocValuesField {
   public void setDoubleValue(double value) {
     super.setLongValue(Double.doubleToRawLongBits(value));
   }
-  
+
   @Override
   public void setLongValue(long value) {
     throw new IllegalArgumentException("cannot change value type from Double to Long");
diff --git a/lucene/core/src/java/org/apache/lucene/document/DoublePoint.java b/lucene/core/src/java/org/apache/lucene/document/DoublePoint.java
index 9b8be22..b20638d 100644
--- a/lucene/core/src/java/org/apache/lucene/document/DoublePoint.java
+++ b/lucene/core/src/java/org/apache/lucene/document/DoublePoint.java
@@ -18,7 +18,6 @@ package org.apache.lucene.document;
 
 import java.util.Arrays;
 import java.util.Collection;
-
 import org.apache.lucene.index.PointValues;
 import org.apache.lucene.search.PointInSetQuery;
 import org.apache.lucene.search.PointRangeQuery;
@@ -26,29 +25,30 @@ import org.apache.lucene.search.Query;
 import org.apache.lucene.util.BytesRef;
 import org.apache.lucene.util.NumericUtils;
 
-/** 
- * An indexed {@code double} field for fast range filters.  If you also
- * need to store the value, you should add a separate {@link StoredField} instance.
- * <p>
- * Finding all documents within an N-dimensional shape or range at search time is
- * efficient.  Multiple values for the same field in one document
- * is allowed.
- * <p>
- * This field defines static factory methods for creating common queries:
+/**
+ * An indexed {@code double} field for fast range filters. If you also need to store the value, you
+ * should add a separate {@link StoredField} instance.
+ *
+ * <p>Finding all documents within an N-dimensional shape or range at search time is efficient.
+ * Multiple values for the same field in one document is allowed.
+ *
+ * <p>This field defines static factory methods for creating common queries:
+ *
  * <ul>
  *   <li>{@link #newExactQuery(String, double)} for matching an exact 1D point.
  *   <li>{@link #newSetQuery(String, double...)} for matching a set of 1D values.
  *   <li>{@link #newRangeQuery(String, double, double)} for matching a 1D range.
- *   <li>{@link #newRangeQuery(String, double[], double[])} for matching points/ranges in n-dimensional space.
- * </ul> 
+ *   <li>{@link #newRangeQuery(String, double[], double[])} for matching points/ranges in
+ *       n-dimensional space.
+ * </ul>
+ *
  * @see PointValues
  */
 public final class DoublePoint extends Field {
   /**
-   * Return the least double that compares greater than {@code d} consistently
-   * with {@link Double#compare}. The only difference with
-   * {@link Math#nextUp(double)} is that this method returns {@code +0d} when
-   * the argument is {@code -0d}.
+   * Return the least double that compares greater than {@code d} consistently with {@link
+   * Double#compare}. The only difference with {@link Math#nextUp(double)} is that this method
+   * returns {@code +0d} when the argument is {@code -0d}.
    */
   public static double nextUp(double d) {
     if (Double.doubleToLongBits(d) == 0x8000_0000_0000_0000L) { // -0d
@@ -58,10 +58,9 @@ public final class DoublePoint extends Field {
   }
 
   /**
-   * Return the greatest double that compares less than {@code d} consistently
-   * with {@link Double#compare}. The only difference with
-   * {@link Math#nextDown(double)} is that this method returns {@code -0d} when
-   * the argument is {@code +0d}.
+   * Return the greatest double that compares less than {@code d} consistently with {@link
+   * Double#compare}. The only difference with {@link Math#nextDown(double)} is that this method
+   * returns {@code -0d} when the argument is {@code +0d}.
    */
   public static double nextDown(double d) {
     if (Double.doubleToLongBits(d) == 0L) { // +0d
@@ -85,7 +84,14 @@ public final class DoublePoint extends Field {
   /** Change the values of this field */
   public void setDoubleValues(double... point) {
     if (type.pointDimensionCount() != point.length) {
-      throw new IllegalArgumentException("this field (name=" + name + ") uses " + type.pointDimensionCount() + " dimensions; cannot change to (incoming) " + point.length + " dimensions");
+      throw new IllegalArgumentException(
+          "this field (name="
+              + name
+              + ") uses "
+              + type.pointDimensionCount()
+              + " dimensions; cannot change to (incoming) "
+              + point.length
+              + " dimensions");
     }
     fieldsData = pack(point);
   }
@@ -98,7 +104,12 @@ public final class DoublePoint extends Field {
   @Override
   public Number numericValue() {
     if (type.pointDimensionCount() != 1) {
-      throw new IllegalStateException("this field (name=" + name + ") uses " + type.pointDimensionCount() + " dimensions; cannot convert to a single numeric value");
+      throw new IllegalStateException(
+          "this field (name="
+              + name
+              + ") uses "
+              + type.pointDimensionCount()
+              + " dimensions; cannot convert to a single numeric value");
     }
     BytesRef bytes = (BytesRef) fieldsData;
     assert bytes.length == Double.BYTES;
@@ -106,7 +117,7 @@ public final class DoublePoint extends Field {
   }
 
   /**
-   *  Pack a double point into a BytesRef
+   * Pack a double point into a BytesRef
    *
    * @param point double[] value
    * @throws IllegalArgumentException is the value is null or of zero length
@@ -119,25 +130,25 @@ public final class DoublePoint extends Field {
       throw new IllegalArgumentException("point must not be 0 dimensions");
     }
     byte[] packed = new byte[point.length * Double.BYTES];
-    
-    for (int dim = 0; dim < point.length ; dim++) {
+
+    for (int dim = 0; dim < point.length; dim++) {
       encodeDimension(point[dim], packed, dim * Double.BYTES);
     }
 
     return new BytesRef(packed);
   }
 
-  /** Creates a new DoublePoint, indexing the
-   *  provided N-dimensional double point.
+  /**
+   * Creates a new DoublePoint, indexing the provided N-dimensional double point.
    *
-   *  @param name field name
-   *  @param point double[] value
-   *  @throws IllegalArgumentException if the field name or value is null.
+   * @param name field name
+   * @param point double[] value
+   * @throws IllegalArgumentException if the field name or value is null.
    */
   public DoublePoint(String name, double... point) {
     super(name, pack(point), getType(point.length));
   }
-  
+
   @Override
   public String toString() {
     StringBuilder result = new StringBuilder();
@@ -157,26 +168,26 @@ public final class DoublePoint extends Field {
     result.append('>');
     return result.toString();
   }
-  
+
   // public helper methods (e.g. for queries)
-  
+
   /** Encode single double dimension */
   public static void encodeDimension(double value, byte dest[], int offset) {
     NumericUtils.longToSortableBytes(NumericUtils.doubleToSortableLong(value), dest, offset);
   }
-  
+
   /** Decode single double dimension */
   public static double decodeDimension(byte value[], int offset) {
     return NumericUtils.sortableLongToDouble(NumericUtils.sortableBytesToLong(value, offset));
   }
-  
+
   // static methods for generating queries
 
-  /** 
+  /**
    * Create a query for matching an exact double value.
-   * <p>
-   * This is for simple one-dimension points, for multidimensional points use
-   * {@link #newRangeQuery(String, double[], double[])} instead.
+   *
+   * <p>This is for simple one-dimension points, for multidimensional points use {@link
+   * #newRangeQuery(String, double[], double[])} instead.
    *
    * @param field field name. must not be {@code null}.
    * @param value double value
@@ -186,19 +197,20 @@ public final class DoublePoint extends Field {
   public static Query newExactQuery(String field, double value) {
     return newRangeQuery(field, value, value);
   }
-  
-  /** 
+
+  /**
    * Create a range query for double values.
-   * <p>
-   * This is for simple one-dimension ranges, for multidimensional ranges use
-   * {@link #newRangeQuery(String, double[], double[])} instead.
-   * <p>
-   * You can have half-open ranges (which are in fact &lt;/&le; or &gt;/&ge; queries)
-   * by setting {@code lowerValue = Double.NEGATIVE_INFINITY} or {@code upperValue = Double.POSITIVE_INFINITY}.
-   * <p> Ranges are inclusive. For exclusive ranges, pass {@link #nextUp(double) nextUp(lowerValue)}
+   *
+   * <p>This is for simple one-dimension ranges, for multidimensional ranges use {@link
+   * #newRangeQuery(String, double[], double[])} instead.
+   *
+   * <p>You can have half-open ranges (which are in fact &lt;/&le; or &gt;/&ge; queries) by setting
+   * {@code lowerValue = Double.NEGATIVE_INFINITY} or {@code upperValue = Double.POSITIVE_INFINITY}.
+   *
+   * <p>Ranges are inclusive. For exclusive ranges, pass {@link #nextUp(double) nextUp(lowerValue)}
    * or {@link #nextUp(double) nextDown(upperValue)}.
-   * <p>
-   * Range comparisons are consistent with {@link Double#compareTo(Double)}.
+   *
+   * <p>Range comparisons are consistent with {@link Double#compareTo(Double)}.
    *
    * @param field field name. must not be {@code null}.
    * @param lowerValue lower portion of the range (inclusive).
@@ -207,29 +219,32 @@ public final class DoublePoint extends Field {
    * @return a query matching documents within this range.
    */
   public static Query newRangeQuery(String field, double lowerValue, double upperValue) {
-    return newRangeQuery(field, new double[] { lowerValue }, new double[] { upperValue });
+    return newRangeQuery(field, new double[] {lowerValue}, new double[] {upperValue});
   }
 
-  /** 
+  /**
    * Create a range query for n-dimensional double values.
-   * <p>
-   * You can have half-open ranges (which are in fact &lt;/&le; or &gt;/&ge; queries)
-   * by setting {@code lowerValue[i] = Double.NEGATIVE_INFINITY} or {@code upperValue[i] = Double.POSITIVE_INFINITY}.
-   * <p> Ranges are inclusive. For exclusive ranges, pass {@code Math#nextUp(lowerValue[i])}
-   * or {@code Math.nextDown(upperValue[i])}.
-   * <p>
-   * Range comparisons are consistent with {@link Double#compareTo(Double)}.
+   *
+   * <p>You can have half-open ranges (which are in fact &lt;/&le; or &gt;/&ge; queries) by setting
+   * {@code lowerValue[i] = Double.NEGATIVE_INFINITY} or {@code upperValue[i] =
+   * Double.POSITIVE_INFINITY}.
+   *
+   * <p>Ranges are inclusive. For exclusive ranges, pass {@code Math#nextUp(lowerValue[i])} or
+   * {@code Math.nextDown(upperValue[i])}.
+   *
+   * <p>Range comparisons are consistent with {@link Double#compareTo(Double)}.
    *
    * @param field field name. must not be {@code null}.
    * @param lowerValue lower portion of the range (inclusive). must not be {@code null}.
    * @param upperValue upper portion of the range (inclusive). must not be {@code null}.
-   * @throws IllegalArgumentException if {@code field} is null, if {@code lowerValue} is null, if {@code upperValue} is null, 
-   *                                  or if {@code lowerValue.length != upperValue.length}
+   * @throws IllegalArgumentException if {@code field} is null, if {@code lowerValue} is null, if
+   *     {@code upperValue} is null, or if {@code lowerValue.length != upperValue.length}
    * @return a query matching documents within this range.
    */
   public static Query newRangeQuery(String field, double[] lowerValue, double[] upperValue) {
     PointRangeQuery.checkArgs(field, lowerValue, upperValue);
-    return new PointRangeQuery(field, pack(lowerValue).bytes, pack(upperValue).bytes, lowerValue.length) {
+    return new PointRangeQuery(
+        field, pack(lowerValue).bytes, pack(upperValue).bytes, lowerValue.length) {
       @Override
       protected String toString(int dimension, byte[] value) {
         return Double.toString(decodeDimension(value, 0));
@@ -238,8 +253,9 @@ public final class DoublePoint extends Field {
   }
 
   /**
-   * Create a query matching any of the specified 1D values.  This is the points equivalent of {@code TermsQuery}.
-   * 
+   * Create a query matching any of the specified 1D values. This is the points equivalent of {@code
+   * TermsQuery}.
+   *
    * @param field field name. must not be {@code null}.
    * @param values all values to match
    */
@@ -251,22 +267,25 @@ public final class DoublePoint extends Field {
 
     final BytesRef encoded = new BytesRef(new byte[Double.BYTES]);
 
-    return new PointInSetQuery(field, 1, Double.BYTES,
-                               new PointInSetQuery.Stream() {
+    return new PointInSetQuery(
+        field,
+        1,
+        Double.BYTES,
+        new PointInSetQuery.Stream() {
 
-                                 int upto;
+          int upto;
 
-                                 @Override
-                                 public BytesRef next() {
-                                   if (upto == sortedValues.length) {
-                                     return null;
-                                   } else {
-                                     encodeDimension(sortedValues[upto], encoded.bytes, 0);
-                                     upto++;
-                                     return encoded;
-                                   }
-                                 }
-                               }) {
+          @Override
+          public BytesRef next() {
+            if (upto == sortedValues.length) {
+              return null;
+            } else {
+              encodeDimension(sortedValues[upto], encoded.bytes, 0);
+              upto++;
+              return encoded;
+            }
+          }
+        }) {
       @Override
       protected String toString(byte[] value) {
         assert value.length == Double.BYTES;
@@ -274,10 +293,11 @@ public final class DoublePoint extends Field {
       }
     };
   }
-  
+
   /**
-   * Create a query matching any of the specified 1D values.  This is the points equivalent of {@code TermsQuery}.
-   * 
+   * Create a query matching any of the specified 1D values. This is the points equivalent of {@code
+   * TermsQuery}.
+   *
    * @param field field name. must not be {@code null}.
    * @param values all values to match
    */
diff --git a/lucene/core/src/java/org/apache/lucene/document/DoubleRange.java b/lucene/core/src/java/org/apache/lucene/document/DoubleRange.java
index a540943..79aa731 100644
--- a/lucene/core/src/java/org/apache/lucene/document/DoubleRange.java
+++ b/lucene/core/src/java/org/apache/lucene/document/DoubleRange.java
@@ -17,7 +17,6 @@
 package org.apache.lucene.document;
 
 import java.util.Objects;
-
 import org.apache.lucene.document.RangeFieldQuery.QueryType;
 import org.apache.lucene.search.Query;
 import org.apache.lucene.util.BytesRef;
@@ -25,20 +24,25 @@ import org.apache.lucene.util.NumericUtils;
 
 /**
  * An indexed Double Range field.
- * <p>
- * This field indexes dimensional ranges defined as min/max pairs. It supports
- * up to a maximum of 4 dimensions (indexed as 8 numeric values). With 1 dimension representing a single double range,
- * 2 dimensions representing a bounding box, 3 dimensions a bounding cube, and 4 dimensions a tesseract.
- * <p>
- * Multiple values for the same field in one document is supported, and open ended ranges can be defined using
- * {@code Double.NEGATIVE_INFINITY} and {@code Double.POSITIVE_INFINITY}.
  *
- * <p>
- * This field defines the following static factory methods for common search operations over double ranges:
+ * <p>This field indexes dimensional ranges defined as min/max pairs. It supports up to a maximum of
+ * 4 dimensions (indexed as 8 numeric values). With 1 dimension representing a single double range,
+ * 2 dimensions representing a bounding box, 3 dimensions a bounding cube, and 4 dimensions a
+ * tesseract.
+ *
+ * <p>Multiple values for the same field in one document is supported, and open ended ranges can be
+ * defined using {@code Double.NEGATIVE_INFINITY} and {@code Double.POSITIVE_INFINITY}.
+ *
+ * <p>This field defines the following static factory methods for common search operations over
+ * double ranges:
+ *
  * <ul>
- *   <li>{@link #newIntersectsQuery newIntersectsQuery()} matches ranges that intersect the defined search range.
- *   <li>{@link #newWithinQuery newWithinQuery()} matches ranges that are within the defined search range.
- *   <li>{@link #newContainsQuery newContainsQuery()} matches ranges that contain the defined search range.
+ *   <li>{@link #newIntersectsQuery newIntersectsQuery()} matches ranges that intersect the defined
+ *       search range.
+ *   <li>{@link #newWithinQuery newWithinQuery()} matches ranges that are within the defined search
+ *       range.
+ *   <li>{@link #newContainsQuery newContainsQuery()} matches ranges that contain the defined search
+ *       range.
  * </ul>
  */
 public class DoubleRange extends Field {
@@ -65,30 +69,38 @@ public class DoubleRange extends Field {
 
     FieldType ft = new FieldType();
     // dimensions is set as 2*dimension size (min/max per dimension)
-    ft.setDimensions(dimensions*2, BYTES);
+    ft.setDimensions(dimensions * 2, BYTES);
     ft.freeze();
     return ft;
   }
 
   /**
    * Changes the values of the field.
+   *
    * @param min array of min values. (accepts {@code Double.NEGATIVE_INFINITY})
    * @param max array of max values. (accepts {@code Double.POSITIVE_INFINITY})
    * @throws IllegalArgumentException if {@code min} or {@code max} is invalid
    */
   public void setRangeValues(double[] min, double[] max) {
     checkArgs(min, max);
-    if (min.length*2 != type.pointDimensionCount() || max.length*2 != type.pointDimensionCount()) {
-      throw new IllegalArgumentException("field (name=" + name + ") uses " + type.pointDimensionCount()/2
-          + " dimensions; cannot change to (incoming) " + min.length + " dimensions");
+    if (min.length * 2 != type.pointDimensionCount()
+        || max.length * 2 != type.pointDimensionCount()) {
+      throw new IllegalArgumentException(
+          "field (name="
+              + name
+              + ") uses "
+              + type.pointDimensionCount() / 2
+              + " dimensions; cannot change to (incoming) "
+              + min.length
+              + " dimensions");
     }
 
     final byte[] bytes;
     if (fieldsData == null) {
-      bytes = new byte[BYTES*2*min.length];
+      bytes = new byte[BYTES * 2 * min.length];
       fieldsData = new BytesRef(bytes);
     } else {
-      bytes = ((BytesRef)fieldsData).bytes;
+      bytes = ((BytesRef) fieldsData).bytes;
     }
     verifyAndEncode(min, max, bytes);
   }
@@ -106,32 +118,32 @@ public class DoubleRange extends Field {
     }
   }
 
-  /**
-   * Encodes the min, max ranges into a byte array
-   */
+  /** Encodes the min, max ranges into a byte array */
   static byte[] encode(double[] min, double[] max) {
     checkArgs(min, max);
-    byte[] b = new byte[BYTES*2*min.length];
+    byte[] b = new byte[BYTES * 2 * min.length];
     verifyAndEncode(min, max, b);
     return b;
   }
 
   /**
    * encode the ranges into a sortable byte array ({@code Double.NaN} not allowed)
-   * <p>
-   * example for 4 dimensions (8 bytes per dimension value):
-   * minD1 ... minD4 | maxD1 ... maxD4
+   *
+   * <p>example for 4 dimensions (8 bytes per dimension value): minD1 ... minD4 | maxD1 ... maxD4
    */
   static void verifyAndEncode(double[] min, double[] max, byte[] bytes) {
-    for (int d=0,i=0,j=min.length*BYTES; d<min.length; ++d, i+=BYTES, j+=BYTES) {
+    for (int d = 0, i = 0, j = min.length * BYTES; d < min.length; ++d, i += BYTES, j += BYTES) {
       if (Double.isNaN(min[d])) {
-        throw new IllegalArgumentException("invalid min value (" + Double.NaN + ")" + " in DoubleRange");
+        throw new IllegalArgumentException(
+            "invalid min value (" + Double.NaN + ")" + " in DoubleRange");
       }
       if (Double.isNaN(max[d])) {
-        throw new IllegalArgumentException("invalid max value (" + Double.NaN + ")" + " in DoubleRange");
+        throw new IllegalArgumentException(
+            "invalid max value (" + Double.NaN + ")" + " in DoubleRange");
       }
       if (min[d] > max[d]) {
-        throw new IllegalArgumentException("min value (" + min[d] + ") is greater than max value (" + max[d] + ")");
+        throw new IllegalArgumentException(
+            "min value (" + min[d] + ") is greater than max value (" + max[d] + ")");
       }
       encode(min[d], bytes, i);
       encode(max[d], bytes, j);
@@ -145,43 +157,47 @@ public class DoubleRange extends Field {
 
   /**
    * Get the min value for the given dimension
+   *
    * @param dimension the dimension, always positive
    * @return the decoded min value
    */
   public double getMin(int dimension) {
-    Objects.checkIndex(dimension, type.pointDimensionCount()/2);
-    return decodeMin(((BytesRef)fieldsData).bytes, dimension);
+    Objects.checkIndex(dimension, type.pointDimensionCount() / 2);
+    return decodeMin(((BytesRef) fieldsData).bytes, dimension);
   }
 
   /**
    * Get the max value for the given dimension
+   *
    * @param dimension the dimension, always positive
    * @return the decoded max value
    */
   public double getMax(int dimension) {
-    Objects.checkIndex(dimension, type.pointDimensionCount()/2);
-    return decodeMax(((BytesRef)fieldsData).bytes, dimension);
+    Objects.checkIndex(dimension, type.pointDimensionCount() / 2);
+    return decodeMax(((BytesRef) fieldsData).bytes, dimension);
   }
 
   /** decodes the min value (for the defined dimension) from the encoded input byte array */
   static double decodeMin(byte[] b, int dimension) {
-    int offset = dimension*BYTES;
+    int offset = dimension * BYTES;
     return NumericUtils.sortableLongToDouble(NumericUtils.sortableBytesToLong(b, offset));
   }
 
   /** decodes the max value (for the defined dimension) from the encoded input byte array */
   static double decodeMax(byte[] b, int dimension) {
-    int offset = b.length/2 + dimension*BYTES;
+    int offset = b.length / 2 + dimension * BYTES;
     return NumericUtils.sortableLongToDouble(NumericUtils.sortableBytesToLong(b, offset));
   }
 
   /**
    * Create a query for matching indexed ranges that intersect the defined range.
+   *
    * @param field field name. must not be null.
    * @param min array of min values. (accepts {@code Double.NEGATIVE_INFINITY})
    * @param max array of max values. (accepts {@code Double.POSITIVE_INFINITY})
    * @return query for matching intersecting ranges (overlap, within, or contains)
-   * @throws IllegalArgumentException if {@code field} is null, {@code min} or {@code max} is invalid
+   * @throws IllegalArgumentException if {@code field} is null, {@code min} or {@code max} is
+   *     invalid
    */
   public static Query newIntersectsQuery(String field, final double[] min, final double[] max) {
     return newRelationQuery(field, min, max, QueryType.INTERSECTS);
@@ -189,11 +205,13 @@ public class DoubleRange extends Field {
 
   /**
    * Create a query for matching indexed ranges that contain the defined range.
+   *
    * @param field field name. must not be null.
    * @param min array of min values. (accepts {@code Double.MIN_VALUE})
    * @param max array of max values. (accepts {@code Double.MAX_VALUE})
    * @return query for matching ranges that contain the defined range
-   * @throws IllegalArgumentException if {@code field} is null, {@code min} or {@code max} is invalid
+   * @throws IllegalArgumentException if {@code field} is null, {@code min} or {@code max} is
+   *     invalid
    */
   public static Query newContainsQuery(String field, final double[] min, final double[] max) {
     return newRelationQuery(field, min, max, QueryType.CONTAINS);
@@ -201,32 +219,37 @@ public class DoubleRange extends Field {
 
   /**
    * Create a query for matching indexed ranges that are within the defined range.
+   *
    * @param field field name. must not be null.
    * @param min array of min values. (accepts {@code Double.MIN_VALUE})
    * @param max array of max values. (accepts {@code Double.MAX_VALUE})
    * @return query for matching ranges within the defined range
-   * @throws IllegalArgumentException if {@code field} is null, {@code min} or {@code max} is invalid
+   * @throws IllegalArgumentException if {@code field} is null, {@code min} or {@code max} is
+   *     invalid
    */
   public static Query newWithinQuery(String field, final double[] min, final double[] max) {
     return newRelationQuery(field, min, max, QueryType.WITHIN);
   }
 
   /**
-   * Create a query for matching indexed ranges that cross the defined range.
-   * A CROSSES is defined as any set of ranges that are not disjoint and not wholly contained by
-   * the query. Effectively, its the complement of union(WITHIN, DISJOINT).
+   * Create a query for matching indexed ranges that cross the defined range. A CROSSES is defined
+   * as any set of ranges that are not disjoint and not wholly contained by the query. Effectively,
+   * its the complement of union(WITHIN, DISJOINT).
+   *
    * @param field field name. must not be null.
    * @param min array of min values. (accepts {@code Double.MIN_VALUE})
    * @param max array of max values. (accepts {@code Double.MAX_VALUE})
    * @return query for matching ranges within the defined range
-   * @throws IllegalArgumentException if {@code field} is null, {@code min} or {@code max} is invalid
+   * @throws IllegalArgumentException if {@code field} is null, {@code min} or {@code max} is
+   *     invalid
    */
   public static Query newCrossesQuery(String field, final double[] min, final double[] max) {
     return newRelationQuery(field, min, max, QueryType.CROSSES);
   }
 
   /** helper method for creating the desired relational query */
-  private static Query newRelationQuery(String field, final double[] min, final double[] max, QueryType relation) {
+  private static Query newRelationQuery(
+      String field, final double[] min, final double[] max, QueryType relation) {
     checkArgs(min, max);
     return new RangeFieldQuery(field, encode(min, max), min.length, relation) {
       @Override
@@ -243,7 +266,7 @@ public class DoubleRange extends Field {
     sb.append(" <");
     sb.append(name);
     sb.append(':');
-    byte[] b = ((BytesRef)fieldsData).bytes;
+    byte[] b = ((BytesRef) fieldsData).bytes;
     toString(b, 0);
     for (int d = 0; d < type.pointDimensionCount() / 2; ++d) {
       sb.append(' ');
@@ -256,12 +279,16 @@ public class DoubleRange extends Field {
 
   /**
    * Returns the String representation for the range at the given dimension
+   *
    * @param ranges the encoded ranges, never null
    * @param dimension the dimension of interest
    * @return The string representation for the range at the provided dimension
    */
   private static String toString(byte[] ranges, int dimension) {
-    return "[" + Double.toString(decodeMin(ranges, dimension)) + " : "
-        + Double.toString(decodeMax(ranges, dimension)) + "]";
+    return "["
+        + Double.toString(decodeMin(ranges, dimension))
+        + " : "
+        + Double.toString(decodeMax(ranges, dimension))
+        + "]";
   }
 }
diff --git a/lucene/core/src/java/org/apache/lucene/document/DoubleRangeDocValuesField.java b/lucene/core/src/java/org/apache/lucene/document/DoubleRangeDocValuesField.java
index 629e33c..08d6bb5 100644
--- a/lucene/core/src/java/org/apache/lucene/document/DoubleRangeDocValuesField.java
+++ b/lucene/core/src/java/org/apache/lucene/document/DoubleRangeDocValuesField.java
@@ -20,10 +20,10 @@ package org.apache.lucene.document;
 import org.apache.lucene.search.Query;
 
 /**
- * DocValues field for DoubleRange. This is a single valued field i.e. can have only one
- * value per document due to being an extension of BinaryDocValuesField.
+ * DocValues field for DoubleRange. This is a single valued field i.e. can have only one value per
+ * document due to being an extension of BinaryDocValuesField.
  */
-public class DoubleRangeDocValuesField extends BinaryRangeDocValuesField{
+public class DoubleRangeDocValuesField extends BinaryRangeDocValuesField {
   final String field;
   final double[] min;
   final double[] max;
@@ -55,22 +55,23 @@ public class DoubleRangeDocValuesField extends BinaryRangeDocValuesField{
     return max[dimension];
   }
 
-  private static Query newSlowRangeQuery(String field, final double[] min, final double[] max,
-                                        RangeFieldQuery.QueryType queryType) {
+  private static Query newSlowRangeQuery(
+      String field, final double[] min, final double[] max, RangeFieldQuery.QueryType queryType) {
     checkArgs(min, max);
     return new DoubleRangeSlowRangeQuery(field, min, max, queryType);
   }
 
-  /** Create a new range query that finds all ranges that intersect using doc values.
-   *  NOTE: This doesn't leverage indexing and may be slow.
-   *  @see DoubleRange#newIntersectsQuery */
+  /**
+   * Create a new range query that finds all ranges that intersect using doc values. NOTE: This
+   * doesn't leverage indexing and may be slow.
+   *
+   * @see DoubleRange#newIntersectsQuery
+   */
   public static Query newSlowIntersectsQuery(String field, final double[] min, final double[] max) {
     return newSlowRangeQuery(field, min, max, RangeFieldQuery.QueryType.INTERSECTS);
   }
 
-  /**
-   * validate the arguments
-   */
+  /** validate the arguments */
   private static void checkArgs(final double[] min, final double[] max) {
     if (min == null || max == null || min.length == 0 || max.length == 0) {
       throw new IllegalArgumentException("min/max range values cannot be null or empty");
diff --git a/lucene/core/src/java/org/apache/lucene/document/DoubleRangeSlowRangeQuery.java b/lucene/core/src/java/org/apache/lucene/document/DoubleRangeSlowRangeQuery.java
index 5f506e2..6406b1b 100644
--- a/lucene/core/src/java/org/apache/lucene/document/DoubleRangeSlowRangeQuery.java
+++ b/lucene/core/src/java/org/apache/lucene/document/DoubleRangeSlowRangeQuery.java
@@ -20,7 +20,6 @@ package org.apache.lucene.document;
 import java.io.IOException;
 import java.util.Arrays;
 import java.util.Objects;
-
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.search.Query;
 import org.apache.lucene.search.QueryVisitor;
@@ -30,9 +29,9 @@ class DoubleRangeSlowRangeQuery extends BinaryRangeFieldRangeQuery {
   private final double[] min;
   private final double[] max;
 
-  DoubleRangeSlowRangeQuery(String field, double[] min, double[] max, RangeFieldQuery.QueryType queryType) {
-    super(field, encodeRanges(min, max), DoubleRange.BYTES, min.length,
-        queryType);
+  DoubleRangeSlowRangeQuery(
+      String field, double[] min, double[] max, RangeFieldQuery.QueryType queryType) {
+    super(field, encodeRanges(min, max), DoubleRange.BYTES, min.length, queryType);
     this.field = field;
     this.min = min;
     this.max = max;
@@ -71,8 +70,7 @@ class DoubleRangeSlowRangeQuery extends BinaryRangeFieldRangeQuery {
     if (this.field.equals(field) == false) {
       b.append(this.field).append(":");
     }
-    return b
-        .append("[")
+    return b.append("[")
         .append(Arrays.toString(min))
         .append(" TO ")
         .append(Arrays.toString(max))
diff --git a/lucene/core/src/java/org/apache/lucene/document/FeatureDoubleValuesSource.java b/lucene/core/src/java/org/apache/lucene/document/FeatureDoubleValuesSource.java
index 41af9f8..452577a 100644
--- a/lucene/core/src/java/org/apache/lucene/document/FeatureDoubleValuesSource.java
+++ b/lucene/core/src/java/org/apache/lucene/document/FeatureDoubleValuesSource.java
@@ -18,7 +18,6 @@ package org.apache.lucene.document;
 
 import java.io.IOException;
 import java.util.Objects;
-
 import org.apache.lucene.index.LeafReaderContext;
 import org.apache.lucene.index.PostingsEnum;
 import org.apache.lucene.index.Terms;
@@ -29,18 +28,18 @@ import org.apache.lucene.search.IndexSearcher;
 import org.apache.lucene.util.BytesRef;
 
 /**
- * A {@link DoubleValuesSource} instance which can be used to read the values of a feature from a 
+ * A {@link DoubleValuesSource} instance which can be used to read the values of a feature from a
  * {@link FeatureField} for documents.
  */
 class FeatureDoubleValuesSource extends DoubleValuesSource {
-  
+
   private final BytesRef featureName;
   private final String field;
 
   /**
-   * Creates a {@link DoubleValuesSource} instance which can be used to read the values of a feature from the a 
-   * {@link FeatureField} for documents.
-   * 
+   * Creates a {@link DoubleValuesSource} instance which can be used to read the values of a feature
+   * from the a {@link FeatureField} for documents.
+   *
    * @param field field name. Must not be null.
    * @param featureName feature name. Must not be null.
    * @throws NullPointerException if {@code field} or {@code featureName} is null.
@@ -95,17 +94,16 @@ class FeatureDoubleValuesSource extends DoubleValuesSource {
       return false;
     }
     FeatureDoubleValuesSource other = (FeatureDoubleValuesSource) obj;
-    return Objects.equals(field, other.field) &&
-        Objects.equals(featureName, other.featureName);
+    return Objects.equals(field, other.field) && Objects.equals(featureName, other.featureName);
   }
 
   @Override
   public String toString() {
-    return "FeatureDoubleValuesSource("+field+", "+featureName.utf8ToString()+")";
+    return "FeatureDoubleValuesSource(" + field + ", " + featureName.utf8ToString() + ")";
   }
-  
+
   static class FeatureDoubleValues extends DoubleValues {
-    
+
     private final PostingsEnum currentReaderPostingsValues;
 
     public FeatureDoubleValues(PostingsEnum currentReaderPostingsValues) throws IOException {
@@ -120,13 +118,12 @@ class FeatureDoubleValuesSource extends DoubleValuesSource {
     @Override
     public boolean advanceExact(int doc) throws IOException {
       if (doc >= currentReaderPostingsValues.docID()
-          && (currentReaderPostingsValues.docID() == doc || currentReaderPostingsValues.advance(doc) == doc)) {
+          && (currentReaderPostingsValues.docID() == doc
+              || currentReaderPostingsValues.advance(doc) == doc)) {
         return true;
       } else {
         return false;
       }
     }
-    
   }
-
 }
diff --git a/lucene/core/src/java/org/apache/lucene/document/FeatureField.java b/lucene/core/src/java/org/apache/lucene/document/FeatureField.java
index dafcbf4..22e6d9d 100644
--- a/lucene/core/src/java/org/apache/lucene/document/FeatureField.java
+++ b/lucene/core/src/java/org/apache/lucene/document/FeatureField.java
@@ -18,7 +18,6 @@ package org.apache.lucene.document;
 
 import java.io.IOException;
 import java.util.Objects;
-
 import org.apache.lucene.analysis.Analyzer;
 import org.apache.lucene.analysis.TokenStream;
 import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
@@ -38,66 +37,56 @@ import org.apache.lucene.search.similarities.BM25Similarity;
 import org.apache.lucene.search.similarities.Similarity.SimScorer;
 
 /**
- * {@link Field} that can be used to store static scoring factors into
- * documents. This is mostly inspired from the work from Nick Craswell,
- * Stephen Robertson, Hugo Zaragoza and Michael Taylor. Relevance weighting
- * for query independent evidence. Proceedings of the 28th annual international
- * ACM SIGIR conference on Research and development in information retrieval.
- * August 15-19, 2005, Salvador, Brazil.
- * <p>
- * Feature values are internally encoded as term frequencies. Putting
- * feature queries as
- * {@link org.apache.lucene.search.BooleanClause.Occur#SHOULD} clauses of a
- * {@link BooleanQuery} allows to combine query-dependent scores (eg. BM25)
- * with query-independent scores using a linear combination. The fact that
- * feature values are stored as frequencies also allows search logic to
- * efficiently skip documents that can't be competitive when total hit counts
- * are not requested. This makes it a compelling option compared to storing
- * such factors eg. in a doc-value field.
- * <p>
- * This field may only store factors that are positively correlated with the
- * final score, like pagerank. In case of factors that are inversely correlated
- * with the score like url length, the inverse of the scoring factor should be
- * stored, ie. {@code 1/urlLength}.
- * <p>
- * This field only considers the top 9 significant bits for storage efficiency
- * which allows to store them on 16 bits internally. In practice this limitation
- * means that values are stored with a relative precision of
- * 2<sup>-8</sup> = 0.00390625.
- * <p>
- * Given a scoring factor {@code S > 0} and its weight {@code w > 0}, there
- * are four ways that S can be turned into a score:
+ * {@link Field} that can be used to store static scoring factors into documents. This is mostly
+ * inspired from the work from Nick Craswell, Stephen Robertson, Hugo Zaragoza and Michael Taylor.
+ * Relevance weighting for query independent evidence. Proceedings of the 28th annual international
+ * ACM SIGIR conference on Research and development in information retrieval. August 15-19, 2005,
+ * Salvador, Brazil.
+ *
+ * <p>Feature values are internally encoded as term frequencies. Putting feature queries as {@link
+ * org.apache.lucene.search.BooleanClause.Occur#SHOULD} clauses of a {@link BooleanQuery} allows to
+ * combine query-dependent scores (eg. BM25) with query-independent scores using a linear
+ * combination. The fact that feature values are stored as frequencies also allows search logic to
+ * efficiently skip documents that can't be competitive when total hit counts are not requested.
+ * This makes it a compelling option compared to storing such factors eg. in a doc-value field.
+ *
+ * <p>This field may only store factors that are positively correlated with the final score, like
+ * pagerank. In case of factors that are inversely correlated with the score like url length, the
+ * inverse of the scoring factor should be stored, ie. {@code 1/urlLength}.
+ *
+ * <p>This field only considers the top 9 significant bits for storage efficiency which allows to
+ * store them on 16 bits internally. In practice this limitation means that values are stored with a
+ * relative precision of 2<sup>-8</sup> = 0.00390625.
+ *
+ * <p>Given a scoring factor {@code S > 0} and its weight {@code w > 0}, there are four ways that S
+ * can be turned into a score:
+ *
  * <ul>
- *   <li>{@link #newLogQuery w * log(a + S)}, with a &ge; 1. This function
- *       usually makes sense because the distribution of scoring factors
- *       often follows a power law. This is typically the case for pagerank for
- *       instance. However the paper suggested that the {@code satu} and
+ *   <li>{@link #newLogQuery w * log(a + S)}, with a &ge; 1. This function usually makes sense
+ *       because the distribution of scoring factors often follows a power law. This is typically
+ *       the case for pagerank for instance. However the paper suggested that the {@code satu} and
  *       {@code sigm} functions give even better results.
- *   <li>{@link #newSaturationQuery satu(S) = w * S / (S + k)}, with k &gt; 0. This
- *       function is similar to the one used by {@link BM25Similarity} in order
- *       to incorporate term frequency into the final score and produces values
- *       between 0 and 1. A value of 0.5 is obtained when S and k are equal.
+ *   <li>{@link #newSaturationQuery satu(S) = w * S / (S + k)}, with k &gt; 0. This function is
+ *       similar to the one used by {@link BM25Similarity} in order to incorporate term frequency
+ *       into the final score and produces values between 0 and 1. A value of 0.5 is obtained when S
+ *       and k are equal.
  *   <li>{@link #newSigmoidQuery sigm(S) = w * S<sup>a</sup> / (S<sup>a</sup> + k<sup>a</sup>)},
- *       with k &gt; 0, a &gt; 0. This function provided even better results
- *       than the two above but is also harder to tune due to the fact it has
- *       2 parameters. Like with {@code satu}, values are in the 0..1 range and
- *       0.5 is obtained when S and k are equal.
- *   <li>{@link #newLinearQuery w * S}. Expert: This function doesn't apply
- *       any transformation to an indexed feature value, and the indexed value itself,
- *       multiplied by weight, determines the score. Thus, there is an expectation
- *       that a feature value is encoded in the index in a way that makes
- *       sense for scoring.
- *
+ *       with k &gt; 0, a &gt; 0. This function provided even better results than the two above but
+ *       is also harder to tune due to the fact it has 2 parameters. Like with {@code satu}, values
+ *       are in the 0..1 range and 0.5 is obtained when S and k are equal.
+ *   <li>{@link #newLinearQuery w * S}. Expert: This function doesn't apply any transformation to an
+ *       indexed feature value, and the indexed value itself, multiplied by weight, determines the
+ *       score. Thus, there is an expectation that a feature value is encoded in the index in a way
+ *       that makes sense for scoring.
  * </ul>
- * <p>
- * The constants in the above formulas typically need training in order to
- * compute optimal values. If you don't know where to start, the
- * {@link #newSaturationQuery(String, String)} method uses
- * {@code 1f} as a weight and tries to guess a sensible value for the
- * {@code pivot} parameter of the saturation function based on index
- * statistics, which shouldn't perform too bad. Here is an example, assuming
- * that documents have a {@link FeatureField} called 'features' with values for
+ *
+ * <p>The constants in the above formulas typically need training in order to compute optimal
+ * values. If you don't know where to start, the {@link #newSaturationQuery(String, String)} method
+ * uses {@code 1f} as a weight and tries to guess a sensible value for the {@code pivot} parameter
+ * of the saturation function based on index statistics, which shouldn't perform too bad. Here is an
+ * example, assuming that documents have a {@link FeatureField} called 'features' with values for
  * the 'pagerank' feature.
+ *
  * <pre class="prettyprint">
  * Query query = new BooleanQuery.Builder()
  *     .add(new TermQuery(new Term("body", "apache")), Occur.SHOULD)
@@ -110,11 +99,13 @@ import org.apache.lucene.search.similarities.Similarity.SimScorer;
  *     .build();
  * TopDocs topDocs = searcher.search(boostedQuery, 10);
  * </pre>
+ *
  * @lucene.experimental
  */
 public final class FeatureField extends Field {
 
   private static final FieldType FIELD_TYPE = new FieldType();
+
   static {
     FIELD_TYPE.setTokenized(false);
     FIELD_TYPE.setOmitNorms(true);
@@ -125,7 +116,9 @@ public final class FeatureField extends Field {
 
   /**
    * Create a feature.
-   * @param fieldName The name of the field to store the information into. All features may be stored in the same field.
+   *
+   * @param fieldName The name of the field to store the information into. All features may be
+   *     stored in the same field.
    * @param featureName The name of the feature, eg. 'pagerank`. It will be indexed as a term.
    * @param featureValue The value of the feature, must be a positive, finite, normal float.
    */
@@ -134,18 +127,27 @@ public final class FeatureField extends Field {
     setFeatureValue(featureValue);
   }
 
-  /**
-   * Update the feature value of this field.
-   */
+  /** Update the feature value of this field. */
   public void setFeatureValue(float featureValue) {
     if (Float.isFinite(featureValue) == false) {
-      throw new IllegalArgumentException("featureValue must be finite, got: " + featureValue +
-          " for feature " + fieldsData + " on field " + name);
+      throw new IllegalArgumentException(
+          "featureValue must be finite, got: "
+              + featureValue
+              + " for feature "
+              + fieldsData
+              + " on field "
+              + name);
     }
     if (featureValue < Float.MIN_NORMAL) {
-      throw new IllegalArgumentException("featureValue must be a positive normal float, got: " +
-          featureValue + " for feature " + fieldsData + " on field " + name +
-          " which is less than the minimum positive normal float: " + Float.MIN_NORMAL);
+      throw new IllegalArgumentException(
+          "featureValue must be a positive normal float, got: "
+              + featureValue
+              + " for feature "
+              + fieldsData
+              + " on field "
+              + name
+              + " which is less than the minimum positive normal float: "
+              + Float.MIN_NORMAL);
     }
     this.featureValue = featureValue;
   }
@@ -171,8 +173,7 @@ public final class FeatureField extends Field {
     private String value = null;
     private int freq = 0;
 
-    private FeatureTokenStream() {
-    }
+    private FeatureTokenStream() {}
 
     /** Sets the values */
     void setValues(String value, int freq) {
@@ -217,10 +218,14 @@ public final class FeatureField extends Field {
     return Float.intBitsToFloat(featureBits);
   }
 
-  static abstract class FeatureFunction {
+  abstract static class FeatureFunction {
     abstract SimScorer scorer(float w);
+
     abstract Explanation explain(String field, String feature, float w, int freq);
-    FeatureFunction rewrite(IndexReader reader) throws IOException { return this; }
+
+    FeatureFunction rewrite(IndexReader reader) throws IOException {
+      return this;
+    }
   }
 
   static final class LinearFunction extends FeatureFunction {
@@ -238,8 +243,13 @@ public final class FeatureField extends Field {
     Explanation explain(String field, String feature, float w, int freq) {
       float featureValue = decodeFeatureValue(freq);
       float score = scorer(w).score(freq, 1L);
-      return Explanation.match(score,
-          "Linear function on the " + field + " field for the " + feature + " feature, computed as w * S from:",
+      return Explanation.match(
+          score,
+          "Linear function on the "
+              + field
+              + " field for the "
+              + feature
+              + " feature, computed as w * S from:",
           Explanation.match(w, "w, weight of this function"),
           Explanation.match(featureValue, "S, feature value"));
     }
@@ -261,7 +271,8 @@ public final class FeatureField extends Field {
       }
       return true;
     }
-  };
+  }
+  ;
 
   static final class LogFunction extends FeatureFunction {
 
@@ -304,8 +315,13 @@ public final class FeatureField extends Field {
     Explanation explain(String field, String feature, float w, int freq) {
       float featureValue = decodeFeatureValue(freq);
       float score = scorer(w).score(freq, 1L);
-      return Explanation.match(score,
-          "Log function on the " + field + " field for the " + feature + " feature, computed as w * log(a + S) from:",
+      return Explanation.match(
+          score,
+          "Log function on the "
+              + field
+              + " field for the "
+              + feature
+              + " feature, computed as w * log(a + S) from:",
           Explanation.match(w, "w, weight of this function"),
           Explanation.match(scalingFactor, "a, scaling factor"),
           Explanation.match(featureValue, "S, feature value"));
@@ -338,9 +354,9 @@ public final class FeatureField extends Field {
         return false;
       }
       SaturationFunction that = (SaturationFunction) obj;
-      return Objects.equals(field, that.field) &&
-          Objects.equals(feature, that.feature) &&
-          Objects.equals(pivot, that.pivot);
+      return Objects.equals(field, that.field)
+          && Objects.equals(feature, that.feature)
+          && Objects.equals(pivot, that.pivot);
     }
 
     @Override
@@ -375,10 +391,16 @@ public final class FeatureField extends Field {
     Explanation explain(String field, String feature, float weight, int freq) {
       float featureValue = decodeFeatureValue(freq);
       float score = scorer(weight).score(freq, 1L);
-      return Explanation.match(score,
-          "Saturation function on the " + field + " field for the " + feature + " feature, computed as w * S / (S + k) from:",
+      return Explanation.match(
+          score,
+          "Saturation function on the "
+              + field
+              + " field for the "
+              + feature
+              + " feature, computed as w * S / (S + k) from:",
           Explanation.match(weight, "w, weight of this function"),
-          Explanation.match(pivot, "k, pivot feature value that would give a score contribution equal to w/2"),
+          Explanation.match(
+              pivot, "k, pivot feature value that would give a score contribution equal to w/2"),
           Explanation.match(featureValue, "S, feature value"));
     }
   }
@@ -400,8 +422,7 @@ public final class FeatureField extends Field {
         return false;
       }
       SigmoidFunction that = (SigmoidFunction) obj;
-      return pivot == that.pivot
-          && a == that.a;
+      return pivot == that.pivot && a == that.a;
     }
 
     @Override
@@ -434,36 +455,44 @@ public final class FeatureField extends Field {
     Explanation explain(String field, String feature, float weight, int freq) {
       float featureValue = decodeFeatureValue(freq);
       float score = scorer(weight).score(freq, 1L);
-      return Explanation.match(score,
-          "Sigmoid function on the " + field + " field for the " + feature + " feature, computed as w * S^a / (S^a + k^a) from:",
+      return Explanation.match(
+          score,
+          "Sigmoid function on the "
+              + field
+              + " field for the "
+              + feature
+              + " feature, computed as w * S^a / (S^a + k^a) from:",
           Explanation.match(weight, "w, weight of this function"),
-          Explanation.match(pivot, "k, pivot feature value that would give a score contribution equal to w/2"),
-          Explanation.match(pivot, "a, exponent, higher values make the function grow slower before k and faster after k"),
+          Explanation.match(
+              pivot, "k, pivot feature value that would give a score contribution equal to w/2"),
+          Explanation.match(
+              pivot,
+              "a, exponent, higher values make the function grow slower before k and faster after k"),
           Explanation.match(featureValue, "S, feature value"));
     }
   }
 
   /**
-   * Given that IDFs are logs, similarities that incorporate term freq and
-   * document length in sane (ie. saturated) ways should have their score
-   * bounded by a log. So we reject weights that are too high as it would mean
-   * that this clause would completely dominate ranking, removing the need for
-   * query-dependent scores.
+   * Given that IDFs are logs, similarities that incorporate term freq and document length in sane
+   * (ie. saturated) ways should have their score bounded by a log. So we reject weights that are
+   * too high as it would mean that this clause would completely dominate ranking, removing the need
+   * for query-dependent scores.
    */
   private static final float MAX_WEIGHT = Long.SIZE;
 
-
   /**
-   * Return a new {@link Query} that will score documents as
-   * {@code weight * S} where S is the value of the static feature.
-   * @param fieldName     field that stores features
-   * @param featureName   name of the feature
-   * @param weight        weight to give to this feature, must be in (0,64]
+   * Return a new {@link Query} that will score documents as {@code weight * S} where S is the value
+   * of the static feature.
+   *
+   * @param fieldName field that stores features
+   * @param featureName name of the feature
+   * @param weight weight to give to this feature, must be in (0,64]
    * @throws IllegalArgumentException if weight is not in (0,64]
    */
   public static Query newLinearQuery(String fieldName, String featureName, float weight) {
     if (weight <= 0 || weight > MAX_WEIGHT) {
-      throw new IllegalArgumentException("weight must be in (0, " + MAX_WEIGHT + "], got: " + weight);
+      throw new IllegalArgumentException(
+          "weight must be in (0, " + MAX_WEIGHT + "], got: " + weight);
     }
     Query q = new FeatureQuery(fieldName, featureName, new LinearFunction());
     if (weight != 1f) {
@@ -473,17 +502,22 @@ public final class FeatureField extends Field {
   }
 
   /**
-   * Return a new {@link Query} that will score documents as
-   * {@code weight * Math.log(scalingFactor + S)} where S is the value of the static feature.
-   * @param fieldName     field that stores features
-   * @param featureName   name of the feature
-   * @param weight        weight to give to this feature, must be in (0,64]
-   * @param scalingFactor scaling factor applied before taking the logarithm, must be in [1, +Infinity)
-   * @throws IllegalArgumentException if weight is not in (0,64] or scalingFactor is not in [1, +Infinity)
+   * Return a new {@link Query} that will score documents as {@code weight * Math.log(scalingFactor
+   * + S)} where S is the value of the static feature.
+   *
+   * @param fieldName field that stores features
+   * @param featureName name of the feature
+   * @param weight weight to give to this feature, must be in (0,64]
+   * @param scalingFactor scaling factor applied before taking the logarithm, must be in [1,
+   *     +Infinity)
+   * @throws IllegalArgumentException if weight is not in (0,64] or scalingFactor is not in [1,
+   *     +Infinity)
    */
-  public static Query newLogQuery(String fieldName, String featureName, float weight, float scalingFactor) {
+  public static Query newLogQuery(
+      String fieldName, String featureName, float weight, float scalingFactor) {
     if (weight <= 0 || weight > MAX_WEIGHT) {
-      throw new IllegalArgumentException("weight must be in (0, " + MAX_WEIGHT + "], got: " + weight);
+      throw new IllegalArgumentException(
+          "weight must be in (0, " + MAX_WEIGHT + "], got: " + weight);
     }
     if (scalingFactor < 1 || Float.isFinite(scalingFactor) == false) {
       throw new IllegalArgumentException("scalingFactor must be >= 1, got: " + scalingFactor);
@@ -496,24 +530,27 @@ public final class FeatureField extends Field {
   }
 
   /**
-   * Return a new {@link Query} that will score documents as
-   * {@code weight * S / (S + pivot)} where S is the value of the static feature.
-   * @param fieldName   field that stores features
+   * Return a new {@link Query} that will score documents as {@code weight * S / (S + pivot)} where
+   * S is the value of the static feature.
+   *
+   * @param fieldName field that stores features
    * @param featureName name of the feature
-   * @param weight      weight to give to this feature, must be in (0,64]
-   * @param pivot       feature value that would give a score contribution equal to weight/2, must be in (0, +Infinity)
+   * @param weight weight to give to this feature, must be in (0,64]
+   * @param pivot feature value that would give a score contribution equal to weight/2, must be in
+   *     (0, +Infinity)
    * @throws IllegalArgumentException if weight is not in (0,64] or pivot is not in (0, +Infinity)
    */
-  public static Query newSaturationQuery(String fieldName, String featureName, float weight, float pivot) {
+  public static Query newSaturationQuery(
+      String fieldName, String featureName, float weight, float pivot) {
     return newSaturationQuery(fieldName, featureName, weight, Float.valueOf(pivot));
   }
 
   /**
-   * Same as {@link #newSaturationQuery(String, String, float, float)} but
-   * {@code 1f} is used as a weight and a reasonably good default pivot value
-   * is computed based on index statistics and is approximately equal to the
-   * geometric mean of all values that exist in the index.
-   * @param fieldName   field that stores features
+   * Same as {@link #newSaturationQuery(String, String, float, float)} but {@code 1f} is used as a
+   * weight and a reasonably good default pivot value is computed based on index statistics and is
+   * approximately equal to the geometric mean of all values that exist in the index.
+   *
+   * @param fieldName field that stores features
    * @param featureName name of the feature
    * @throws IllegalArgumentException if weight is not in (0,64] or pivot is not in (0, +Infinity)
    */
@@ -521,14 +558,18 @@ public final class FeatureField extends Field {
     return newSaturationQuery(fieldName, featureName, 1f, null);
   }
 
-  private static Query newSaturationQuery(String fieldName, String featureName, float weight, Float pivot) {
+  private static Query newSaturationQuery(
+      String fieldName, String featureName, float weight, Float pivot) {
     if (weight <= 0 || weight > MAX_WEIGHT) {
-      throw new IllegalArgumentException("weight must be in (0, " + MAX_WEIGHT + "], got: " + weight);
+      throw new IllegalArgumentException(
+          "weight must be in (0, " + MAX_WEIGHT + "], got: " + weight);
     }
     if (pivot != null && (pivot <= 0 || Float.isFinite(pivot) == false)) {
       throw new IllegalArgumentException("pivot must be > 0, got: " + pivot);
     }
-    Query q = new FeatureQuery(fieldName, featureName, new SaturationFunction(fieldName, featureName, pivot));
+    Query q =
+        new FeatureQuery(
+            fieldName, featureName, new SaturationFunction(fieldName, featureName, pivot));
     if (weight != 1f) {
       q = new BoostQuery(q, weight);
     }
@@ -536,18 +577,24 @@ public final class FeatureField extends Field {
   }
 
   /**
-   * Return a new {@link Query} that will score documents as
-   * {@code weight * S^a / (S^a + pivot^a)} where S is the value of the static feature.
-   * @param fieldName   field that stores features
+   * Return a new {@link Query} that will score documents as {@code weight * S^a / (S^a + pivot^a)}
+   * where S is the value of the static feature.
+   *
+   * @param fieldName field that stores features
    * @param featureName name of the feature
-   * @param weight      weight to give to this feature, must be in (0,64]
-   * @param pivot       feature value that would give a score contribution equal to weight/2, must be in (0, +Infinity)
-   * @param exp         exponent, higher values make the function grow slower before 'pivot' and faster after 'pivot', must be in (0, +Infinity)
-   * @throws IllegalArgumentException if w is not in (0,64] or either k or a are not in (0, +Infinity)
+   * @param weight weight to give to this feature, must be in (0,64]
+   * @param pivot feature value that would give a score contribution equal to weight/2, must be in
+   *     (0, +Infinity)
+   * @param exp exponent, higher values make the function grow slower before 'pivot' and faster
+   *     after 'pivot', must be in (0, +Infinity)
+   * @throws IllegalArgumentException if w is not in (0,64] or either k or a are not in (0,
+   *     +Infinity)
    */
-  public static Query newSigmoidQuery(String fieldName, String featureName, float weight, float pivot, float exp) {
+  public static Query newSigmoidQuery(
+      String fieldName, String featureName, float weight, float pivot, float exp) {
     if (weight <= 0 || weight > MAX_WEIGHT) {
-      throw new IllegalArgumentException("weight must be in (0, " + MAX_WEIGHT + "], got: " + weight);
+      throw new IllegalArgumentException(
+          "weight must be in (0, " + MAX_WEIGHT + "], got: " + weight);
     }
     if (pivot <= 0 || Float.isFinite(pivot) == false) {
       throw new IllegalArgumentException("pivot must be > 0, got: " + pivot);
@@ -563,18 +610,19 @@ public final class FeatureField extends Field {
   }
 
   /**
-   * Compute a feature value that may be used as the {@code pivot} parameter of
-   * the {@link #newSaturationQuery(String, String, float, float)} and
-   * {@link #newSigmoidQuery(String, String, float, float, float)} factory
-   * methods. The implementation takes the average of the int bits of the float
-   * representation in practice before converting it back to a float. Given that
-   * floats store the exponent in the higher bits, it means that the result will
-   * be an approximation of the geometric mean of all feature values.
-   * @param reader       the {@link IndexReader} to search against
+   * Compute a feature value that may be used as the {@code pivot} parameter of the {@link
+   * #newSaturationQuery(String, String, float, float)} and {@link #newSigmoidQuery(String, String,
+   * float, float, float)} factory methods. The implementation takes the average of the int bits of
+   * the float representation in practice before converting it back to a float. Given that floats
+   * store the exponent in the higher bits, it means that the result will be an approximation of the
+   * geometric mean of all feature values.
+   *
+   * @param reader the {@link IndexReader} to search against
    * @param featureField the field that stores features
-   * @param featureName  the name of the feature
+   * @param featureName the name of the feature
    */
-  static float computePivotFeatureValue(IndexReader reader, String featureField, String featureName) throws IOException {
+  static float computePivotFeatureValue(IndexReader reader, String featureField, String featureName)
+      throws IOException {
     Term term = new Term(featureField, featureName);
     TermStates states = TermStates.build(reader.getContext(), term, true);
     if (states.docFreq() == 0) {
@@ -590,13 +638,15 @@ public final class FeatureField extends Field {
 
   /**
    * Creates a SortField for sorting by the value of a feature.
+   *
+   * <p>This sort orders documents by descending value of a feature. The value returned in {@link
+   * FieldDoc} for the hits contains a Float instance with the feature value.
+   *
+   * <p>If a document is missing the field, then it is treated as having a vaue of <code>0.0f</code>
+   * .
+   *
    * <p>
-   * This sort orders documents by descending value of a feature. The value returned in {@link FieldDoc} for
-   * the hits contains a Float instance with the feature value.
-   * <p>
-   * If a document is missing the field, then it is treated as having a vaue of <code>0.0f</code>.
-   * <p>
-   * 
+   *
    * @param field field name. Must not be null.
    * @param featureName feature name. Must not be null.
    * @return SortField ordering documents by the value of the feature
@@ -605,14 +655,15 @@ public final class FeatureField extends Field {
   public static SortField newFeatureSort(String field, String featureName) {
     return new FeatureSortField(field, featureName);
   }
-  
+
   /**
-   * Creates a {@link DoubleValuesSource} instance which can be used to read the values of a feature from the a 
-   * {@link FeatureField} for documents.
-   * 
+   * Creates a {@link DoubleValuesSource} instance which can be used to read the values of a feature
+   * from the a {@link FeatureField} for documents.
+   *
    * @param field field name. Must not be null.
    * @param featureName feature name. Must not be null.
-   * @return a {@link DoubleValuesSource} which can be used to access the values of the feature for documents
+   * @return a {@link DoubleValuesSource} which can be used to access the values of the feature for
+   *     documents
    * @throws NullPointerException if {@code field} or {@code featureName} is null.
    */
   public static DoubleValuesSource newDoubleValues(String field, String featureName) {
diff --git a/lucene/core/src/java/org/apache/lucene/document/FeatureQuery.java b/lucene/core/src/java/org/apache/lucene/document/FeatureQuery.java
index bc69344..bdd00ef 100644
--- a/lucene/core/src/java/org/apache/lucene/document/FeatureQuery.java
+++ b/lucene/core/src/java/org/apache/lucene/document/FeatureQuery.java
@@ -18,7 +18,6 @@ package org.apache.lucene.document;
 
 import java.io.IOException;
 import java.util.Objects;
-
 import org.apache.lucene.document.FeatureField.FeatureFunction;
 import org.apache.lucene.index.ImpactsEnum;
 import org.apache.lucene.index.IndexReader;
@@ -65,9 +64,9 @@ final class FeatureQuery extends Query {
       return false;
     }
     FeatureQuery that = (FeatureQuery) obj;
-    return Objects.equals(fieldName, that.fieldName) &&
-        Objects.equals(featureName, that.featureName) &&
-        Objects.equals(function, that.function);
+    return Objects.equals(fieldName, that.fieldName)
+        && Objects.equals(featureName, that.featureName)
+        && Objects.equals(function, that.function);
   }
 
   @Override
@@ -80,7 +79,8 @@ final class FeatureQuery extends Query {
   }
 
   @Override
-  public Weight createWeight(IndexSearcher searcher, ScoreMode scoreMode, float boost) throws IOException {
+  public Weight createWeight(IndexSearcher searcher, ScoreMode scoreMode, float boost)
+      throws IOException {
     return new Weight(this) {
 
       @Override
@@ -157,7 +157,6 @@ final class FeatureQuery extends Query {
           }
         };
       }
-
     };
   }
 
@@ -170,7 +169,12 @@ final class FeatureQuery extends Query {
 
   @Override
   public String toString(String field) {
-    return "FeatureQuery(field=" + fieldName + ", feature=" + featureName + ", function=" + function + ")";
+    return "FeatureQuery(field="
+        + fieldName
+        + ", feature="
+        + featureName
+        + ", function="
+        + function
+        + ")";
   }
-
 }
diff --git a/lucene/core/src/java/org/apache/lucene/document/FeatureSortField.java b/lucene/core/src/java/org/apache/lucene/document/FeatureSortField.java
index 1e73f8c..f06ead5 100644
--- a/lucene/core/src/java/org/apache/lucene/document/FeatureSortField.java
+++ b/lucene/core/src/java/org/apache/lucene/document/FeatureSortField.java
@@ -18,7 +18,6 @@ package org.apache.lucene.document;
 
 import java.io.IOException;
 import java.util.Objects;
-
 import org.apache.lucene.index.LeafReaderContext;
 import org.apache.lucene.index.PostingsEnum;
 import org.apache.lucene.index.Terms;
@@ -28,16 +27,14 @@ import org.apache.lucene.search.SimpleFieldComparator;
 import org.apache.lucene.search.SortField;
 import org.apache.lucene.util.BytesRef;
 
-/**
- * Sorts using the value of a specified feature name from a {@link FeatureField}.
- */
+/** Sorts using the value of a specified feature name from a {@link FeatureField}. */
 final class FeatureSortField extends SortField {
 
   private final String featureName;
 
   /**
-   * Creates a {@link FeatureSortField} that can be used to sort hits by
-   * the value of a particular feature in a {@link FeatureField}.
+   * Creates a {@link FeatureSortField} that can be used to sort hits by the value of a particular
+   * feature in a {@link FeatureField}.
    *
    * @param featureName The name of the feature to use for the sort value
    */
@@ -45,17 +42,17 @@ final class FeatureSortField extends SortField {
     super(Objects.requireNonNull(field), SortField.Type.CUSTOM, true);
     this.featureName = Objects.requireNonNull(featureName);
   }
-  
+
   @Override
   public FieldComparator<?> getComparator(int numHits, int sortPos) {
     return new FeatureComparator(numHits, getField(), featureName);
   }
-  
+
   @Override
   public void setMissingValue(Object missingValue) {
     throw new IllegalArgumentException("Missing value not supported for FeatureSortField");
   }
-  
+
   @Override
   public int hashCode() {
     final int prime = 31;
@@ -112,14 +109,17 @@ final class FeatureSortField extends SortField {
         if (termsEnum.seekExact(featureName) == false) {
           currentReaderPostingsValues = null;
         } else {
-          currentReaderPostingsValues = termsEnum.postings(currentReaderPostingsValues, PostingsEnum.FREQS);
+          currentReaderPostingsValues =
+              termsEnum.postings(currentReaderPostingsValues, PostingsEnum.FREQS);
         }
       }
     }
 
     private float getValueForDoc(int doc) throws IOException {
-      if (currentReaderPostingsValues != null && doc >= currentReaderPostingsValues.docID()
-          && (currentReaderPostingsValues.docID() == doc || currentReaderPostingsValues.advance(doc) == doc)) {
+      if (currentReaderPostingsValues != null
+          && doc >= currentReaderPostingsValues.docID()
+          && (currentReaderPostingsValues.docID() == doc
+              || currentReaderPostingsValues.advance(doc) == doc)) {
         return FeatureField.decodeFeatureValue(currentReaderPostingsValues.freq());
       } else {
         return 0.0f;
diff --git a/lucene/core/src/java/org/apache/lucene/document/Field.java b/lucene/core/src/java/org/apache/lucene/document/Field.java
index 2f0f13b..ef66bef 100644
--- a/lucene/core/src/java/org/apache/lucene/document/Field.java
+++ b/lucene/core/src/java/org/apache/lucene/document/Field.java
@@ -16,10 +16,8 @@
  */
 package org.apache.lucene.document;
 
-
 import java.io.IOException;
 import java.io.Reader;
-
 import org.apache.lucene.analysis.Analyzer;
 import org.apache.lucene.analysis.TokenStream;
 import org.apache.lucene.analysis.tokenattributes.BytesTermAttribute;
@@ -31,62 +29,57 @@ import org.apache.lucene.index.IndexableFieldType;
 import org.apache.lucene.util.BytesRef;
 
 /**
- * Expert: directly create a field for a document.  Most
- * users should use one of the sugar subclasses: 
+ * Expert: directly create a field for a document. Most users should use one of the sugar
+ * subclasses:
+ *
  * <ul>
- *    <li>{@link TextField}: {@link Reader} or {@link String} indexed for full-text search
- *    <li>{@link StringField}: {@link String} indexed verbatim as a single token
- *    <li>{@link IntPoint}: {@code int} indexed for exact/range queries.
- *    <li>{@link LongPoint}: {@code long} indexed for exact/range queries.
- *    <li>{@link FloatPoint}: {@code float} indexed for exact/range queries.
- *    <li>{@link DoublePoint}: {@code double} indexed for exact/range queries.
- *    <li>{@link SortedDocValuesField}: {@code byte[]} indexed column-wise for sorting/faceting
- *    <li>{@link SortedSetDocValuesField}: {@code SortedSet<byte[]>} indexed column-wise for sorting/faceting
- *    <li>{@link NumericDocValuesField}: {@code long} indexed column-wise for sorting/faceting
- *    <li>{@link SortedNumericDocValuesField}: {@code SortedSet<long>} indexed column-wise for sorting/faceting
- *    <li>{@link StoredField}: Stored-only value for retrieving in summary results
+ *   <li>{@link TextField}: {@link Reader} or {@link String} indexed for full-text search
+ *   <li>{@link StringField}: {@link String} indexed verbatim as a single token
+ *   <li>{@link IntPoint}: {@code int} indexed for exact/range queries.
+ *   <li>{@link LongPoint}: {@code long} indexed for exact/range queries.
+ *   <li>{@link FloatPoint}: {@code float} indexed for exact/range queries.
+ *   <li>{@link DoublePoint}: {@code double} indexed for exact/range queries.
+ *   <li>{@link SortedDocValuesField}: {@code byte[]} indexed column-wise for sorting/faceting
+ *   <li>{@link SortedSetDocValuesField}: {@code SortedSet<byte[]>} indexed column-wise for
+ *       sorting/faceting
+ *   <li>{@link NumericDocValuesField}: {@code long} indexed column-wise for sorting/faceting
+ *   <li>{@link SortedNumericDocValuesField}: {@code SortedSet<long>} indexed column-wise for
+ *       sorting/faceting
+ *   <li>{@link StoredField}: Stored-only value for retrieving in summary results
  * </ul>
  *
- * <p> A field is a section of a Document. Each field has three
- * parts: name, type and value. Values may be text
- * (String, Reader or pre-analyzed TokenStream), binary
- * (byte[]), or numeric (a Number).  Fields are optionally stored in the
- * index, so that they may be returned with hits on the document.
+ * <p>A field is a section of a Document. Each field has three parts: name, type and value. Values
+ * may be text (String, Reader or pre-analyzed TokenStream), binary (byte[]), or numeric (a Number).
+ * Fields are optionally stored in the index, so that they may be returned with hits on the
+ * document.
  *
- * <p>
- * NOTE: the field type is an {@link IndexableFieldType}.  Making changes
- * to the state of the IndexableFieldType will impact any
- * Field it is used in.  It is strongly recommended that no
+ * <p>NOTE: the field type is an {@link IndexableFieldType}. Making changes to the state of the
+ * IndexableFieldType will impact any Field it is used in. It is strongly recommended that no
  * changes be made after Field instantiation.
  */
 public class Field implements IndexableField {
 
-  /**
-   * Field's type
-   */
+  /** Field's type */
   protected final IndexableFieldType type;
 
-  /**
-   * Field's name
-   */
+  /** Field's name */
   protected final String name;
 
   /** Field's value */
   protected Object fieldsData;
 
-  /** Pre-analyzed tokenStream for indexed fields; this is
-   * separate from fieldsData because you are allowed to
-   * have both; eg maybe field has a String value but you
-   * customize how it's tokenized */
+  /**
+   * Pre-analyzed tokenStream for indexed fields; this is separate from fieldsData because you are
+   * allowed to have both; eg maybe field has a String value but you customize how it's tokenized
+   */
   protected TokenStream tokenStream;
 
   /**
-   * Expert: creates a field with no initial value.
-   * Intended only for custom Field subclasses.
+   * Expert: creates a field with no initial value. Intended only for custom Field subclasses.
+   *
    * @param name field name
    * @param type field type
-   * @throws IllegalArgumentException if either the name or type
-   *         is null.
+   * @throws IllegalArgumentException if either the name or type is null.
    */
   protected Field(String name, IndexableFieldType type) {
     if (name == null) {
@@ -101,12 +94,12 @@ public class Field implements IndexableField {
 
   /**
    * Create field with Reader value.
+   *
    * @param name field name
    * @param reader reader value
    * @param type field type
-   * @throws IllegalArgumentException if either the name or type
-   *         is null, or if the field's type is stored(), or
-   *         if tokenized() is false.
+   * @throws IllegalArgumentException if either the name or type is null, or if the field's type is
+   *     stored(), or if tokenized() is false.
    * @throws NullPointerException if the reader is null
    */
   public Field(String name, Reader reader, IndexableFieldType type) {
@@ -125,7 +118,7 @@ public class Field implements IndexableField {
     if (type.indexOptions() != IndexOptions.NONE && !type.tokenized()) {
       throw new IllegalArgumentException("non-tokenized fields must use String values");
     }
-    
+
     this.name = name;
     this.fieldsData = reader;
     this.type = type;
@@ -133,12 +126,12 @@ public class Field implements IndexableField {
 
   /**
    * Create field with TokenStream value.
+   *
    * @param name field name
    * @param tokenStream TokenStream value
    * @param type field type
-   * @throws IllegalArgumentException if either the name or type
-   *         is null, or if the field's type is stored(), or
-   *         if tokenized() is false, or if indexed() is false.
+   * @throws IllegalArgumentException if either the name or type is null, or if the field's type is
+   *     stored(), or if tokenized() is false, or if indexed() is false.
    * @throws NullPointerException if the tokenStream is null
    */
   public Field(String name, TokenStream tokenStream, IndexableFieldType type) {
@@ -154,23 +147,24 @@ public class Field implements IndexableField {
     if (type.stored()) {
       throw new IllegalArgumentException("TokenStream fields cannot be stored");
     }
-    
+
     this.name = name;
     this.fieldsData = null;
     this.tokenStream = tokenStream;
     this.type = type;
   }
-  
+
   /**
    * Create field with binary value.
-   * 
-   * <p>NOTE: the provided byte[] is not copied so be sure
-   * not to change it until you're done with this field.
+   *
+   * <p>NOTE: the provided byte[] is not copied so be sure not to change it until you're done with
+   * this field.
+   *
    * @param name field name
    * @param value byte array pointing to binary content (not copied)
    * @param type field type
-   * @throws IllegalArgumentException if the field name, value or type
-   *         is null, or the field's type is indexed().
+   * @throws IllegalArgumentException if the field name, value or type is null, or the field's type
+   *     is indexed().
    */
   public Field(String name, byte[] value, IndexableFieldType type) {
     this(name, value, 0, value.length, type);
@@ -178,16 +172,17 @@ public class Field implements IndexableField {
 
   /**
    * Create field with binary value.
-   * 
-   * <p>NOTE: the provided byte[] is not copied so be sure
-   * not to change it until you're done with this field.
+   *
+   * <p>NOTE: the provided byte[] is not copied so be sure not to change it until you're done with
+   * this field.
+   *
    * @param name field name
    * @param value byte array pointing to binary content (not copied)
    * @param offset starting position of the byte array
    * @param length valid length of the byte array
    * @param type field type
-   * @throws IllegalArgumentException if the field name, value or type
-   *         is null, or the field's type is indexed().
+   * @throws IllegalArgumentException if the field name, value or type is null, or the field's type
+   *     is indexed().
    */
   public Field(String name, byte[] value, int offset, int length, IndexableFieldType type) {
     this(name, value != null ? new BytesRef(value, offset, length) : null, type);
@@ -196,13 +191,14 @@ public class Field implements IndexableField {
   /**
    * Create field with binary value.
    *
-   * <p>NOTE: the provided BytesRef is not copied so be sure
-   * not to change it until you're done with this field.
+   * <p>NOTE: the provided BytesRef is not copied so be sure not to change it until you're done with
+   * this field.
+   *
    * @param name field name
    * @param bytes BytesRef pointing to binary content (not copied)
    * @param type field type
-   * @throws IllegalArgumentException if the field name, bytes or type
-   *         is null, or the field's type is indexed().
+   * @throws IllegalArgumentException if the field name, bytes or type is null, or the field's type
+   *     is indexed().
    */
   public Field(String name, BytesRef bytes, IndexableFieldType type) {
     if (name == null) {
@@ -223,12 +219,13 @@ public class Field implements IndexableField {
 
   /**
    * Create field with String value.
+   *
    * @param name field name
    * @param value string value
    * @param type field type
-   * @throws IllegalArgumentException if either the name, value or type
-   *         is null, or if the field's type is neither indexed() nor stored(), 
-   *         or if indexed() is false but storeTermVectors() is true.
+   * @throws IllegalArgumentException if either the name, value or type is null, or if the field's
+   *     type is neither indexed() nor stored(), or if indexed() is false but storeTermVectors() is
+   *     true.
    */
   public Field(String name, CharSequence value, IndexableFieldType type) {
     if (name == null) {
@@ -241,8 +238,8 @@ public class Field implements IndexableField {
       throw new IllegalArgumentException("type must not be null");
     }
     if (!type.stored() && type.indexOptions() == IndexOptions.NONE) {
-      throw new IllegalArgumentException("it doesn't make sense to have a field that "
-        + "is neither indexed nor stored");
+      throw new IllegalArgumentException(
+          "it doesn't make sense to have a field that " + "is neither indexed nor stored");
     }
     this.name = name;
     this.fieldsData = value;
@@ -250,9 +247,8 @@ public class Field implements IndexableField {
   }
 
   /**
-   * The value of the field as a String, or null. If null, the Reader value or
-   * binary value is used. Exactly one of stringValue(), readerValue(), and
-   * binaryValue() must be set.
+   * The value of the field as a String, or null. If null, the Reader value or binary value is used.
+   * Exactly one of stringValue(), readerValue(), and binaryValue() must be set.
    */
   @Override
   public String stringValue() {
@@ -265,83 +261,73 @@ public class Field implements IndexableField {
 
   @Override
   public CharSequence getCharSequenceValue() {
-    return fieldsData instanceof CharSequence ?
-        (CharSequence) fieldsData : stringValue();
+    return fieldsData instanceof CharSequence ? (CharSequence) fieldsData : stringValue();
   }
 
   /**
-   * The value of the field as a Reader, or null. If null, the String value or
-   * binary value is used. Exactly one of stringValue(), readerValue(), and
-   * binaryValue() must be set.
+   * The value of the field as a Reader, or null. If null, the String value or binary value is used.
+   * Exactly one of stringValue(), readerValue(), and binaryValue() must be set.
    */
   @Override
   public Reader readerValue() {
     return fieldsData instanceof Reader ? (Reader) fieldsData : null;
   }
-  
+
   /**
-   * The TokenStream for this field to be used when indexing, or null. If null,
-   * the Reader value or String value is analyzed to produce the indexed tokens.
+   * The TokenStream for this field to be used when indexing, or null. If null, the Reader value or
+   * String value is analyzed to produce the indexed tokens.
    */
   public TokenStream tokenStreamValue() {
     return tokenStream;
   }
-  
+
   /**
-   * <p>
-   * Expert: change the value of this field. This can be used during indexing to
-   * re-use a single Field instance to improve indexing speed by avoiding GC
-   * cost of new'ing and reclaiming Field instances. Typically a single
-   * {@link Document} instance is re-used as well. This helps most on small
-   * documents.
-   * </p>
-   * 
-   * <p>
-   * Each Field instance should only be used once within a single
-   * {@link Document} instance. See <a
-   * href="http://wiki.apache.org/lucene-java/ImproveIndexingSpeed"
-   * >ImproveIndexingSpeed</a> for details.
-   * </p>
+   * Expert: change the value of this field. This can be used during indexing to re-use a single
+   * Field instance to improve indexing speed by avoiding GC cost of new'ing and reclaiming Field
+   * instances. Typically a single {@link Document} instance is re-used as well. This helps most on
+   * small documents.
+   *
+   * <p>Each Field instance should only be used once within a single {@link Document} instance. See
+   * <a href="http://wiki.apache.org/lucene-java/ImproveIndexingSpeed" >ImproveIndexingSpeed</a> for
+   * details.
    */
   public void setStringValue(String value) {
     if (!(fieldsData instanceof String)) {
-      throw new IllegalArgumentException("cannot change value type from " + fieldsData.getClass().getSimpleName() + " to String");
+      throw new IllegalArgumentException(
+          "cannot change value type from " + fieldsData.getClass().getSimpleName() + " to String");
     }
     if (value == null) {
       throw new IllegalArgumentException("value must not be null");
     }
     fieldsData = value;
   }
-  
-  /**
-   * Expert: change the value of this field. See 
-   * {@link #setStringValue(String)}.
-   */
+
+  /** Expert: change the value of this field. See {@link #setStringValue(String)}. */
   public void setReaderValue(Reader value) {
     if (!(fieldsData instanceof Reader)) {
-      throw new IllegalArgumentException("cannot change value type from " + fieldsData.getClass().getSimpleName() + " to Reader");
+      throw new IllegalArgumentException(
+          "cannot change value type from " + fieldsData.getClass().getSimpleName() + " to Reader");
     }
     fieldsData = value;
   }
-  
-  /**
-   * Expert: change the value of this field. See 
-   * {@link #setStringValue(String)}.
-   */
+
+  /** Expert: change the value of this field. See {@link #setStringValue(String)}. */
   public void setBytesValue(byte[] value) {
     setBytesValue(new BytesRef(value));
   }
 
   /**
-   * Expert: change the value of this field. See 
-   * {@link #setStringValue(String)}.
+   * Expert: change the value of this field. See {@link #setStringValue(String)}.
    *
-   * <p>NOTE: the provided BytesRef is not copied so be sure
-   * not to change it until you're done with this field.
+   * <p>NOTE: the provided BytesRef is not copied so be sure not to change it until you're done with
+   * this field.
    */
   public void setBytesValue(BytesRef value) {
     if (!(fieldsData instanceof BytesRef)) {
-      throw new IllegalArgumentException("cannot change value type from " + fieldsData.getClass().getSimpleName() + " to BytesRef");
+      throw new IllegalArgumentException(
+          "cannot change value type from "
+              + fieldsData.getClass().getSimpleName()
+              + " to BytesRef");
     }
     if (type.indexOptions() != IndexOptions.NONE) {
       throw new IllegalArgumentException("cannot set a BytesRef value on an indexed field");
@@ -352,76 +338,63 @@ public class Field implements IndexableField {
     fieldsData = value;
   }
 
-  /**
-   * Expert: change the value of this field. See 
-   * {@link #setStringValue(String)}.
-   */
+  /** Expert: change the value of this field. See {@link #setStringValue(String)}. */
   public void setByteValue(byte value) {
     if (!(fieldsData instanceof Byte)) {
-      throw new IllegalArgumentException("cannot change value type from " + fieldsData.getClass().getSimpleName() + " to Byte");
+      throw new IllegalArgumentException(
+          "cannot change value type from " + fieldsData.getClass().getSimpleName() + " to Byte");
     }
     fieldsData = Byte.valueOf(value);
   }
 
-  /**
-   * Expert: change the value of this field. See 
-   * {@link #setStringValue(String)}.
-   */
+  /** Expert: change the value of this field. See {@link #setStringValue(String)}. */
   public void setShortValue(short value) {
     if (!(fieldsData instanceof Short)) {
-      throw new IllegalArgumentException("cannot change value type from " + fieldsData.getClass().getSimpleName() + " to Short");
+      throw new IllegalArgumentException(
+          "cannot change value type from " + fieldsData.getClass().getSimpleName() + " to Short");
     }
     fieldsData = Short.valueOf(value);
   }
 
-  /**
-   * Expert: change the value of this field. See 
-   * {@link #setStringValue(String)}.
-   */
+  /** Expert: change the value of this field. See {@link #setStringValue(String)}. */
   public void setIntValue(int value) {
     if (!(fieldsData instanceof Integer)) {
-      throw new IllegalArgumentException("cannot change value type from " + fieldsData.getClass().getSimpleName() + " to Integer");
+      throw new IllegalArgumentException(
+          "cannot change value type from " + fieldsData.getClass().getSimpleName() + " to Integer");
     }
     fieldsData = Integer.valueOf(value);
   }
 
-  /**
-   * Expert: change the value of this field. See 
-   * {@link #setStringValue(String)}.
-   */
+  /** Expert: change the value of this field. See {@link #setStringValue(String)}. */
   public void setLongValue(long value) {
     if (!(fieldsData instanceof Long)) {
-      throw new IllegalArgumentException("cannot change value type from " + fieldsData.getClass().getSimpleName() + " to Long");
+      throw new IllegalArgumentException(
+          "cannot change value type from " + fieldsData.getClass().getSimpleName() + " to Long");
     }
     fieldsData = Long.valueOf(value);
   }
 
-  /**
-   * Expert: change the value of this field. See 
-   * {@link #setStringValue(String)}.
-   */
+  /** Expert: change the value of this field. See {@link #setStringValue(String)}. */
   public void setFloatValue(float value) {
     if (!(fieldsData instanceof Float)) {
-      throw new IllegalArgumentException("cannot change value type from " + fieldsData.getClass().getSimpleName() + " to Float");
+      throw new IllegalArgumentException(
+          "cannot change value type from " + fieldsData.getClass().getSimpleName() + " to Float");
     }
     fieldsData = Float.valueOf(value);
   }
 
-  /**
-   * Expert: change the value of this field. See 
-   * {@link #setStringValue(String)}.
-   */
+  /** Expert: change the value of this field. See {@link #setStringValue(String)}. */
   public void setDoubleValue(double value) {
     if (!(fieldsData instanceof Double)) {
-      throw new IllegalArgumentException("cannot change value type from " + fieldsData.getClass().getSimpleName() + " to Double");
+      throw new IllegalArgumentException(
+          "cannot change value type from " + fieldsData.getClass().getSimpleName() + " to Double");
     }
     fieldsData = Double.valueOf(value);
   }
 
   /**
-   * Expert: sets the token stream to be used for indexing and causes
-   * isIndexed() and isTokenized() to return true. May be combined with stored
-   * values from stringValue() or binaryValue()
+   * Expert: sets the token stream to be used for indexing and causes isIndexed() and isTokenized()
+   * to return true. May be combined with stored values from stringValue() or binaryValue()
    */
   public void setTokenStream(TokenStream tokenStream) {
     if (type.indexOptions() == IndexOptions.NONE || !type.tokenized()) {
@@ -429,7 +402,7 @@ public class Field implements IndexableField {
     }
     this.tokenStream = tokenStream;
   }
-  
+
   @Override
   public String name() {
     return name;
@@ -469,7 +442,7 @@ public class Field implements IndexableField {
     result.append('>');
     return result.toString();
   }
-  
+
   /** Returns the {@link FieldType} for this field. */
   @Override
   public IndexableFieldType fieldType() {
@@ -513,25 +486,27 @@ public class Field implements IndexableField {
       return analyzer.tokenStream(name(), stringValue());
     }
 
-    throw new IllegalArgumentException("Field must have either TokenStream, String, Reader or Number value; got " + this);
+    throw new IllegalArgumentException(
+        "Field must have either TokenStream, String, Reader or Number value; got " + this);
   }
-  
+
   private static final class BinaryTokenStream extends TokenStream {
     private final BytesTermAttribute bytesAtt = addAttribute(BytesTermAttribute.class);
     private boolean used = true;
     private BytesRef value;
-  
-    /** Creates a new TokenStream that returns a BytesRef as single token.
-     * <p>Warning: Does not initialize the value, you must call
-     * {@link #setValue(BytesRef)} afterwards!
+
+    /**
+     * Creates a new TokenStream that returns a BytesRef as single token.
+     *
+     * <p>Warning: Does not initialize the value, you must call {@link #setValue(BytesRef)}
+     * afterwards!
      */
-    BinaryTokenStream() {
-    }
+    BinaryTokenStream() {}
 
     public void setValue(BytesRef value) {
       this.value = value;
     }
-  
+
     @Override
     public boolean incrementToken() {
       if (used) {
@@ -542,7 +517,7 @@ public class Field implements IndexableField {
       used = true;
       return true;
     }
-  
+
     @Override
     public void reset() {
       used = false;
@@ -559,14 +534,15 @@ public class Field implements IndexableField {
     private final OffsetAttribute offsetAttribute = addAttribute(OffsetAttribute.class);
     private boolean used = true;
     private String value = null;
-    
-    /** Creates a new TokenStream that returns a String as single token.
-     * <p>Warning: Does not initialize the value, you must call
-     * {@link #setValue(String)} afterwards!
+
+    /**
+     * Creates a new TokenStream that returns a String as single token.
+     *
+     * <p>Warning: Does not initialize the value, you must call {@link #setValue(String)}
+     * afterwards!
      */
-    StringTokenStream() {
-    }
-    
+    StringTokenStream() {}
+
     /** Sets the string value. */
     void setValue(String value) {
       this.value = value;
@@ -590,7 +566,7 @@ public class Field implements IndexableField {
       final int finalOffset = value.length();
       offsetAttribute.setOffset(finalOffset, finalOffset);
     }
-    
+
     @Override
     public void reset() {
       used = false;
@@ -605,10 +581,10 @@ public class Field implements IndexableField {
   /** Specifies whether and how a field should be stored. */
   public static enum Store {
 
-    /** Store the original field value in the index. This is useful for short texts
-     * like a document's title which should be displayed with the results. The
-     * value is stored in its original form, i.e. no analyzer is used before it is
-     * stored.
+    /**
+     * Store the original field value in the index. This is useful for short texts like a document's
+     * title which should be displayed with the results. The value is stored in its original form,
+     * i.e. no analyzer is used before it is stored.
      */
     YES,
 
diff --git a/lucene/core/src/java/org/apache/lucene/document/FieldType.java b/lucene/core/src/java/org/apache/lucene/document/FieldType.java
index b89be8b..b04b2f6 100644
--- a/lucene/core/src/java/org/apache/lucene/document/FieldType.java
+++ b/lucene/core/src/java/org/apache/lucene/document/FieldType.java
@@ -16,10 +16,8 @@
  */
 package org.apache.lucene.document;
 
-
 import java.util.HashMap;
 import java.util.Map;
-
 import org.apache.lucene.analysis.Analyzer; // javadocs
 import org.apache.lucene.index.DocValuesType;
 import org.apache.lucene.index.IndexOptions;
@@ -27,10 +25,8 @@ import org.apache.lucene.index.IndexableFieldType;
 import org.apache.lucene.index.PointValues;
 import org.apache.lucene.index.VectorValues;
 
-/**
- * Describes the properties of a field.
- */
-public class FieldType implements IndexableFieldType  {
+/** Describes the properties of a field. */
+public class FieldType implements IndexableFieldType {
 
   private boolean stored;
   private boolean tokenized = true;
@@ -49,9 +45,7 @@ public class FieldType implements IndexableFieldType  {
   private VectorValues.SearchStrategy vectorSearchStrategy = VectorValues.SearchStrategy.NONE;
   private Map<String, String> attributes;
 
-  /**
-   * Create a new mutable FieldType with all of the properties from <code>ref</code>
-   */
+  /** Create a new mutable FieldType with all of the properties from <code>ref</code> */
   public FieldType(IndexableFieldType ref) {
     this.stored = ref.stored();
     this.tokenized = ref.tokenized();
@@ -72,16 +66,13 @@ public class FieldType implements IndexableFieldType  {
     }
     // Do not copy frozen!
   }
-  
-  /**
-   * Create a new FieldType with default properties.
-   */
-  public FieldType() {
-  }
+
+  /** Create a new FieldType with default properties. */
+  public FieldType() {}
 
   /**
-   * Throws an exception if this FieldType is frozen. Subclasses should
-   * call this within setters for additional state.
+   * Throws an exception if this FieldType is frozen. Subclasses should call this within setters for
+   * additional state.
    */
   protected void checkIfFrozen() {
     if (frozen) {
@@ -90,30 +81,30 @@ public class FieldType implements IndexableFieldType  {
   }
 
   /**
-   * Prevents future changes. Note, it is recommended that this is called once
-   * the FieldTypes's properties have been set, to prevent unintentional state
-   * changes.
+   * Prevents future changes. Note, it is recommended that this is called once the FieldTypes's
+   * properties have been set, to prevent unintentional state changes.
    */
   public void freeze() {
     this.frozen = true;
   }
-  
+
   /**
    * {@inheritDoc}
-   * <p>
-   * The default is <code>false</code>.
+   *
+   * <p>The default is <code>false</code>.
+   *
    * @see #setStored(boolean)
    */
   @Override
   public boolean stored() {
     return this.stored;
   }
-  
+
   /**
    * Set to <code>true</code> to store this field.
+   *
    * @param value true if this field should be stored.
-   * @throws IllegalStateException if this FieldType is frozen against
-   *         future modifications.
+   * @throws IllegalStateException if this FieldType is frozen against future modifications.
    * @see #stored()
    */
   public void setStored(boolean value) {
@@ -123,20 +114,20 @@ public class FieldType implements IndexableFieldType  {
 
   /**
    * {@inheritDoc}
-   * <p>
-   * The default is <code>true</code>.
+   *
+   * <p>The default is <code>true</code>.
+   *
    * @see #setTokenized(boolean)
    */
   public boolean tokenized() {
     return this.tokenized;
   }
-  
+
   /**
-   * Set to <code>true</code> to tokenize this field's contents via the 
-   * configured {@link Analyzer}.
+   * Set to <code>true</code> to tokenize this field's contents via the configured {@link Analyzer}.
+   *
    * @param value true if this field should be tokenized.
-   * @throws IllegalStateException if this FieldType is frozen against
-   *         future modifications.
+   * @throws IllegalStateException if this FieldType is frozen against future modifications.
    * @see #tokenized()
    */
   public void setTokenized(boolean value) {
@@ -146,21 +137,21 @@ public class FieldType implements IndexableFieldType  {
 
   /**
    * {@inheritDoc}
-   * <p>
-   * The default is <code>false</code>. 
+   *
+   * <p>The default is <code>false</code>.
+   *
    * @see #setStoreTermVectors(boolean)
    */
   @Override
   public boolean storeTermVectors() {
     return this.storeTermVectors;
   }
-  
+
   /**
-   * Set to <code>true</code> if this field's indexed form should be also stored 
-   * into term vectors.
+   * Set to <code>true</code> if this field's indexed form should be also stored into term vectors.
+   *
    * @param value true if this field should store term vectors.
-   * @throws IllegalStateException if this FieldType is frozen against
-   *         future modifications.
+   * @throws IllegalStateException if this FieldType is frozen against future modifications.
    * @see #storeTermVectors()
    */
   public void setStoreTermVectors(boolean value) {
@@ -170,21 +161,22 @@ public class FieldType implements IndexableFieldType  {
 
   /**
    * {@inheritDoc}
-   * <p>
-   * The default is <code>false</code>.
+   *
+   * <p>The default is <code>false</code>.
+   *
    * @see #setStoreTermVectorOffsets(boolean)
    */
   @Override
   public boolean storeTermVectorOffsets() {
     return this.storeTermVectorOffsets;
   }
-  
+
   /**
-   * Set to <code>true</code> to also store token character offsets into the term
-   * vector for this field.
+   * Set to <code>true</code> to also store token character offsets into the term vector for this
+   * field.
+   *
    * @param value true if this field should store term vector offsets.
-   * @throws IllegalStateException if this FieldType is frozen against
-   *         future modifications.
+   * @throws IllegalStateException if this FieldType is frozen against future modifications.
    * @see #storeTermVectorOffsets()
    */
   public void setStoreTermVectorOffsets(boolean value) {
@@ -194,68 +186,69 @@ public class FieldType implements IndexableFieldType  {
 
   /**
    * {@inheritDoc}
-   * <p>
-   * The default is <code>false</code>.
+   *
+   * <p>The default is <code>false</code>.
+   *
    * @see #setStoreTermVectorPositions(boolean)
    */
   @Override
   public boolean storeTermVectorPositions() {
     return this.storeTermVectorPositions;
   }
-  
+
   /**
-   * Set to <code>true</code> to also store token positions into the term
-   * vector for this field.
+   * Set to <code>true</code> to also store token positions into the term vector for this field.
+   *
    * @param value true if this field should store term vector positions.
-   * @throws IllegalStateException if this FieldType is frozen against
-   *         future modifications.
+   * @throws IllegalStateException if this FieldType is frozen against future modifications.
    * @see #storeTermVectorPositions()
    */
   public void setStoreTermVectorPositions(boolean value) {
     checkIfFrozen();
     this.storeTermVectorPositions = value;
   }
-  
+
   /**
    * {@inheritDoc}
-   * <p>
-   * The default is <code>false</code>.
-   * @see #setStoreTermVectorPayloads(boolean) 
+   *
+   * <p>The default is <code>false</code>.
+   *
+   * @see #setStoreTermVectorPayloads(boolean)
    */
   @Override
   public boolean storeTermVectorPayloads() {
     return this.storeTermVectorPayloads;
   }
-  
+
   /**
-   * Set to <code>true</code> to also store token payloads into the term
-   * vector for this field.
+   * Set to <code>true</code> to also store token payloads into the term vector for this field.
+   *
    * @param value true if this field should store term vector payloads.
-   * @throws IllegalStateException if this FieldType is frozen against
-   *         future modifications.
+   * @throws IllegalStateException if this FieldType is frozen against future modifications.
    * @see #storeTermVectorPayloads()
    */
   public void setStoreTermVectorPayloads(boolean value) {
     checkIfFrozen();
     this.storeTermVectorPayloads = value;
   }
-  
+
   /**
    * {@inheritDoc}
-   * <p>
-   * The default is <code>false</code>.
+   *
+   * <p>The default is <code>false</code>.
+   *
    * @see #setOmitNorms(boolean)
    */
   @Override
   public boolean omitNorms() {
     return this.omitNorms;
   }
-  
+
   /**
    * Set to <code>true</code> to omit normalization values for the field.
+   *
    * @param value true if this field should omit norms.
-   * @throws IllegalStateException if this FieldType is frozen against
-   *         future modifications.
+   * @throws IllegalStateException if this FieldType is frozen against future modifications.
    * @see #omitNorms()
    */
   public void setOmitNorms(boolean value) {
@@ -265,20 +258,21 @@ public class FieldType implements IndexableFieldType  {
 
   /**
    * {@inheritDoc}
-   * <p>
-   * The default is {@link IndexOptions#DOCS_AND_FREQS_AND_POSITIONS}.
+   *
+   * <p>The default is {@link IndexOptions#DOCS_AND_FREQS_AND_POSITIONS}.
+   *
    * @see #setIndexOptions(IndexOptions)
    */
   @Override
   public IndexOptions indexOptions() {
     return this.indexOptions;
   }
-  
+
   /**
    * Sets the indexing options for the field:
+   *
    * @param value indexing options
-   * @throws IllegalStateException if this FieldType is frozen against
-   *         future modifications.
+   * @throws IllegalStateException if this FieldType is frozen against future modifications.
    * @see #indexOptions()
    */
   public void setIndexOptions(IndexOptions value) {
@@ -289,51 +283,67 @@ public class FieldType implements IndexableFieldType  {
     this.indexOptions = value;
   }
 
-  /**
-   * Enables points indexing.
-   */
+  /** Enables points indexing. */
   public void setDimensions(int dimensionCount, int dimensionNumBytes) {
     this.setDimensions(dimensionCount, dimensionCount, dimensionNumBytes);
   }
 
-  /**
-   * Enables points indexing with selectable dimension indexing.
-   */
+  /** Enables points indexing with selectable dimension indexing. */
   public void setDimensions(int dimensionCount, int indexDimensionCount, int dimensionNumBytes) {
     checkIfFrozen();
     if (dimensionCount < 0) {
       throw new IllegalArgumentException("dimensionCount must be >= 0; got " + dimensionCount);
     }
     if (dimensionCount > PointValues.MAX_DIMENSIONS) {
-      throw new IllegalArgumentException("dimensionCount must be <= " + PointValues.MAX_DIMENSIONS + "; got " + dimensionCount);
+      throw new IllegalArgumentException(
+          "dimensionCount must be <= " + PointValues.MAX_DIMENSIONS + "; got " + dimensionCount);
     }
     if (indexDimensionCount < 0) {
-      throw new IllegalArgumentException("indexDimensionCount must be >= 0; got " + indexDimensionCount);
+      throw new IllegalArgumentException(
+          "indexDimensionCount must be >= 0; got " + indexDimensionCount);
     }
     if (indexDimensionCount > dimensionCount) {
-      throw new IllegalArgumentException("indexDimensionCount must be <= dimensionCount: " + dimensionCount + "; got " + indexDimensionCount);
+      throw new IllegalArgumentException(
+          "indexDimensionCount must be <= dimensionCount: "
+              + dimensionCount
+              + "; got "
+              + indexDimensionCount);
     }
     if (indexDimensionCount > PointValues.MAX_INDEX_DIMENSIONS) {
-      throw new IllegalArgumentException("indexDimensionCount must be <= " + PointValues.MAX_INDEX_DIMENSIONS + "; got " + indexDimensionCount);
+      throw new IllegalArgumentException(
+          "indexDimensionCount must be <= "
+              + PointValues.MAX_INDEX_DIMENSIONS
+              + "; got "
+              + indexDimensionCount);
     }
     if (dimensionNumBytes < 0) {
-      throw new IllegalArgumentException("dimensionNumBytes must be >= 0; got " + dimensionNumBytes);
+      throw new IllegalArgumentException(
+          "dimensionNumBytes must be >= 0; got " + dimensionNumBytes);
     }
     if (dimensionNumBytes > PointValues.MAX_NUM_BYTES) {
-      throw new IllegalArgumentException("dimensionNumBytes must be <= " + PointValues.MAX_NUM_BYTES + "; got " + dimensionNumBytes);
+      throw new IllegalArgumentException(
+          "dimensionNumBytes must be <= "
+              + PointValues.MAX_NUM_BYTES
+              + "; got "
+              + dimensionNumBytes);
     }
     if (dimensionCount == 0) {
       if (indexDimensionCount != 0) {
-        throw new IllegalArgumentException("when dimensionCount is 0, indexDimensionCount must be 0; got " + indexDimensionCount);
+        throw new IllegalArgumentException(
+            "when dimensionCount is 0, indexDimensionCount must be 0; got " + indexDimensionCount);
       }
       if (dimensionNumBytes != 0) {
-        throw new IllegalArgumentException("when dimensionCount is 0, dimensionNumBytes must be 0; got " + dimensionNumBytes);
+        throw new IllegalArgumentException(
+            "when dimensionCount is 0, dimensionNumBytes must be 0; got " + dimensionNumBytes);
       }
     } else if (indexDimensionCount == 0) {
-      throw new IllegalArgumentException("when dimensionCount is > 0, indexDimensionCount must be > 0; got " + indexDimensionCount);
+      throw new IllegalArgumentException(
+          "when dimensionCount is > 0, indexDimensionCount must be > 0; got "
+              + indexDimensionCount);
     } else if (dimensionNumBytes == 0) {
       if (dimensionCount != 0) {
-        throw new IllegalArgumentException("when dimensionNumBytes is 0, dimensionCount must be 0; got " + dimensionCount);
+        throw new IllegalArgumentException(
+            "when dimensionNumBytes is 0, dimensionCount must be 0; got " + dimensionCount);
       }
     }
 
@@ -357,13 +367,18 @@ public class FieldType implements IndexableFieldType  {
     return dimensionNumBytes;
   }
 
-  void setVectorDimensionsAndSearchStrategy(int numDimensions, VectorValues.SearchStrategy distFunc) {
+  void setVectorDimensionsAndSearchStrategy(
+      int numDimensions, VectorValues.SearchStrategy distFunc) {
     checkIfFrozen();
     if (numDimensions <= 0) {
       throw new IllegalArgumentException("vector numDimensions must be > 0; got " + numDimensions);
     }
     if (numDimensions > VectorValues.MAX_DIMENSIONS) {
-      throw new IllegalArgumentException("vector numDimensions must be <= VectorValues.MAX_DIMENSIONS (=" + VectorValues.MAX_DIMENSIONS + "); got " + numDimensions);
+      throw new IllegalArgumentException(
+          "vector numDimensions must be <= VectorValues.MAX_DIMENSIONS (="
+              + VectorValues.MAX_DIMENSIONS
+              + "); got "
+              + numDimensions);
     }
     this.vectorDimension = numDimensions;
     this.vectorSearchStrategy = distFunc;
@@ -381,13 +396,13 @@ public class FieldType implements IndexableFieldType  {
 
   /**
    * Puts an attribute value.
-   * <p>
-   * This is a key-value mapping for the field that the codec can use
-   * to store additional metadata.
-   * <p>
-   * If a value already exists for the field, it will be replaced with
-   * the new value. This method is not thread-safe, user must not add attributes
-   * while other threads are indexing documents with this field type.
+   *
+   * <p>This is a key-value mapping for the field that the codec can use to store additional
+   * metadata.
+   *
+   * <p>If a value already exists for the field, it will be replaced with the new value. This method
+   * is not thread-safe, user must not add attributes while other threads are indexing documents
+   * with this field type.
    *
    * @lucene.experimental
    */
@@ -412,8 +427,7 @@ public class FieldType implements IndexableFieldType  {
       result.append("stored");
     }
     if (indexOptions != IndexOptions.NONE) {
-      if (result.length() > 0)
-        result.append(",");
+      if (result.length() > 0) result.append(",");
       result.append("indexed");
       if (tokenized()) {
         result.append(",tokenized");
@@ -456,14 +470,15 @@ public class FieldType implements IndexableFieldType  {
       result.append("docValuesType=");
       result.append(docValuesType);
     }
-    
+
     return result.toString();
   }
-  
+
   /**
    * {@inheritDoc}
-   * <p>
-   * The default is <code>null</code> (no docValues) 
+   *
+   * <p>The default is <code>null</code> (no docValues)
+   *
    * @see #setDocValuesType(DocValuesType)
    */
   @Override
@@ -473,9 +488,9 @@ public class FieldType implements IndexableFieldType  {
 
   /**
    * Sets the field's DocValuesType
+   *
    * @param type DocValues type, or null if no DocValues should be stored.
-   * @throws IllegalStateException if this FieldType is frozen against
-   *         future modifications.
+   * @throws IllegalStateException if this FieldType is frozen against future modifications.
    * @see #docValuesType()
    */
   public void setDocValuesType(DocValuesType type) {
diff --git a/lucene/core/src/java/org/apache/lucene/document/FloatDocValuesField.java b/lucene/core/src/java/org/apache/lucene/document/FloatDocValuesField.java
index 3a8bdea..c375cc6 100644
--- a/lucene/core/src/java/org/apache/lucene/document/FloatDocValuesField.java
+++ b/lucene/core/src/java/org/apache/lucene/document/FloatDocValuesField.java
@@ -16,22 +16,22 @@
  */
 package org.apache.lucene.document;
 
-
 /**
- * Syntactic sugar for encoding floats as NumericDocValues
- * via {@link Float#floatToRawIntBits(float)}.
- * <p>
- * Per-document floating point values can be retrieved via
- * {@link org.apache.lucene.index.LeafReader#getNumericDocValues(String)}.
- * <p>
- * <b>NOTE</b>: In most all cases this will be rather inefficient,
- * requiring four bytes per document. Consider encoding floating
- * point values yourself with only as much precision as you require.
+ * Syntactic sugar for encoding floats as NumericDocValues via {@link
+ * Float#floatToRawIntBits(float)}.
+ *
+ * <p>Per-document floating point values can be retrieved via {@link
+ * org.apache.lucene.index.LeafReader#getNumericDocValues(String)}.
+ *
+ * <p><b>NOTE</b>: In most all cases this will be rather inefficient, requiring four bytes per
+ * document. Consider encoding floating point values yourself with only as much precision as you
+ * require.
  */
 public class FloatDocValuesField extends NumericDocValuesField {
 
-  /** 
-   * Creates a new DocValues field with the specified 32-bit float value 
+  /**
+   * Creates a new DocValues field with the specified 32-bit float value
+   *
    * @param name field name
    * @param value 32-bit float value
    * @throws IllegalArgumentException if the field name is null
@@ -44,7 +44,7 @@ public class FloatDocValuesField extends NumericDocValuesField {
   public void setFloatValue(float value) {
     super.setLongValue(Float.floatToRawIntBits(value));
   }
-  
+
   @Override
   public void setLongValue(long value) {
     throw new IllegalArgumentException("cannot change value type from Float to Long");
diff --git a/lucene/core/src/java/org/apache/lucene/document/FloatPoint.java b/lucene/core/src/java/org/apache/lucene/document/FloatPoint.java
index 92efa5e..bc8feb78 100644
--- a/lucene/core/src/java/org/apache/lucene/document/FloatPoint.java
+++ b/lucene/core/src/java/org/apache/lucene/document/FloatPoint.java
@@ -18,7 +18,6 @@ package org.apache.lucene.document;
 
 import java.util.Arrays;
 import java.util.Collection;
-
 import org.apache.lucene.index.PointValues;
 import org.apache.lucene.search.PointInSetQuery;
 import org.apache.lucene.search.PointRangeQuery;
@@ -26,29 +25,30 @@ import org.apache.lucene.search.Query;
 import org.apache.lucene.util.BytesRef;
 import org.apache.lucene.util.NumericUtils;
 
-/** 
- * An indexed {@code float} field for fast range filters.  If you also
- * need to store the value, you should add a separate {@link StoredField} instance.
- * <p>
- * Finding all documents within an N-dimensional at search time is
- * efficient.  Multiple values for the same field in one document
- * is allowed.
- * <p>
- * This field defines static factory methods for creating common queries:
+/**
+ * An indexed {@code float} field for fast range filters. If you also need to store the value, you
+ * should add a separate {@link StoredField} instance.
+ *
+ * <p>Finding all documents within an N-dimensional at search time is efficient. Multiple values for
+ * the same field in one document is allowed.
+ *
+ * <p>This field defines static factory methods for creating common queries:
+ *
  * <ul>
  *   <li>{@link #newExactQuery(String, float)} for matching an exact 1D point.
  *   <li>{@link #newSetQuery(String, float...)} for matching a set of 1D values.
  *   <li>{@link #newRangeQuery(String, float, float)} for matching a 1D range.
- *   <li>{@link #newRangeQuery(String, float[], float[])} for matching points/ranges in n-dimensional space.
+ *   <li>{@link #newRangeQuery(String, float[], float[])} for matching points/ranges in
+ *       n-dimensional space.
  * </ul>
+ *
  * @see PointValues
  */
 public final class FloatPoint extends Field {
   /**
-   * Return the least float that compares greater than {@code f} consistently
-   * with {@link Float#compare}. The only difference with
-   * {@link Math#nextUp(float)} is that this method returns {@code +0f} when
-   * the argument is {@code -0f}.
+   * Return the least float that compares greater than {@code f} consistently with {@link
+   * Float#compare}. The only difference with {@link Math#nextUp(float)} is that this method returns
+   * {@code +0f} when the argument is {@code -0f}.
    */
   public static float nextUp(float f) {
     if (Float.floatToIntBits(f) == 0x8000_0000) { // -0f
@@ -58,10 +58,9 @@ public final class FloatPoint extends Field {
   }
 
   /**
-   * Return the greatest float that compares less than {@code f} consistently
-   * with {@link Float#compare}. The only difference with
-   * {@link Math#nextDown(float)} is that this method returns {@code -0f} when
-   * the argument is {@code +0f}.
+   * Return the greatest float that compares less than {@code f} consistently with {@link
+   * Float#compare}. The only difference with {@link Math#nextDown(float)} is that this method
+   * returns {@code -0f} when the argument is {@code +0f}.
    */
   public static float nextDown(float f) {
     if (Float.floatToIntBits(f) == 0) { // +0f
@@ -85,7 +84,14 @@ public final class FloatPoint extends Field {
   /** Change the values of this field */
   public void setFloatValues(float... point) {
     if (type.pointDimensionCount() != point.length) {
-      throw new IllegalArgumentException("this field (name=" + name + ") uses " + type.pointDimensionCount() + " dimensions; cannot change to (incoming) " + point.length + " dimensions");
+      throw new IllegalArgumentException(
+          "this field (name="
+              + name
+              + ") uses "
+              + type.pointDimensionCount()
+              + " dimensions; cannot change to (incoming) "
+              + point.length
+              + " dimensions");
     }
     fieldsData = pack(point);
   }
@@ -98,7 +104,12 @@ public final class FloatPoint extends Field {
   @Override
   public Number numericValue() {
     if (type.pointDimensionCount() != 1) {
-      throw new IllegalStateException("this field (name=" + name + ") uses " + type.pointDimensionCount() + " dimensions; cannot convert to a single numeric value");
+      throw new IllegalStateException(
+          "this field (name="
+              + name
+              + ") uses "
+              + type.pointDimensionCount()
+              + " dimensions; cannot convert to a single numeric value");
     }
     BytesRef bytes = (BytesRef) fieldsData;
     assert bytes.length == Float.BYTES;
@@ -106,7 +117,7 @@ public final class FloatPoint extends Field {
   }
 
   /**
-   *  Pack a float point into a BytesRef
+   * Pack a float point into a BytesRef
    *
    * @param point float[] value
    * @throws IllegalArgumentException is the value is null or of zero length
@@ -119,7 +130,7 @@ public final class FloatPoint extends Field {
       throw new IllegalArgumentException("point must not be 0 dimensions");
     }
     byte[] packed = new byte[point.length * Float.BYTES];
-    
+
     for (int dim = 0; dim < point.length; dim++) {
       encodeDimension(point[dim], packed, dim * Float.BYTES);
     }
@@ -127,17 +138,17 @@ public final class FloatPoint extends Field {
     return new BytesRef(packed);
   }
 
-  /** Creates a new FloatPoint, indexing the
-   *  provided N-dimensional float point.
+  /**
+   * Creates a new FloatPoint, indexing the provided N-dimensional float point.
    *
-   *  @param name field name
-   *  @param point float[] value
-   *  @throws IllegalArgumentException if the field name or value is null.
+   * @param name field name
+   * @param point float[] value
+   * @throws IllegalArgumentException if the field name or value is null.
    */
   public FloatPoint(String name, float... point) {
     super(name, pack(point), getType(point.length));
   }
-  
+
   @Override
   public String toString() {
     StringBuilder result = new StringBuilder();
@@ -157,26 +168,26 @@ public final class FloatPoint extends Field {
     result.append('>');
     return result.toString();
   }
-  
+
   // public helper methods (e.g. for queries)
-  
+
   /** Encode single float dimension */
   public static void encodeDimension(float value, byte dest[], int offset) {
     NumericUtils.intToSortableBytes(NumericUtils.floatToSortableInt(value), dest, offset);
   }
-  
+
   /** Decode single float dimension */
   public static float decodeDimension(byte value[], int offset) {
     return NumericUtils.sortableIntToFloat(NumericUtils.sortableBytesToInt(value, offset));
   }
-  
+
   // static methods for generating queries
 
-  /** 
+  /**
    * Create a query for matching an exact float value.
-   * <p>
-   * This is for simple one-dimension points, for multidimensional points use
-   * {@link #newRangeQuery(String, float[], float[])} instead.
+   *
+   * <p>This is for simple one-dimension points, for multidimensional points use {@link
+   * #newRangeQuery(String, float[], float[])} instead.
    *
    * @param field field name. must not be {@code null}.
    * @param value float value
@@ -186,19 +197,20 @@ public final class FloatPoint extends Field {
   public static Query newExactQuery(String field, float value) {
     return newRangeQuery(field, value, value);
   }
-  
-  /** 
+
+  /**
    * Create a range query for float values.
-   * <p>
-   * This is for simple one-dimension ranges, for multidimensional ranges use
-   * {@link #newRangeQuery(String, float[], float[])} instead.
-   * <p>
-   * You can have half-open ranges (which are in fact &lt;/&le; or &gt;/&ge; queries)
-   * by setting {@code lowerValue = Float.NEGATIVE_INFINITY} or {@code upperValue = Float.POSITIVE_INFINITY}.
-   * <p> Ranges are inclusive. For exclusive ranges, pass {@link #nextUp(float) nextUp(lowerValue)}
+   *
+   * <p>This is for simple one-dimension ranges, for multidimensional ranges use {@link
+   * #newRangeQuery(String, float[], float[])} instead.
+   *
+   * <p>You can have half-open ranges (which are in fact &lt;/&le; or &gt;/&ge; queries) by setting
+   * {@code lowerValue = Float.NEGATIVE_INFINITY} or {@code upperValue = Float.POSITIVE_INFINITY}.
+   *
+   * <p>Ranges are inclusive. For exclusive ranges, pass {@link #nextUp(float) nextUp(lowerValue)}
    * or {@link #nextUp(float) nextDown(upperValue)}.
-   * <p>
-   * Range comparisons are consistent with {@link Float#compareTo(Float)}.
+   *
+   * <p>Range comparisons are consistent with {@link Float#compareTo(Float)}.
    *
    * @param field field name. must not be {@code null}.
    * @param lowerValue lower portion of the range (inclusive).
@@ -207,29 +219,32 @@ public final class FloatPoint extends Field {
    * @return a query matching documents within this range.
    */
   public static Query newRangeQuery(String field, float lowerValue, float upperValue) {
-    return newRangeQuery(field, new float[] { lowerValue }, new float[] { upperValue });
+    return newRangeQuery(field, new float[] {lowerValue}, new float[] {upperValue});
   }
 
-  /** 
+  /**
    * Create a range query for n-dimensional float values.
-   * <p>
-   * You can have half-open ranges (which are in fact &lt;/&le; or &gt;/&ge; queries)
-   * by setting {@code lowerValue[i] = Float.NEGATIVE_INFINITY} or {@code upperValue[i] = Float.POSITIVE_INFINITY}.
-   * <p> Ranges are inclusive. For exclusive ranges, pass {@code Math#nextUp(lowerValue[i])}
-   * or {@code Math.nextDown(upperValue[i])}.
-   * <p>
-   * Range comparisons are consistent with {@link Float#compareTo(Float)}.
+   *
+   * <p>You can have half-open ranges (which are in fact &lt;/&le; or &gt;/&ge; queries) by setting
+   * {@code lowerValue[i] = Float.NEGATIVE_INFINITY} or {@code upperValue[i] =
+   * Float.POSITIVE_INFINITY}.
+   *
+   * <p>Ranges are inclusive. For exclusive ranges, pass {@code Math#nextUp(lowerValue[i])} or
+   * {@code Math.nextDown(upperValue[i])}.
+   *
+   * <p>Range comparisons are consistent with {@link Float#compareTo(Float)}.
    *
    * @param field field name. must not be {@code null}.
    * @param lowerValue lower portion of the range (inclusive). must not be {@code null}.
    * @param upperValue upper portion of the range (inclusive). must not be {@code null}.
-   * @throws IllegalArgumentException if {@code field} is null, if {@code lowerValue} is null, if {@code upperValue} is null, 
-   *                                  or if {@code lowerValue.length != upperValue.length}
+   * @throws IllegalArgumentException if {@code field} is null, if {@code lowerValue} is null, if
+   *     {@code upperValue} is null, or if {@code lowerValue.length != upperValue.length}
    * @return a query matching documents within this range.
    */
   public static Query newRangeQuery(String field, float[] lowerValue, float[] upperValue) {
     PointRangeQuery.checkArgs(field, lowerValue, upperValue);
-    return new PointRangeQuery(field, pack(lowerValue).bytes, pack(upperValue).bytes, lowerValue.length) {
+    return new PointRangeQuery(
+        field, pack(lowerValue).bytes, pack(upperValue).bytes, lowerValue.length) {
       @Override
       protected String toString(int dimension, byte[] value) {
         return Float.toString(decodeDimension(value, 0));
@@ -238,8 +253,9 @@ public final class FloatPoint extends Field {
   }
 
   /**
-   * Create a query matching any of the specified 1D values.  This is the points equivalent of {@code TermsQuery}.
-   * 
+   * Create a query matching any of the specified 1D values. This is the points equivalent of {@code
+   * TermsQuery}.
+   *
    * @param field field name. must not be {@code null}.
    * @param values all values to match
    */
@@ -251,22 +267,25 @@ public final class FloatPoint extends Field {
 
     final BytesRef encoded = new BytesRef(new byte[Float.BYTES]);
 
-    return new PointInSetQuery(field, 1, Float.BYTES,
-                               new PointInSetQuery.Stream() {
+    return new PointInSetQuery(
+        field,
+        1,
+        Float.BYTES,
+        new PointInSetQuery.Stream() {
 
-                                 int upto;
+          int upto;
 
-                                 @Override
-                                 public BytesRef next() {
-                                   if (upto == sortedValues.length) {
-                                     return null;
-                                   } else {
-                                     encodeDimension(sortedValues[upto], encoded.bytes, 0);
-                                     upto++;
-                                     return encoded;
-                                   }
-                                 }
-                               }) {
+          @Override
+          public BytesRef next() {
+            if (upto == sortedValues.length) {
+              return null;
+            } else {
+              encodeDimension(sortedValues[upto], encoded.bytes, 0);
+              upto++;
+              return encoded;
+            }
+          }
+        }) {
       @Override
       protected String toString(byte[] value) {
         assert value.length == Float.BYTES;
@@ -276,8 +295,9 @@ public final class FloatPoint extends Field {
   }
 
   /**
-   * Create a query matching any of the specified 1D values.  This is the points equivalent of {@code TermsQuery}.
-   * 
+   * Create a query matching any of the specified 1D values. This is the points equivalent of {@code
+   * TermsQuery}.
+   *
    * @param field field name. must not be {@code null}.
    * @param values all values to match
    */
diff --git a/lucene/core/src/java/org/apache/lucene/document/FloatRange.java b/lucene/core/src/java/org/apache/lucene/document/FloatRange.java
index a74936f..15bf70b 100644
--- a/lucene/core/src/java/org/apache/lucene/document/FloatRange.java
+++ b/lucene/core/src/java/org/apache/lucene/document/FloatRange.java
@@ -17,7 +17,6 @@
 package org.apache.lucene.document;
 
 import java.util.Objects;
-
 import org.apache.lucene.document.RangeFieldQuery.QueryType;
 import org.apache.lucene.search.Query;
 import org.apache.lucene.util.BytesRef;
@@ -25,20 +24,25 @@ import org.apache.lucene.util.NumericUtils;
 
 /**
  * An indexed Float Range field.
- * <p>
- * This field indexes dimensional ranges defined as min/max pairs. It supports
- * up to a maximum of 4 dimensions (indexed as 8 numeric values). With 1 dimension representing a single float range,
- * 2 dimensions representing a bounding box, 3 dimensions a bounding cube, and 4 dimensions a tesseract.
- * <p>
- * Multiple values for the same field in one document is supported, and open ended ranges can be defined using
- * {@code Float.NEGATIVE_INFINITY} and {@code Float.POSITIVE_INFINITY}.
  *
- * <p>
- * This field defines the following static factory methods for common search operations over float ranges:
+ * <p>This field indexes dimensional ranges defined as min/max pairs. It supports up to a maximum of
+ * 4 dimensions (indexed as 8 numeric values). With 1 dimension representing a single float range, 2
+ * dimensions representing a bounding box, 3 dimensions a bounding cube, and 4 dimensions a
+ * tesseract.
+ *
+ * <p>Multiple values for the same field in one document is supported, and open ended ranges can be
+ * defined using {@code Float.NEGATIVE_INFINITY} and {@code Float.POSITIVE_INFINITY}.
+ *
+ * <p>This field defines the following static factory methods for common search operations over
+ * float ranges:
+ *
  * <ul>
- *   <li>{@link #newIntersectsQuery newIntersectsQuery()} matches ranges that intersect the defined search range.
- *   <li>{@link #newWithinQuery newWithinQuery()} matches ranges that are within the defined search range.
- *   <li>{@link #newContainsQuery newContainsQuery()} matches ranges that contain the defined search range.
+ *   <li>{@link #newIntersectsQuery newIntersectsQuery()} matches ranges that intersect the defined
+ *       search range.
+ *   <li>{@link #newWithinQuery newWithinQuery()} matches ranges that are within the defined search
+ *       range.
+ *   <li>{@link #newContainsQuery newContainsQuery()} matches ranges that contain the defined search
+ *       range.
  * </ul>
  */
 public class FloatRange extends Field {
@@ -65,30 +69,38 @@ public class FloatRange extends Field {
 
     FieldType ft = new FieldType();
     // dimensions is set as 2*dimension size (min/max per dimension)
-    ft.setDimensions(dimensions*2, BYTES);
+    ft.setDimensions(dimensions * 2, BYTES);
     ft.freeze();
     return ft;
   }
 
   /**
    * Changes the values of the field.
+   *
    * @param min array of min values. (accepts {@code Float.NEGATIVE_INFINITY})
    * @param max array of max values. (accepts {@code Float.POSITIVE_INFINITY})
    * @throws IllegalArgumentException if {@code min} or {@code max} is invalid
    */
   public void setRangeValues(float[] min, float[] max) {
     checkArgs(min, max);
-    if (min.length*2 != type.pointDimensionCount() || max.length*2 != type.pointDimensionCount()) {
-      throw new IllegalArgumentException("field (name=" + name + ") uses " + type.pointDimensionCount()/2
-          + " dimensions; cannot change to (incoming) " + min.length + " dimensions");
+    if (min.length * 2 != type.pointDimensionCount()
+        || max.length * 2 != type.pointDimensionCount()) {
+      throw new IllegalArgumentException(
+          "field (name="
+              + name
+              + ") uses "
+              + type.pointDimensionCount() / 2
+              + " dimensions; cannot change to (incoming) "
+              + min.length
+              + " dimensions");
     }
 
     final byte[] bytes;
     if (fieldsData == null) {
-      bytes = new byte[BYTES*2*min.length];
+      bytes = new byte[BYTES * 2 * min.length];
       fieldsData = new BytesRef(bytes);
     } else {
-      bytes = ((BytesRef)fieldsData).bytes;
+      bytes = ((BytesRef) fieldsData).bytes;
     }
     verifyAndEncode(min, max, bytes);
   }
@@ -106,32 +118,32 @@ public class FloatRange extends Field {
     }
   }
 
-  /**
-   * Encodes the min, max ranges into a byte array
-   */
+  /** Encodes the min, max ranges into a byte array */
   static byte[] encode(float[] min, float[] max) {
     checkArgs(min, max);
-    byte[] b = new byte[BYTES*2*min.length];
+    byte[] b = new byte[BYTES * 2 * min.length];
     verifyAndEncode(min, max, b);
     return b;
   }
 
   /**
    * encode the ranges into a sortable byte array ({@code Float.NaN} not allowed)
-   * <p>
-   * example for 4 dimensions (8 bytes per dimension value):
-   * minD1 ... minD4 | maxD1 ... maxD4
+   *
+   * <p>example for 4 dimensions (8 bytes per dimension value): minD1 ... minD4 | maxD1 ... maxD4
    */
   static void verifyAndEncode(float[] min, float[] max, byte[] bytes) {
-    for (int d=0,i=0,j=min.length*BYTES; d<min.length; ++d, i+=BYTES, j+=BYTES) {
+    for (int d = 0, i = 0, j = min.length * BYTES; d < min.length; ++d, i += BYTES, j += BYTES) {
       if (Double.isNaN(min[d])) {
-        throw new IllegalArgumentException("invalid min value (" + Float.NaN + ")" + " in FloatRange");
+        throw new IllegalArgumentException(
+            "invalid min value (" + Float.NaN + ")" + " in FloatRange");
       }
       if (Double.isNaN(max[d])) {
-        throw new IllegalArgumentException("invalid max value (" + Float.NaN + ")" + " in FloatRange");
+        throw new IllegalArgumentException(
+            "invalid max value (" + Float.NaN + ")" + " in FloatRange");
       }
       if (min[d] > max[d]) {
-        throw new IllegalArgumentException("min value (" + min[d] + ") is greater than max value (" + max[d] + ")");
+        throw new IllegalArgumentException(
+            "min value (" + min[d] + ") is greater than max value (" + max[d] + ")");
       }
       encode(min[d], bytes, i);
       encode(max[d], bytes, j);
@@ -145,43 +157,47 @@ public class FloatRange extends Field {
 
   /**
    * Get the min value for the given dimension
+   *
    * @param dimension the dimension, always positive
    * @return the decoded min value
    */
   public float getMin(int dimension) {
-    Objects.checkIndex(dimension, type.pointDimensionCount()/2);
-    return decodeMin(((BytesRef)fieldsData).bytes, dimension);
+    Objects.checkIndex(dimension, type.pointDimensionCount() / 2);
+    return decodeMin(((BytesRef) fieldsData).bytes, dimension);
   }
 
   /**
    * Get the max value for the given dimension
+   *
    * @param dimension the dimension, always positive
    * @return the decoded max value
    */
   public float getMax(int dimension) {
-    Objects.checkIndex(dimension, type.pointDimensionCount()/2);
-    return decodeMax(((BytesRef)fieldsData).bytes, dimension);
+    Objects.checkIndex(dimension, type.pointDimensionCount() / 2);
+    return decodeMax(((BytesRef) fieldsData).bytes, dimension);
   }
 
   /** decodes the min value (for the defined dimension) from the encoded input byte array */
   static float decodeMin(byte[] b, int dimension) {
-    int offset = dimension*BYTES;
+    int offset = dimension * BYTES;
     return NumericUtils.sortableIntToFloat(NumericUtils.sortableBytesToInt(b, offset));
   }
 
   /** decodes the max value (for the defined dimension) from the encoded input byte array */
   static float decodeMax(byte[] b, int dimension) {
-    int offset = b.length/2 + dimension*BYTES;
+    int offset = b.length / 2 + dimension * BYTES;
     return NumericUtils.sortableIntToFloat(NumericUtils.sortableBytesToInt(b, offset));
   }
 
   /**
    * Create a query for matching indexed ranges that intersect the defined range.
+   *
    * @param field field name. must not be null.
    * @param min array of min values. (accepts {@code Float.NEGATIVE_INFINITY})
    * @param max array of max values. (accepts {@code Float.MAX_VALUE})
    * @return query for matching intersecting ranges (overlap, within, or contains)
-   * @throws IllegalArgumentException if {@code field} is null, {@code min} or {@code max} is invalid
+   * @throws IllegalArgumentException if {@code field} is null, {@code min} or {@code max} is
+   *     invalid
    */
   public static Query newIntersectsQuery(String field, final float[] min, final float[] max) {
     return newRelationQuery(field, min, max, QueryType.INTERSECTS);
@@ -189,11 +205,13 @@ public class FloatRange extends Field {
 
   /**
    * Create a query for matching indexed float ranges that contain the defined range.
+   *
    * @param field field name. must not be null.
    * @param min array of min values. (accepts {@code Float.NEGATIVE_INFINITY})
    * @param max array of max values. (accepts {@code Float.POSITIVE_INFINITY})
    * @return query for matching ranges that contain the defined range
-   * @throws IllegalArgumentException if {@code field} is null, {@code min} or {@code max} is invalid
+   * @throws IllegalArgumentException if {@code field} is null, {@code min} or {@code max} is
+   *     invalid
    */
   public static Query newContainsQuery(String field, final float[] min, final float[] max) {
     return newRelationQuery(field, min, max, QueryType.CONTAINS);
@@ -201,32 +219,37 @@ public class FloatRange extends Field {
 
   /**
    * Create a query for matching indexed ranges that are within the defined range.
+   *
    * @param field field name. must not be null.
    * @param min array of min values. (accepts {@code Float.NEGATIVE_INFINITY})
    * @param max array of max values. (accepts {@code Float.POSITIVE_INFINITY})
    * @return query for matching ranges within the defined range
-   * @throws IllegalArgumentException if {@code field} is null, {@code min} or {@code max} is invalid
+   * @throws IllegalArgumentException if {@code field} is null, {@code min} or {@code max} is
+   *     invalid
    */
   public static Query newWithinQuery(String field, final float[] min, final float[] max) {
     return newRelationQuery(field, min, max, QueryType.WITHIN);
   }
 
   /**
-   * Create a query for matching indexed ranges that cross the defined range.
-   * A CROSSES is defined as any set of ranges that are not disjoint and not wholly contained by
-   * the query. Effectively, its the complement of union(WITHIN, DISJOINT).
+   * Create a query for matching indexed ranges that cross the defined range. A CROSSES is defined
+   * as any set of ranges that are not disjoint and not wholly contained by the query. Effectively,
+   * its the complement of union(WITHIN, DISJOINT).
+   *
    * @param field field name. must not be null.
    * @param min array of min values. (accepts {@code Float.NEGATIVE_INFINITY})
    * @param max array of max values. (accepts {@code Float.POSITIVE_INFINITY})
    * @return query for matching ranges within the defined range
-   * @throws IllegalArgumentException if {@code field} is null, {@code min} or {@code max} is invalid
+   * @throws IllegalArgumentException if {@code field} is null, {@code min} or {@code max} is
+   *     invalid
    */
   public static Query newCrossesQuery(String field, final float[] min, final float[] max) {
     return newRelationQuery(field, min, max, QueryType.CROSSES);
   }
 
   /** helper method for creating the desired relational query */
-  private static Query newRelationQuery(String field, final float[] min, final float[] max, QueryType relation) {
+  private static Query newRelationQuery(
+      String field, final float[] min, final float[] max, QueryType relation) {
     checkArgs(min, max);
     return new RangeFieldQuery(field, encode(min, max), min.length, relation) {
       @Override
@@ -243,7 +266,7 @@ public class FloatRange extends Field {
     sb.append(" <");
     sb.append(name);
     sb.append(':');
-    byte[] b = ((BytesRef)fieldsData).bytes;
+    byte[] b = ((BytesRef) fieldsData).bytes;
     toString(b, 0);
     for (int d = 0; d < type.pointDimensionCount() / 2; ++d) {
       sb.append(' ');
@@ -256,12 +279,16 @@ public class FloatRange extends Field {
 
   /**
    * Returns the String representation for the range at the given dimension
+   *
    * @param ranges the encoded ranges, never null
    * @param dimension the dimension of interest
    * @return The string representation for the range at the provided dimension
    */
   private static String toString(byte[] ranges, int dimension) {
-    return "[" + Float.toString(decodeMin(ranges, dimension)) + " : "
-        + Float.toString(decodeMax(ranges, dimension)) + "]";
+    return "["
+        + Float.toString(decodeMin(ranges, dimension))
+        + " : "
+        + Float.toString(decodeMax(ranges, dimension))
+        + "]";
   }
 }
diff --git a/lucene/core/src/java/org/apache/lucene/document/FloatRangeDocValuesField.java b/lucene/core/src/java/org/apache/lucene/document/FloatRangeDocValuesField.java
index c5fefc4..45184d9 100644
--- a/lucene/core/src/java/org/apache/lucene/document/FloatRangeDocValuesField.java
+++ b/lucene/core/src/java/org/apache/lucene/document/FloatRangeDocValuesField.java
@@ -20,10 +20,10 @@ package org.apache.lucene.document;
 import org.apache.lucene.search.Query;
 
 /**
- * DocValues field for FloatRange. This is a single valued field per document
- * due to being an extension of BinaryDocValuesField.
+ * DocValues field for FloatRange. This is a single valued field per document due to being an
+ * extension of BinaryDocValuesField.
  */
-public class FloatRangeDocValuesField extends BinaryRangeDocValuesField{
+public class FloatRangeDocValuesField extends BinaryRangeDocValuesField {
   final String field;
   final float[] min;
   final float[] max;
@@ -55,22 +55,23 @@ public class FloatRangeDocValuesField extends BinaryRangeDocValuesField{
     return max[dimension];
   }
 
-  private static Query newSlowRangeQuery(String field, final float[] min, final float[] max,
-                                        RangeFieldQuery.QueryType queryType) {
+  private static Query newSlowRangeQuery(
+      String field, final float[] min, final float[] max, RangeFieldQuery.QueryType queryType) {
     checkArgs(min, max);
     return new FloatRangeSlowRangeQuery(field, min, max, queryType);
   }
 
-  /** Create a new range query that finds all ranges that intersect using doc values.
-   *  NOTE: This doesn't leverage indexing and may be slow.
-   *  @see FloatRange#newIntersectsQuery */
+  /**
+   * Create a new range query that finds all ranges that intersect using doc values. NOTE: This
+   * doesn't leverage indexing and may be slow.
+   *
+   * @see FloatRange#newIntersectsQuery
+   */
   public static Query newSlowIntersectsQuery(String field, final float[] min, final float[] max) {
     return newSlowRangeQuery(field, min, max, RangeFieldQuery.QueryType.INTERSECTS);
   }
 
-  /**
-   * validate the arguments
-   */
+  /** validate the arguments */
   private static void checkArgs(final float[] min, final float[] max) {
     if (min == null || max == null || min.length == 0 || max.length == 0) {
       throw new IllegalArgumentException("min/max range values cannot be null or empty");
diff --git a/lucene/core/src/java/org/apache/lucene/document/FloatRangeSlowRangeQuery.java b/lucene/core/src/java/org/apache/lucene/document/FloatRangeSlowRangeQuery.java
index dd208aa..9c01162 100644
--- a/lucene/core/src/java/org/apache/lucene/document/FloatRangeSlowRangeQuery.java
+++ b/lucene/core/src/java/org/apache/lucene/document/FloatRangeSlowRangeQuery.java
@@ -20,7 +20,6 @@ package org.apache.lucene.document;
 import java.io.IOException;
 import java.util.Arrays;
 import java.util.Objects;
-
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.search.Query;
 import org.apache.lucene.search.QueryVisitor;
@@ -30,7 +29,8 @@ class FloatRangeSlowRangeQuery extends BinaryRangeFieldRangeQuery {
   private final float[] min;
   private final float[] max;
 
-  FloatRangeSlowRangeQuery(String field, float[] min, float[] max, RangeFieldQuery.QueryType queryType) {
+  FloatRangeSlowRangeQuery(
+      String field, float[] min, float[] max, RangeFieldQuery.QueryType queryType) {
     super(field, encodeRanges(min, max), FloatRange.BYTES, min.length, queryType);
     this.field = field;
     this.min = min;
@@ -70,8 +70,7 @@ class FloatRangeSlowRangeQuery extends BinaryRangeFieldRangeQuery {
     if (this.field.equals(field) == false) {
       b.append(this.field).append(":");
     }
-    return b
-        .append("[")
+    return b.append("[")
         .append(Arrays.toString(min))
         .append(" TO ")
         .append(Arrays.toString(max))
diff --git a/lucene/core/src/java/org/apache/lucene/document/InetAddressPoint.java b/lucene/core/src/java/org/apache/lucene/document/InetAddressPoint.java
index 7316835..8a9cc72 100644
--- a/lucene/core/src/java/org/apache/lucene/document/InetAddressPoint.java
+++ b/lucene/core/src/java/org/apache/lucene/document/InetAddressPoint.java
@@ -20,7 +20,6 @@ import java.net.InetAddress;
 import java.net.UnknownHostException;
 import java.util.Arrays;
 import java.util.Comparator;
-
 import org.apache.lucene.index.PointValues;
 import org.apache.lucene.search.PointInSetQuery;
 import org.apache.lucene.search.PointRangeQuery;
@@ -28,24 +27,27 @@ import org.apache.lucene.search.Query;
 import org.apache.lucene.util.BytesRef;
 import org.apache.lucene.util.NumericUtils;
 
-/** 
+/**
  * An indexed 128-bit {@code InetAddress} field.
- * <p>
- * Finding all documents within a range at search time is
- * efficient.  Multiple values for the same field in one document
- * is allowed. 
- * <p>
- * This field defines static factory methods for creating common queries:
+ *
+ * <p>Finding all documents within a range at search time is efficient. Multiple values for the same
+ * field in one document is allowed.
+ *
+ * <p>This field defines static factory methods for creating common queries:
+ *
  * <ul>
  *   <li>{@link #newExactQuery(String, InetAddress)} for matching an exact network address.
- *   <li>{@link #newPrefixQuery(String, InetAddress, int)} for matching a network based on CIDR prefix.
- *   <li>{@link #newRangeQuery(String, InetAddress, InetAddress)} for matching arbitrary network address ranges.
+ *   <li>{@link #newPrefixQuery(String, InetAddress, int)} for matching a network based on CIDR
+ *       prefix.
+ *   <li>{@link #newRangeQuery(String, InetAddress, InetAddress)} for matching arbitrary network
+ *       address ranges.
  *   <li>{@link #newSetQuery(String, InetAddress...)} for matching a set of network addresses.
  * </ul>
- * <p>
- * This field supports both IPv4 and IPv6 addresses: IPv4 addresses are converted
- * to <a href="https://tools.ietf.org/html/rfc4291#section-2.5.5">IPv4-Mapped IPv6 Addresses</a>:
- * indexing {@code 1.2.3.4} is the same as indexing {@code ::FFFF:1.2.3.4}.
+ *
+ * <p>This field supports both IPv4 and IPv6 addresses: IPv4 addresses are converted to <a
+ * href="https://tools.ietf.org/html/rfc4291#section-2.5.5">IPv4-Mapped IPv6 Addresses</a>: indexing
+ * {@code 1.2.3.4} is the same as indexing {@code ::FFFF:1.2.3.4}.
+ *
  * @see PointValues
  */
 public class InetAddressPoint extends Field {
@@ -54,11 +56,12 @@ public class InetAddressPoint extends Field {
   // so its not wasteful, but allows one field to handle both IPv4 and IPv6.
   /** The number of bytes per dimension: 128 bits */
   public static final int BYTES = 16;
-  
+
   // rfc4291 prefix
-  static final byte[] IPV4_PREFIX = new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1 }; 
+  static final byte[] IPV4_PREFIX = new byte[] {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1};
 
   private static final FieldType TYPE;
+
   static {
     TYPE = new FieldType();
     TYPE.setDimensions(1, BYTES);
@@ -69,6 +72,7 @@ public class InetAddressPoint extends Field {
   public static final InetAddress MIN_VALUE;
   /** The maximum value that an ip address can hold. */
   public static final InetAddress MAX_VALUE;
+
   static {
     MIN_VALUE = decode(new byte[BYTES]);
     byte[] maxValueBytes = new byte[BYTES];
@@ -77,36 +81,36 @@ public class InetAddressPoint extends Field {
   }
 
   /**
-   * Return the {@link InetAddress} that compares immediately greater than
-   * {@code address}.
-   * @throws ArithmeticException if the provided address is the
-   *              {@link #MAX_VALUE maximum ip address}
+   * Return the {@link InetAddress} that compares immediately greater than {@code address}.
+   *
+   * @throws ArithmeticException if the provided address is the {@link #MAX_VALUE maximum ip
+   *     address}
    */
   public static InetAddress nextUp(InetAddress address) {
     if (address.equals(MAX_VALUE)) {
-      throw new ArithmeticException("Overflow: there is no greater InetAddress than "
-          + address.getHostAddress());
+      throw new ArithmeticException(
+          "Overflow: there is no greater InetAddress than " + address.getHostAddress());
     }
     byte[] delta = new byte[BYTES];
-    delta[BYTES-1] = 1;
+    delta[BYTES - 1] = 1;
     byte[] nextUpBytes = new byte[InetAddressPoint.BYTES];
     NumericUtils.add(InetAddressPoint.BYTES, 0, encode(address), delta, nextUpBytes);
     return decode(nextUpBytes);
   }
 
   /**
-   * Return the {@link InetAddress} that compares immediately less than
-   * {@code address}.
-   * @throws ArithmeticException if the provided address is the
-   *              {@link #MIN_VALUE minimum ip address}
+   * Return the {@link InetAddress} that compares immediately less than {@code address}.
+   *
+   * @throws ArithmeticException if the provided address is the {@link #MIN_VALUE minimum ip
+   *     address}
    */
   public static InetAddress nextDown(InetAddress address) {
     if (address.equals(MIN_VALUE)) {
-      throw new ArithmeticException("Underflow: there is no smaller InetAddress than "
-          + address.getHostAddress());
+      throw new ArithmeticException(
+          "Underflow: there is no smaller InetAddress than " + address.getHostAddress());
     }
     byte[] delta = new byte[BYTES];
-    delta[BYTES-1] = 1;
+    delta[BYTES - 1] = 1;
     byte[] nextDownBytes = new byte[InetAddressPoint.BYTES];
     NumericUtils.subtract(InetAddressPoint.BYTES, 0, encode(address), delta, nextDownBytes);
     return decode(nextDownBytes);
@@ -125,18 +129,18 @@ public class InetAddressPoint extends Field {
     throw new IllegalArgumentException("cannot change value type from InetAddress to BytesRef");
   }
 
-  /** Creates a new InetAddressPoint, indexing the
-   *  provided address.
+  /**
+   * Creates a new InetAddressPoint, indexing the provided address.
    *
-   *  @param name field name
-   *  @param point InetAddress value
-   *  @throws IllegalArgumentException if the field name or value is null.
+   * @param name field name
+   * @param point InetAddress value
+   * @throws IllegalArgumentException if the field name or value is null.
    */
   public InetAddressPoint(String name, InetAddress point) {
     super(name, TYPE);
     setInetAddressValue(point);
   }
-  
+
   @Override
   public String toString() {
     StringBuilder result = new StringBuilder();
@@ -159,7 +163,7 @@ public class InetAddressPoint extends Field {
     result.append('>');
     return result.toString();
   }
-  
+
   // public helper methods (e.g. for queries)
 
   /** Encode InetAddress value into binary encoding */
@@ -176,7 +180,7 @@ public class InetAddressPoint extends Field {
     }
     return address;
   }
-  
+
   /** Decodes InetAddress value from binary encoding */
   public static InetAddress decode(byte value[]) {
     try {
@@ -189,7 +193,7 @@ public class InetAddressPoint extends Field {
 
   // static methods for generating queries
 
-  /** 
+  /**
    * Create a query for matching a network address.
    *
    * @param field field name. must not be {@code null}.
@@ -200,13 +204,14 @@ public class InetAddressPoint extends Field {
   public static Query newExactQuery(String field, InetAddress value) {
     return newRangeQuery(field, value, value);
   }
-  
-  /** 
+
+  /**
    * Create a prefix query for matching a CIDR network range.
    *
    * @param field field name. must not be {@code null}.
    * @param value any host address
-   * @param prefixLength the network prefix length for this address. This is also known as the subnet mask in the context of IPv4 addresses.
+   * @param prefixLength the network prefix length for this address. This is also known as the
+   *     subnet mask in the context of IPv4 addresses.
    * @throws IllegalArgumentException if {@code field} is null, or prefixLength is invalid.
    * @return a query matching documents with addresses contained within this network
    */
@@ -215,9 +220,13 @@ public class InetAddressPoint extends Field {
       throw new IllegalArgumentException("InetAddress must not be null");
     }
     if (prefixLength < 0 || prefixLength > 8 * value.getAddress().length) {
-      throw new IllegalArgumentException("illegal prefixLength '" + prefixLength + "'. Must be 0-32 for IPv4 ranges, 0-128 for IPv6 ranges");
+      throw new IllegalArgumentException(
+          "illegal prefixLength '"
+              + prefixLength
+              + "'. Must be 0-32 for IPv4 ranges, 0-128 for IPv6 ranges");
     }
-    // create the lower value by zeroing out the host portion, upper value by filling it with all ones.
+    // create the lower value by zeroing out the host portion, upper value by filling it with all
+    // ones.
     byte lower[] = value.getAddress();
     byte upper[] = value.getAddress();
     for (int i = prefixLength; i < 8 * lower.length; i++) {
@@ -232,20 +241,21 @@ public class InetAddressPoint extends Field {
     }
   }
 
-  /** 
+  /**
    * Create a range query for network addresses.
-   * <p>
-   * You can have half-open ranges (which are in fact &lt;/&le; or &gt;/&ge; queries)
-   * by setting {@code lowerValue = InetAddressPoint.MIN_VALUE} or
-   * {@code upperValue = InetAddressPoint.MAX_VALUE}.
-   * <p> Ranges are inclusive. For exclusive ranges, pass {@code InetAddressPoint#nextUp(lowerValue)}
+   *
+   * <p>You can have half-open ranges (which are in fact &lt;/&le; or &gt;/&ge; queries) by setting
+   * {@code lowerValue = InetAddressPoint.MIN_VALUE} or {@code upperValue =
+   * InetAddressPoint.MAX_VALUE}.
+   *
+   * <p>Ranges are inclusive. For exclusive ranges, pass {@code InetAddressPoint#nextUp(lowerValue)}
    * or {@code InetAddressPoint#nexDown(upperValue)}.
    *
    * @param field field name. must not be {@code null}.
    * @param lowerValue lower portion of the range (inclusive). must not be null.
    * @param upperValue upper portion of the range (inclusive). must not be null.
-   * @throws IllegalArgumentException if {@code field} is null, {@code lowerValue} is null, 
-   *                                  or {@code upperValue} is null
+   * @throws IllegalArgumentException if {@code field} is null, {@code lowerValue} is null, or
+   *     {@code upperValue} is null
    * @return a query matching documents within this range.
    */
   public static Query newRangeQuery(String field, InetAddress lowerValue, InetAddress upperValue) {
@@ -259,8 +269,9 @@ public class InetAddressPoint extends Field {
   }
 
   /**
-   * Create a query matching any of the specified 1D values.  This is the points equivalent of {@code TermsQuery}.
-   * 
+   * Create a query matching any of the specified 1D values. This is the points equivalent of {@code
+   * TermsQuery}.
+   *
    * @param field field name. must not be {@code null}.
    * @param values all values to match
    */
@@ -269,39 +280,44 @@ public class InetAddressPoint extends Field {
     // We must compare the encoded form (InetAddress doesn't implement Comparable, and even if it
     // did, we do our own thing with ipv4 addresses):
 
-    // NOTE: we could instead convert-per-comparison and save this extra array, at cost of slower sort:
+    // NOTE: we could instead convert-per-comparison and save this extra array, at cost of slower
+    // sort:
     byte[][] sortedValues = new byte[values.length][];
-    for(int i=0;i<values.length;i++) {
+    for (int i = 0; i < values.length; i++) {
       sortedValues[i] = encode(values[i]);
     }
 
-    Arrays.sort(sortedValues,
-                new Comparator<byte[]>() {
-                  @Override
-                  public int compare(byte[] a, byte[] b) {
-                    return Arrays.compareUnsigned(a, 0, BYTES, b, 0, BYTES);
-                  }
-                });
+    Arrays.sort(
+        sortedValues,
+        new Comparator<byte[]>() {
+          @Override
+          public int compare(byte[] a, byte[] b) {
+            return Arrays.compareUnsigned(a, 0, BYTES, b, 0, BYTES);
+          }
+        });
 
     final BytesRef encoded = new BytesRef(new byte[BYTES]);
 
-    return new PointInSetQuery(field, 1, BYTES,
-                               new PointInSetQuery.Stream() {
+    return new PointInSetQuery(
+        field,
+        1,
+        BYTES,
+        new PointInSetQuery.Stream() {
 
-                                 int upto;
+          int upto;
 
-                                 @Override
-                                 public BytesRef next() {
-                                   if (upto == sortedValues.length) {
-                                     return null;
-                                   } else {
-                                     encoded.bytes = sortedValues[upto];
-                                     assert encoded.bytes.length == encoded.length;
-                                     upto++;
-                                     return encoded;
-                                   }
-                                 }
-                               }) {
+          @Override
+          public BytesRef next() {
+            if (upto == sortedValues.length) {
+              return null;
+            } else {
+              encoded.bytes = sortedValues[upto];
+              assert encoded.bytes.length == encoded.length;
+              upto++;
+              return encoded;
+            }
+          }
+        }) {
       @Override
       protected String toString(byte[] value) {
         assert value.length == BYTES;
diff --git a/lucene/core/src/java/org/apache/lucene/document/InetAddressRange.java b/lucene/core/src/java/org/apache/lucene/document/InetAddressRange.java
index b530f99..48edf68 100644
--- a/lucene/core/src/java/org/apache/lucene/document/InetAddressRange.java
+++ b/lucene/core/src/java/org/apache/lucene/document/InetAddressRange.java
@@ -18,26 +18,30 @@ package org.apache.lucene.document;
 
 import java.net.InetAddress;
 import java.util.Arrays;
-
 import org.apache.lucene.document.RangeFieldQuery.QueryType;
 import org.apache.lucene.search.Query;
 import org.apache.lucene.util.BytesRef;
 
 /**
  * An indexed InetAddress Range Field
- * <p>
- * This field indexes an {@code InetAddress} range defined as a min/max pairs. It is single
+ *
+ * <p>This field indexes an {@code InetAddress} range defined as a min/max pairs. It is single
  * dimension only (indexed as two 16 byte paired values).
- * <p>
- * Multiple values are supported.
  *
- * <p>
- * This field defines the following static factory methods for common search operations over Ip Ranges
+ * <p>Multiple values are supported.
+ *
+ * <p>This field defines the following static factory methods for common search operations over Ip
+ * Ranges
+ *
  * <ul>
- *   <li>{@link #newIntersectsQuery newIntersectsQuery()} matches ip ranges that intersect the defined search range.
- *   <li>{@link #newWithinQuery newWithinQuery()} matches ip ranges that are within the defined search range.
- *   <li>{@link #newContainsQuery newContainsQuery()} matches ip ranges that contain the defined search range.
- *   <li>{@link #newCrossesQuery newCrossesQuery()} matches ip ranges that cross the defined search range
+ *   <li>{@link #newIntersectsQuery newIntersectsQuery()} matches ip ranges that intersect the
+ *       defined search range.
+ *   <li>{@link #newWithinQuery newWithinQuery()} matches ip ranges that are within the defined
+ *       search range.
+ *   <li>{@link #newContainsQuery newContainsQuery()} matches ip ranges that contain the defined
+ *       search range.
+ *   <li>{@link #newCrossesQuery newCrossesQuery()} matches ip ranges that cross the defined search
+ *       range
  * </ul>
  */
 public class InetAddressRange extends Field {
@@ -45,6 +49,7 @@ public class InetAddressRange extends Field {
   public static final int BYTES = InetAddressPoint.BYTES;
 
   private static final FieldType TYPE;
+
   static {
     TYPE = new FieldType();
     TYPE.setDimensions(2, BYTES);
@@ -53,6 +58,7 @@ public class InetAddressRange extends Field {
 
   /**
    * Create a new InetAddressRange from min/max value
+   *
    * @param name field name. must not be null.
    * @param min range min value; defined as an {@code InetAddress}
    * @param max range max value; defined as an {@code InetAddress}
@@ -64,16 +70,17 @@ public class InetAddressRange extends Field {
 
   /**
    * Change (or set) the min/max values of the field.
+   *
    * @param min range min value; defined as an {@code InetAddress}
    * @param max range max value; defined as an {@code InetAddress}
    */
   public void setRangeValues(InetAddress min, InetAddress max) {
     final byte[] bytes;
     if (fieldsData == null) {
-      bytes = new byte[BYTES*2];
+      bytes = new byte[BYTES * 2];
       fieldsData = new BytesRef(bytes);
     } else {
-      bytes = ((BytesRef)fieldsData).bytes;
+      bytes = ((BytesRef) fieldsData).bytes;
     }
     encode(min, max, bytes);
   }
@@ -85,7 +92,8 @@ public class InetAddressRange extends Field {
     final byte[] maxEncoded = InetAddressPoint.encode(max);
     // ensure min is lt max
     if (Arrays.compareUnsigned(minEncoded, 0, BYTES, maxEncoded, 0, BYTES) > 0) {
-      throw new IllegalArgumentException("min value cannot be greater than max value for InetAddressRange field");
+      throw new IllegalArgumentException(
+          "min value cannot be greater than max value for InetAddressRange field");
     }
     System.arraycopy(minEncoded, 0, bytes, 0, BYTES);
     System.arraycopy(maxEncoded, 0, bytes, BYTES, BYTES);
@@ -93,30 +101,35 @@ public class InetAddressRange extends Field {
 
   /** encode the min/max range and return the byte array */
   private static byte[] encode(InetAddress min, InetAddress max) {
-    byte[] b = new byte[BYTES*2];
+    byte[] b = new byte[BYTES * 2];
     encode(min, max, b);
     return b;
   }
 
   /**
    * Create a query for matching indexed ip ranges that {@code INTERSECT} the defined range.
+   *
    * @param field field name. must not be null.
    * @param min range min value; provided as an {@code InetAddress}
    * @param max range max value; provided as an {@code InetAddress}
    * @return query for matching intersecting ranges (overlap, within, crosses, or contains)
-   * @throws IllegalArgumentException if {@code field} is null, {@code min} or {@code max} is invalid
+   * @throws IllegalArgumentException if {@code field} is null, {@code min} or {@code max} is
+   *     invalid
    */
-  public static Query newIntersectsQuery(String field, final InetAddress min, final InetAddress max) {
+  public static Query newIntersectsQuery(
+      String field, final InetAddress min, final InetAddress max) {
     return newRelationQuery(field, min, max, QueryType.INTERSECTS);
   }
 
   /**
    * Create a query for matching indexed ip ranges that {@code CONTAINS} the defined range.
+   *
    * @param field field name. must not be null.
    * @param min range min value; provided as an {@code InetAddress}
    * @param max range max value; provided as an {@code InetAddress}
    * @return query for matching intersecting ranges (overlap, within, crosses, or contains)
-   * @throws IllegalArgumentException if {@code field} is null, {@code min} or {@code max} is invalid
+   * @throws IllegalArgumentException if {@code field} is null, {@code min} or {@code max} is
+   *     invalid
    */
   public static Query newContainsQuery(String field, final InetAddress min, final InetAddress max) {
     return newRelationQuery(field, min, max, QueryType.CONTAINS);
@@ -124,11 +137,13 @@ public class InetAddressRange extends Field {
 
   /**
    * Create a query for matching indexed ip ranges that are {@code WITHIN} the defined range.
+   *
    * @param field field name. must not be null.
    * @param min range min value; provided as an {@code InetAddress}
    * @param max range max value; provided as an {@code InetAddress}
    * @return query for matching intersecting ranges (overlap, within, crosses, or contains)
-   * @throws IllegalArgumentException if {@code field} is null, {@code min} or {@code max} is invalid
+   * @throws IllegalArgumentException if {@code field} is null, {@code min} or {@code max} is
+   *     invalid
    */
   public static Query newWithinQuery(String field, final InetAddress min, final InetAddress max) {
     return newRelationQuery(field, min, max, QueryType.WITHIN);
@@ -136,18 +151,21 @@ public class InetAddressRange extends Field {
 
   /**
    * Create a query for matching indexed ip ranges that {@code CROSS} the defined range.
+   *
    * @param field field name. must not be null.
    * @param min range min value; provided as an {@code InetAddress}
    * @param max range max value; provided as an {@code InetAddress}
    * @return query for matching intersecting ranges (overlap, within, crosses, or contains)
-   * @throws IllegalArgumentException if {@code field} is null, {@code min} or {@code max} is invalid
+   * @throws IllegalArgumentException if {@code field} is null, {@code min} or {@code max} is
+   *     invalid
    */
   public static Query newCrossesQuery(String field, final InetAddress min, final InetAddress max) {
     return newRelationQuery(field, min, max, QueryType.CROSSES);
   }
 
   /** helper method for creating the desired relational query */
-  private static Query newRelationQuery(String field, final InetAddress min, final InetAddress max, QueryType relation) {
+  private static Query newRelationQuery(
+      String field, final InetAddress min, final InetAddress max, QueryType relation) {
     return new RangeFieldQuery(field, encode(min, max), 1, relation) {
       @Override
       protected String toString(byte[] ranges, int dimension) {
@@ -158,6 +176,7 @@ public class InetAddressRange extends Field {
 
   /**
    * Returns the String representation for the range at the given dimension
+   *
    * @param ranges the encoded ranges, never null
    * @param dimension the dimension of interest (not used for this field)
    * @return The string representation for the range at the provided dimension
diff --git a/lucene/core/src/java/org/apache/lucene/document/IntPoint.java b/lucene/core/src/java/org/apache/lucene/document/IntPoint.java
index c138f50..dfde582 100644
--- a/lucene/core/src/java/org/apache/lucene/document/IntPoint.java
+++ b/lucene/core/src/java/org/apache/lucene/document/IntPoint.java
@@ -18,7 +18,6 @@ package org.apache.lucene.document;
 
 import java.util.Arrays;
 import java.util.Collection;
-
 import org.apache.lucene.index.PointValues;
 import org.apache.lucene.search.PointInSetQuery;
 import org.apache.lucene.search.PointRangeQuery;
@@ -26,21 +25,23 @@ import org.apache.lucene.search.Query;
 import org.apache.lucene.util.BytesRef;
 import org.apache.lucene.util.NumericUtils;
 
-/** 
- * An indexed {@code int} field for fast range filters.  If you also
- * need to store the value, you should add a separate {@link StoredField} instance.
- * <p>
- * Finding all documents within an N-dimensional shape or range at search time is
- * efficient.  Multiple values for the same field in one document
- * is allowed.
- * <p>
- * This field defines static factory methods for creating common queries:
+/**
+ * An indexed {@code int} field for fast range filters. If you also need to store the value, you
+ * should add a separate {@link StoredField} instance.
+ *
+ * <p>Finding all documents within an N-dimensional shape or range at search time is efficient.
+ * Multiple values for the same field in one document is allowed.
+ *
+ * <p>This field defines static factory methods for creating common queries:
+ *
  * <ul>
  *   <li>{@link #newExactQuery(String, int)} for matching an exact 1D point.
  *   <li>{@link #newSetQuery(String, int...)} for matching a set of 1D values.
  *   <li>{@link #newRangeQuery(String, int, int)} for matching a 1D range.
- *   <li>{@link #newRangeQuery(String, int[], int[])} for matching points/ranges in n-dimensional space.
+ *   <li>{@link #newRangeQuery(String, int[], int[])} for matching points/ranges in n-dimensional
+ *       space.
  * </ul>
+ *
  * @see PointValues
  */
 public final class IntPoint extends Field {
@@ -59,7 +60,14 @@ public final class IntPoint extends Field {
   /** Change the values of this field */
   public void setIntValues(int... point) {
     if (type.pointDimensionCount() != point.length) {
-      throw new IllegalArgumentException("this field (name=" + name + ") uses " + type.pointDimensionCount() + " dimensions; cannot change to (incoming) " + point.length + " dimensions");
+      throw new IllegalArgumentException(
+          "this field (name="
+              + name
+              + ") uses "
+              + type.pointDimensionCount()
+              + " dimensions; cannot change to (incoming) "
+              + point.length
+              + " dimensions");
     }
     fieldsData = pack(point);
   }
@@ -72,7 +80,12 @@ public final class IntPoint extends Field {
   @Override
   public Number numericValue() {
     if (type.pointDimensionCount() != 1) {
-      throw new IllegalStateException("this field (name=" + name + ") uses " + type.pointDimensionCount() + " dimensions; cannot convert to a single numeric value");
+      throw new IllegalStateException(
+          "this field (name="
+              + name
+              + ") uses "
+              + type.pointDimensionCount()
+              + " dimensions; cannot convert to a single numeric value");
     }
     BytesRef bytes = (BytesRef) fieldsData;
     assert bytes.length == Integer.BYTES;
@@ -80,7 +93,7 @@ public final class IntPoint extends Field {
   }
 
   /**
-   *  Pack an integer point into a BytesRef
+   * Pack an integer point into a BytesRef
    *
    * @param point int[] value
    * @throws IllegalArgumentException is the value is null or of zero length
@@ -93,7 +106,7 @@ public final class IntPoint extends Field {
       throw new IllegalArgumentException("point must not be 0 dimensions");
     }
     byte[] packed = new byte[point.length * Integer.BYTES];
-    
+
     for (int dim = 0; dim < point.length; dim++) {
       encodeDimension(point[dim], packed, dim * Integer.BYTES);
     }
@@ -101,17 +114,17 @@ public final class IntPoint extends Field {
     return new BytesRef(packed);
   }
 
-  /** Creates a new IntPoint, indexing the
-   *  provided N-dimensional int point.
+  /**
+   * Creates a new IntPoint, indexing the provided N-dimensional int point.
    *
-   *  @param name field name
-   *  @param point int[] value
-   *  @throws IllegalArgumentException if the field name or value is null.
+   * @param name field name
+   * @param point int[] value
+   * @throws IllegalArgumentException if the field name or value is null.
    */
   public IntPoint(String name, int... point) {
     super(name, pack(point), getType(point.length));
   }
-  
+
   @Override
   public String toString() {
     StringBuilder result = new StringBuilder();
@@ -131,26 +144,26 @@ public final class IntPoint extends Field {
     result.append('>');
     return result.toString();
   }
-  
+
   // public helper methods (e.g. for queries)
-  
+
   /** Encode single integer dimension */
   public static void encodeDimension(int value, byte dest[], int offset) {
     NumericUtils.intToSortableBytes(value, dest, offset);
   }
-  
+
   /** Decode single integer dimension */
   public static int decodeDimension(byte value[], int offset) {
     return NumericUtils.sortableBytesToInt(value, offset);
   }
-  
+
   // static methods for generating queries
-  
-  /** 
+
+  /**
    * Create a query for matching an exact integer value.
-   * <p>
-   * This is for simple one-dimension points, for multidimensional points use
-   * {@link #newRangeQuery(String, int[], int[])} instead.
+   *
+   * <p>This is for simple one-dimension points, for multidimensional points use {@link
+   * #newRangeQuery(String, int[], int[])} instead.
    *
    * @param field field name. must not be {@code null}.
    * @param value exact value
@@ -161,17 +174,17 @@ public final class IntPoint extends Field {
     return newRangeQuery(field, value, value);
   }
 
-  /** 
+  /**
    * Create a range query for integer values.
-   * <p>
-   * This is for simple one-dimension ranges, for multidimensional ranges use
-   * {@link #newRangeQuery(String, int[], int[])} instead.
-   * <p>
-   * You can have half-open ranges (which are in fact &lt;/&le; or &gt;/&ge; queries)
-   * by setting {@code lowerValue = Integer.MIN_VALUE} or {@code upperValue = Integer.MAX_VALUE}.
-   * <p>
-   * Ranges are inclusive. For exclusive ranges, pass {@code Math.addExact(lowerValue, 1)}
-   * or {@code Math.addExact(upperValue, -1)}.
+   *
+   * <p>This is for simple one-dimension ranges, for multidimensional ranges use {@link
+   * #newRangeQuery(String, int[], int[])} instead.
+   *
+   * <p>You can have half-open ranges (which are in fact &lt;/&le; or &gt;/&ge; queries) by setting
+   * {@code lowerValue = Integer.MIN_VALUE} or {@code upperValue = Integer.MAX_VALUE}.
+   *
+   * <p>Ranges are inclusive. For exclusive ranges, pass {@code Math.addExact(lowerValue, 1)} or
+   * {@code Math.addExact(upperValue, -1)}.
    *
    * @param field field name. must not be {@code null}.
    * @param lowerValue lower portion of the range (inclusive).
@@ -180,28 +193,29 @@ public final class IntPoint extends Field {
    * @return a query matching documents within this range.
    */
   public static Query newRangeQuery(String field, int lowerValue, int upperValue) {
-    return newRangeQuery(field, new int[] { lowerValue }, new int[] { upperValue });
+    return newRangeQuery(field, new int[] {lowerValue}, new int[] {upperValue});
   }
 
-  /** 
+  /**
    * Create a range query for n-dimensional integer values.
-   * <p>
-   * You can have half-open ranges (which are in fact &lt;/&le; or &gt;/&ge; queries)
-   * by setting {@code lowerValue[i] = Integer.MIN_VALUE} or {@code upperValue[i] = Integer.MAX_VALUE}. 
-   * <p>
-   * Ranges are inclusive. For exclusive ranges, pass {@code Math.addExact(lowerValue[i], 1)}
-   * or {@code Math.addExact(upperValue[i], -1)}.
+   *
+   * <p>You can have half-open ranges (which are in fact &lt;/&le; or &gt;/&ge; queries) by setting
+   * {@code lowerValue[i] = Integer.MIN_VALUE} or {@code upperValue[i] = Integer.MAX_VALUE}.
+   *
+   * <p>Ranges are inclusive. For exclusive ranges, pass {@code Math.addExact(lowerValue[i], 1)} or
+   * {@code Math.addExact(upperValue[i], -1)}.
    *
    * @param field field name. must not be {@code null}.
    * @param lowerValue lower portion of the range (inclusive). must not be {@code null}.
    * @param upperValue upper portion of the range (inclusive). must not be {@code null}.
-   * @throws IllegalArgumentException if {@code field} is null, if {@code lowerValue} is null, if {@code upperValue} is null, 
-   *                                  or if {@code lowerValue.length != upperValue.length}
+   * @throws IllegalArgumentException if {@code field} is null, if {@code lowerValue} is null, if
+   *     {@code upperValue} is null, or if {@code lowerValue.length != upperValue.length}
    * @return a query matching documents within this range.
    */
   public static Query newRangeQuery(String field, int[] lowerValue, int[] upperValue) {
     PointRangeQuery.checkArgs(field, lowerValue, upperValue);
-    return new PointRangeQuery(field, pack(lowerValue).bytes, pack(upperValue).bytes, lowerValue.length) {
+    return new PointRangeQuery(
+        field, pack(lowerValue).bytes, pack(upperValue).bytes, lowerValue.length) {
       @Override
       protected String toString(int dimension, byte[] value) {
         return Integer.toString(decodeDimension(value, 0));
@@ -210,8 +224,9 @@ public final class IntPoint extends Field {
   }
 
   /**
-   * Create a query matching any of the specified 1D values.  This is the points equivalent of {@code TermsQuery}.
-   * 
+   * Create a query matching any of the specified 1D values. This is the points equivalent of {@code
+   * TermsQuery}.
+   *
    * @param field field name. must not be {@code null}.
    * @param values all values to match
    */
@@ -223,22 +238,25 @@ public final class IntPoint extends Field {
 
     final BytesRef encoded = new BytesRef(new byte[Integer.BYTES]);
 
-    return new PointInSetQuery(field, 1, Integer.BYTES,
-                               new PointInSetQuery.Stream() {
+    return new PointInSetQuery(
+        field,
+        1,
+        Integer.BYTES,
+        new PointInSetQuery.Stream() {
 
-                                 int upto;
+          int upto;
 
-                                 @Override
-                                 public BytesRef next() {
-                                   if (upto == sortedValues.length) {
-                                     return null;
-                                   } else {
-                                     encodeDimension(sortedValues[upto], encoded.bytes, 0);
-                                     upto++;
-                                     return encoded;
-                                   }
-                                 }
-                               }) {
+          @Override
+          public BytesRef next() {
+            if (upto == sortedValues.length) {
+              return null;
+            } else {
+              encodeDimension(sortedValues[upto], encoded.bytes, 0);
+              upto++;
+              return encoded;
+            }
+          }
+        }) {
       @Override
       protected String toString(byte[] value) {
         assert value.length == Integer.BYTES;
@@ -246,10 +264,11 @@ public final class IntPoint extends Field {
       }
     };
   }
-  
+
   /**
-   * Create a query matching any of the specified 1D values.  This is the points equivalent of {@code TermsQuery}.
-   * 
+   * Create a query matching any of the specified 1D values. This is the points equivalent of {@code
+   * TermsQuery}.
+   *
    * @param field field name. must not be {@code null}.
    * @param values all values to match
    */
diff --git a/lucene/core/src/java/org/apache/lucene/document/IntRange.java b/lucene/core/src/java/org/apache/lucene/document/IntRange.java
index b03fe8f..74ad82f 100644
--- a/lucene/core/src/java/org/apache/lucene/document/IntRange.java
+++ b/lucene/core/src/java/org/apache/lucene/document/IntRange.java
@@ -17,7 +17,6 @@
 package org.apache.lucene.document;
 
 import java.util.Objects;
-
 import org.apache.lucene.document.RangeFieldQuery.QueryType;
 import org.apache.lucene.search.Query;
 import org.apache.lucene.util.BytesRef;
@@ -25,20 +24,25 @@ import org.apache.lucene.util.NumericUtils;
 
 /**
  * An indexed Integer Range field.
- * <p>
- * This field indexes dimensional ranges defined as min/max pairs. It supports
- * up to a maximum of 4 dimensions (indexed as 8 numeric values). With 1 dimension representing a single integer range,
- * 2 dimensions representing a bounding box, 3 dimensions a bounding cube, and 4 dimensions a tesseract.
- * <p>
- * Multiple values for the same field in one document is supported, and open ended ranges can be defined using
- * {@code Integer.MIN_VALUE} and {@code Integer.MAX_VALUE}.
  *
- * <p>
- * This field defines the following static factory methods for common search operations over integer ranges:
+ * <p>This field indexes dimensional ranges defined as min/max pairs. It supports up to a maximum of
+ * 4 dimensions (indexed as 8 numeric values). With 1 dimension representing a single integer range,
+ * 2 dimensions representing a bounding box, 3 dimensions a bounding cube, and 4 dimensions a
+ * tesseract.
+ *
+ * <p>Multiple values for the same field in one document is supported, and open ended ranges can be
+ * defined using {@code Integer.MIN_VALUE} and {@code Integer.MAX_VALUE}.
+ *
+ * <p>This field defines the following static factory methods for common search operations over
+ * integer ranges:
+ *
  * <ul>
- *   <li>{@link #newIntersectsQuery newIntersectsQuery()} matches ranges that intersect the defined search range.
- *   <li>{@link #newWithinQuery newWithinQuery()} matches ranges that are within the defined search range.
- *   <li>{@link #newContainsQuery newContainsQuery()} matches ranges that contain the defined search range.
+ *   <li>{@link #newIntersectsQuery newIntersectsQuery()} matches ranges that intersect the defined
+ *       search range.
+ *   <li>{@link #newWithinQuery newWithinQuery()} matches ranges that are within the defined search
+ *       range.
+ *   <li>{@link #newContainsQuery newContainsQuery()} matches ranges that contain the defined search
+ *       range.
  * </ul>
  */
 public class IntRange extends Field {
@@ -65,30 +69,38 @@ public class IntRange extends Field {
 
     FieldType ft = new FieldType();
     // dimensions is set as 2*dimension size (min/max per dimension)
-    ft.setDimensions(dimensions*2, BYTES);
+    ft.setDimensions(dimensions * 2, BYTES);
     ft.freeze();
     return ft;
   }
 
   /**
    * Changes the values of the field.
+   *
    * @param min array of min values. (accepts {@code Integer.NEGATIVE_INFINITY})
    * @param max array of max values. (accepts {@code Integer.POSITIVE_INFINITY})
    * @throws IllegalArgumentException if {@code min} or {@code max} is invalid
    */
   public void setRangeValues(int[] min, int[] max) {
     checkArgs(min, max);
-    if (min.length*2 != type.pointDimensionCount() || max.length*2 != type.pointDimensionCount()) {
-      throw new IllegalArgumentException("field (name=" + name + ") uses " + type.pointDimensionCount()/2
-          + " dimensions; cannot change to (incoming) " + min.length + " dimensions");
+    if (min.length * 2 != type.pointDimensionCount()
+        || max.length * 2 != type.pointDimensionCount()) {
+      throw new IllegalArgumentException(
+          "field (name="
+              + name
+              + ") uses "
+              + type.pointDimensionCount() / 2
+              + " dimensions; cannot change to (incoming) "
+              + min.length
+              + " dimensions");
     }
 
     final byte[] bytes;
     if (fieldsData == null) {
-      bytes = new byte[BYTES*2*min.length];
+      bytes = new byte[BYTES * 2 * min.length];
       fieldsData = new BytesRef(bytes);
     } else {
-      bytes = ((BytesRef)fieldsData).bytes;
+      bytes = ((BytesRef) fieldsData).bytes;
     }
     verifyAndEncode(min, max, bytes);
   }
@@ -106,32 +118,32 @@ public class IntRange extends Field {
     }
   }
 
-  /**
-   * Encodes the min, max ranges into a byte array
-   */
+  /** Encodes the min, max ranges into a byte array */
   static byte[] encode(int[] min, int[] max) {
     checkArgs(min, max);
-    byte[] b = new byte[BYTES*2*min.length];
+    byte[] b = new byte[BYTES * 2 * min.length];
     verifyAndEncode(min, max, b);
     return b;
   }
 
   /**
    * encode the ranges into a sortable byte array ({@code Double.NaN} not allowed)
-   * <p>
-   * example for 4 dimensions (8 bytes per dimension value):
-   * minD1 ... minD4 | maxD1 ... maxD4
+   *
+   * <p>example for 4 dimensions (8 bytes per dimension value): minD1 ... minD4 | maxD1 ... maxD4
    */
   static void verifyAndEncode(int[] min, int[] max, byte[] bytes) {
-    for (int d=0,i=0,j=min.length*BYTES; d<min.length; ++d, i+=BYTES, j+=BYTES) {
+    for (int d = 0, i = 0, j = min.length * BYTES; d < min.length; ++d, i += BYTES, j += BYTES) {
       if (Double.isNaN(min[d])) {
-        throw new IllegalArgumentException("invalid min value (" + Double.NaN + ")" + " in IntRange");
+        throw new IllegalArgumentException(
+            "invalid min value (" + Double.NaN + ")" + " in IntRange");
       }
       if (Double.isNaN(max[d])) {
-        throw new IllegalArgumentException("invalid max value (" + Double.NaN + ")" + " in IntRange");
+        throw new IllegalArgumentException(
+            "invalid max value (" + Double.NaN + ")" + " in IntRange");
       }
       if (min[d] > max[d]) {
-        throw new IllegalArgumentException("min value (" + min[d] + ") is greater than max value (" + max[d] + ")");
+        throw new IllegalArgumentException(
+            "min value (" + min[d] + ") is greater than max value (" + max[d] + ")");
       }
       encode(min[d], bytes, i);
       encode(max[d], bytes, j);
@@ -145,43 +157,47 @@ public class IntRange extends Field {
 
   /**
    * Get the min value for the given dimension
+   *
    * @param dimension the dimension, always positive
    * @return the decoded min value
    */
   public int getMin(int dimension) {
-    Objects.checkIndex(dimension, type.pointDimensionCount()/2);
-    return decodeMin(((BytesRef)fieldsData).bytes, dimension);
+    Objects.checkIndex(dimension, type.pointDimensionCount() / 2);
+    return decodeMin(((BytesRef) fieldsData).bytes, dimension);
   }
 
   /**
    * Get the max value for the given dimension
+   *
    * @param dimension the dimension, always positive
    * @return the decoded max value
    */
   public int getMax(int dimension) {
-    Objects.checkIndex(dimension, type.pointDimensionCount()/2);
-    return decodeMax(((BytesRef)fieldsData).bytes, dimension);
+    Objects.checkIndex(dimension, type.pointDimensionCount() / 2);
+    return decodeMax(((BytesRef) fieldsData).bytes, dimension);
   }
 
   /** decodes the min value (for the defined dimension) from the encoded input byte array */
   static int decodeMin(byte[] b, int dimension) {
-    int offset = dimension*BYTES;
+    int offset = dimension * BYTES;
     return NumericUtils.sortableBytesToInt(b, offset);
   }
 
   /** decodes the max value (for the defined dimension) from the encoded input byte array */
   static int decodeMax(byte[] b, int dimension) {
-    int offset = b.length/2 + dimension*BYTES;
+    int offset = b.length / 2 + dimension * BYTES;
     return NumericUtils.sortableBytesToInt(b, offset);
   }
 
   /**
    * Create a query for matching indexed ranges that intersect the defined range.
+   *
    * @param field field name. must not be null.
    * @param min array of min values. (accepts {@code Integer.MIN_VALUE})
    * @param max array of max values. (accepts {@code Integer.MAX_VALUE})
    * @return query for matching intersecting ranges (overlap, within, or contains)
-   * @throws IllegalArgumentException if {@code field} is null, {@code min} or {@code max} is invalid
+   * @throws IllegalArgumentException if {@code field} is null, {@code min} or {@code max} is
+   *     invalid
    */
   public static Query newIntersectsQuery(String field, final int[] min, final int[] max) {
     return newRelationQuery(field, min, max, QueryType.INTERSECTS);
@@ -189,11 +205,13 @@ public class IntRange extends Field {
 
   /**
    * Create a query for matching indexed ranges that contain the defined range.
+   *
    * @param field field name. must not be null.
    * @param min array of min values. (accepts {@code Integer.MIN_VALUE})
    * @param max array of max values. (accepts {@code Integer.MAX_VALUE})
    * @return query for matching ranges that contain the defined range
-   * @throws IllegalArgumentException if {@code field} is null, {@code min} or {@code max} is invalid
+   * @throws IllegalArgumentException if {@code field} is null, {@code min} or {@code max} is
+   *     invalid
    */
   public static Query newContainsQuery(String field, final int[] min, final int[] max) {
     return newRelationQuery(field, min, max, QueryType.CONTAINS);
@@ -201,32 +219,37 @@ public class IntRange extends Field {
 
   /**
    * Create a query for matching indexed ranges that are within the defined range.
+   *
    * @param field field name. must not be null.
    * @param min array of min values. (accepts {@code Integer.MIN_VALUE})
    * @param max array of max values. (accepts {@code Integer.MAX_VALUE})
    * @return query for matching ranges within the defined range
-   * @throws IllegalArgumentException if {@code field} is null, {@code min} or {@code max} is invalid
+   * @throws IllegalArgumentException if {@code field} is null, {@code min} or {@code max} is
+   *     invalid
    */
   public static Query newWithinQuery(String field, final int[] min, final int[] max) {
     return newRelationQuery(field, min, max, QueryType.WITHIN);
   }
 
   /**
-   * Create a query for matching indexed ranges that cross the defined range.
-   * A CROSSES is defined as any set of ranges that are not disjoint and not wholly contained by
-   * the query. Effectively, its the complement of union(WITHIN, DISJOINT).
+   * Create a query for matching indexed ranges that cross the defined range. A CROSSES is defined
+   * as any set of ranges that are not disjoint and not wholly contained by the query. Effectively,
+   * its the complement of union(WITHIN, DISJOINT).
+   *
    * @param field field name. must not be null.
    * @param min array of min values. (accepts {@code Integer.MIN_VALUE})
    * @param max array of max values. (accepts {@code Integer.MAX_VALUE})
    * @return query for matching ranges within the defined range
-   * @throws IllegalArgumentException if {@code field} is null, {@code min} or {@code max} is invalid
+   * @throws IllegalArgumentException if {@code field} is null, {@code min} or {@code max} is
+   *     invalid
    */
   public static Query newCrossesQuery(String field, final int[] min, final int[] max) {
     return newRelationQuery(field, min, max, QueryType.CROSSES);
   }
 
   /** helper method for creating the desired relational query */
-  private static Query newRelationQuery(String field, final int[] min, final int[] max, QueryType relation) {
+  private static Query newRelationQuery(
+      String field, final int[] min, final int[] max, QueryType relation) {
     checkArgs(min, max);
     return new RangeFieldQuery(field, encode(min, max), min.length, relation) {
       @Override
@@ -243,7 +266,7 @@ public class IntRange extends Field {
     sb.append(" <");
     sb.append(name);
     sb.append(':');
-    byte[] b = ((BytesRef)fieldsData).bytes;
+    byte[] b = ((BytesRef) fieldsData).bytes;
     toString(b, 0);
     for (int d = 0; d < type.pointDimensionCount() / 2; ++d) {
       sb.append(' ');
@@ -256,12 +279,16 @@ public class IntRange extends Field {
 
   /**
    * Returns the String representation for the range at the given dimension
+   *
    * @param ranges the encoded ranges, never null
    * @param dimension the dimension of interest
    * @return The string representation for the range at the provided dimension
    */
   private static String toString(byte[] ranges, int dimension) {
-    return "[" + Integer.toString(decodeMin(ranges, dimension)) + " : "
-        + Integer.toString(decodeMax(ranges, dimension)) + "]";
+    return "["
+        + Integer.toString(decodeMin(ranges, dimension))
+        + " : "
+        + Integer.toString(decodeMax(ranges, dimension))
+        + "]";
   }
 }
diff --git a/lucene/core/src/java/org/apache/lucene/document/IntRangeDocValuesField.java b/lucene/core/src/java/org/apache/lucene/document/IntRangeDocValuesField.java
index f23d152..ece6c49 100644
--- a/lucene/core/src/java/org/apache/lucene/document/IntRangeDocValuesField.java
+++ b/lucene/core/src/java/org/apache/lucene/document/IntRangeDocValuesField.java
@@ -20,10 +20,10 @@ package org.apache.lucene.document;
 import org.apache.lucene.search.Query;
 
 /**
- * DocValues field for IntRange. This is a single valued field per document
- * due to being an extension of BinaryDocValuesField.
+ * DocValues field for IntRange. This is a single valued field per document due to being an
+ * extension of BinaryDocValuesField.
  */
-public class IntRangeDocValuesField extends BinaryRangeDocValuesField{
+public class IntRangeDocValuesField extends BinaryRangeDocValuesField {
   final String field;
   final int[] min;
   final int[] max;
@@ -55,22 +55,23 @@ public class IntRangeDocValuesField extends BinaryRangeDocValuesField{
     return max[dimension];
   }
 
-  private static Query newSlowRangeQuery(String field, final int[] min, final int[] max,
-                                        RangeFieldQuery.QueryType queryType) {
+  private static Query newSlowRangeQuery(
+      String field, final int[] min, final int[] max, RangeFieldQuery.QueryType queryType) {
     checkArgs(min, max);
     return new IntRangeSlowRangeQuery(field, min, max, queryType);
   }
 
-  /** Create a new range query that finds all ranges that intersect using doc values.
-   *  NOTE: This doesn't leverage indexing and may be slow.
-   *  @see IntRange#newIntersectsQuery */
+  /**
+   * Create a new range query that finds all ranges that intersect using doc values. NOTE: This
+   * doesn't leverage indexing and may be slow.
+   *
+   * @see IntRange#newIntersectsQuery
+   */
   public static Query newSlowIntersectsQuery(String field, final int[] min, final int[] max) {
     return newSlowRangeQuery(field, min, max, RangeFieldQuery.QueryType.INTERSECTS);
   }
 
-  /**
-   * validate the arguments
-   */
+  /** validate the arguments */
   private static void checkArgs(final int[] min, final int[] max) {
     if (min == null || max == null || min.length == 0 || max.length == 0) {
       throw new IllegalArgumentException("min/max range values cannot be null or empty");
@@ -81,7 +82,8 @@ public class IntRangeDocValuesField extends BinaryRangeDocValuesField{
 
     for (int i = 0; i < min.length; i++) {
       if (min[i] > max[i]) {
-        throw new IllegalArgumentException("min should be less than max but min = " + min[i] + " and max = " + max[i]);
+        throw new IllegalArgumentException(
+            "min should be less than max but min = " + min[i] + " and max = " + max[i]);
       }
     }
   }
diff --git a/lucene/core/src/java/org/apache/lucene/document/IntRangeSlowRangeQuery.java b/lucene/core/src/java/org/apache/lucene/document/IntRangeSlowRangeQuery.java
index ed62108..cd0714a 100644
--- a/lucene/core/src/java/org/apache/lucene/document/IntRangeSlowRangeQuery.java
+++ b/lucene/core/src/java/org/apache/lucene/document/IntRangeSlowRangeQuery.java
@@ -19,7 +19,6 @@ package org.apache.lucene.document;
 import java.io.IOException;
 import java.util.Arrays;
 import java.util.Objects;
-
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.search.Query;
 import org.apache.lucene.search.QueryVisitor;
@@ -69,8 +68,7 @@ class IntRangeSlowRangeQuery extends BinaryRangeFieldRangeQuery {
     if (this.field.equals(field) == false) {
       b.append(this.field).append(":");
     }
-    return b
-        .append("[")
+    return b.append("[")
         .append(Arrays.toString(min))
         .append(" TO ")
         .append(Arrays.toString(max))
@@ -89,4 +87,4 @@ class IntRangeSlowRangeQuery extends BinaryRangeFieldRangeQuery {
     IntRange.verifyAndEncode(min, max, result);
     return result;
   }
-}
\ No newline at end of file
+}
diff --git a/lucene/core/src/java/org/apache/lucene/document/LatLonDocValuesBoxQuery.java b/lucene/core/src/java/org/apache/lucene/document/LatLonDocValuesBoxQuery.java
index 180caa5..3eaac0c 100644
--- a/lucene/core/src/java/org/apache/lucene/document/LatLonDocValuesBoxQuery.java
+++ b/lucene/core/src/java/org/apache/lucene/document/LatLonDocValuesBoxQuery.java
@@ -17,7 +17,6 @@
 package org.apache.lucene.document;
 
 import java.io.IOException;
-
 import org.apache.lucene.geo.GeoEncodingUtils;
 import org.apache.lucene.geo.GeoUtils;
 import org.apache.lucene.index.DocValues;
@@ -40,7 +39,12 @@ final class LatLonDocValuesBoxQuery extends Query {
   private final int minLatitude, maxLatitude, minLongitude, maxLongitude;
   private final boolean crossesDateline;
 
-  LatLonDocValuesBoxQuery(String field, double minLatitude, double maxLatitude, double minLongitude, double maxLongitude) {
+  LatLonDocValuesBoxQuery(
+      String field,
+      double minLatitude,
+      double maxLatitude,
+      double minLongitude,
+      double maxLongitude) {
     GeoUtils.checkLatitude(minLatitude);
     GeoUtils.checkLatitude(maxLatitude);
     GeoUtils.checkLongitude(minLongitude);
@@ -76,12 +80,12 @@ final class LatLonDocValuesBoxQuery extends Query {
       return false;
     }
     LatLonDocValuesBoxQuery other = (LatLonDocValuesBoxQuery) obj;
-    return field.equals(other.field) &&
-        crossesDateline == other.crossesDateline &&
-        minLatitude == other.minLatitude &&
-        maxLatitude == other.maxLatitude &&
-        minLongitude == other.minLongitude &&
-        maxLongitude == other.maxLongitude;
+    return field.equals(other.field)
+        && crossesDateline == other.crossesDateline
+        && minLatitude == other.minLatitude
+        && maxLatitude == other.maxLatitude
+        && minLongitude == other.minLongitude
+        && maxLongitude == other.maxLongitude;
   }
 
   @Override
@@ -104,7 +108,8 @@ final class LatLonDocValuesBoxQuery extends Query {
   }
 
   @Override
-  public Weight createWeight(IndexSearcher searcher, ScoreMode scoreMode, float boost) throws IOException {
+  public Weight createWeight(IndexSearcher searcher, ScoreMode scoreMode, float boost)
+      throws IOException {
     return new ConstantScoreWeight(this, boost) {
       @Override
       public Scorer scorer(LeafReaderContext context) throws IOException {
@@ -113,40 +118,41 @@ final class LatLonDocValuesBoxQuery extends Query {
           return null;
         }
 
-        final TwoPhaseIterator iterator = new TwoPhaseIterator(values) {
-          @Override
-          public boolean matches() throws IOException {
-            for (int i = 0, count = values.docValueCount(); i < count; ++i) {
-              final long value = values.nextValue();
-              final int lat = (int) (value >>> 32);
-              if (lat < minLatitude || lat > maxLatitude) {
-                // not within latitude range
-                continue;
-              }
-
-              final int lon = (int) (value & 0xFFFFFFFF);
-              if (crossesDateline) {
-                if (lon > maxLongitude && lon < minLongitude) {
-                  // not within longitude range
-                  continue;
-                }
-              } else {
-                if (lon < minLongitude || lon > maxLongitude) {
-                  // not within longitude range
-                  continue;
+        final TwoPhaseIterator iterator =
+            new TwoPhaseIterator(values) {
+              @Override
+              public boolean matches() throws IOException {
+                for (int i = 0, count = values.docValueCount(); i < count; ++i) {
+                  final long value = values.nextValue();
+                  final int lat = (int) (value >>> 32);
+                  if (lat < minLatitude || lat > maxLatitude) {
+                    // not within latitude range
+                    continue;
+                  }
+
+                  final int lon = (int) (value & 0xFFFFFFFF);
+                  if (crossesDateline) {
+                    if (lon > maxLongitude && lon < minLongitude) {
+                      // not within longitude range
+                      continue;
+                    }
+                  } else {
+                    if (lon < minLongitude || lon > maxLongitude) {
+                      // not within longitude range
+                      continue;
+                    }
+                  }
+
+                  return true;
                 }
+                return false;
               }
 
-              return true;
-            }
-            return false;
-          }
-
-          @Override
-          public float matchCost() {
-            return 5; // 5 comparisons
-          }
-        };
+              @Override
+              public float matchCost() {
+                return 5; // 5 comparisons
+              }
+            };
         return new ConstantScoreScorer(this, boost, scoreMode, iterator);
       }
 
@@ -154,8 +160,6 @@ final class LatLonDocValuesBoxQuery extends Query {
       public boolean isCacheable(LeafReaderContext ctx) {
         return DocValues.isCacheable(ctx, field);
       }
-
     };
   }
-
 }
diff --git a/lucene/core/src/java/org/apache/lucene/document/LatLonDocValuesField.java b/lucene/core/src/java/org/apache/lucene/document/LatLonDocValuesField.java
index e263f78..8c80363 100644
--- a/lucene/core/src/java/org/apache/lucene/document/LatLonDocValuesField.java
+++ b/lucene/core/src/java/org/apache/lucene/document/LatLonDocValuesField.java
@@ -33,55 +33,63 @@ import org.apache.lucene.search.MatchNoDocsQuery;
 import org.apache.lucene.search.Query;
 import org.apache.lucene.search.SortField;
 
-/** 
+/**
  * An per-document location field.
- * <p>
- * Sorting by distance is efficient. Multiple values for the same field in one document
- * is allowed. 
- * <p>
- * This field defines static factory methods for common operations:
+ *
+ * <p>Sorting by distance is efficient. Multiple values for the same field in one document is
+ * allowed.
+ *
+ * <p>This field defines static factory methods for common operations:
+ *
  * <ul>
- *   <li>{@link #newDistanceSort newDistanceSort()} for ordering documents by distance from a specified location. 
+ *   <li>{@link #newDistanceSort newDistanceSort()} for ordering documents by distance from a
+ *       specified location.
  * </ul>
- * <p>
- * If you also need query operations, you should add a separate {@link LatLonPoint} instance.
- * If you also need to store the value, you should add a separate {@link StoredField} instance.
- * <p>
- * <b>WARNING</b>: Values are indexed with some loss of precision from the
- * original {@code double} values (4.190951585769653E-8 for the latitude component
- * and 8.381903171539307E-8 for longitude).
+ *
+ * <p>If you also need query operations, you should add a separate {@link LatLonPoint} instance. If
+ * you also need to store the value, you should add a separate {@link StoredField} instance.
+ *
+ * <p><b>WARNING</b>: Values are indexed with some loss of precision from the original {@code
+ * double} values (4.190951585769653E-8 for the latitude component and 8.381903171539307E-8 for
+ * longitude).
+ *
  * @see LatLonPoint
  */
 public class LatLonDocValuesField extends Field {
 
   /**
    * Type for a LatLonDocValuesField
-   * <p>
-   * Each value stores a 64-bit long where the upper 32 bits are the encoded latitude,
-   * and the lower 32 bits are the encoded longitude.
+   *
+   * <p>Each value stores a 64-bit long where the upper 32 bits are the encoded latitude, and the
+   * lower 32 bits are the encoded longitude.
+   *
    * @see org.apache.lucene.geo.GeoEncodingUtils#decodeLatitude(int)
    * @see org.apache.lucene.geo.GeoEncodingUtils#decodeLongitude(int)
    */
   public static final FieldType TYPE = new FieldType();
+
   static {
     TYPE.setDocValuesType(DocValuesType.SORTED_NUMERIC);
     TYPE.freeze();
   }
-  
-  /** 
+
+  /**
    * Creates a new LatLonDocValuesField with the specified latitude and longitude
+   *
    * @param name field name
    * @param latitude latitude value: must be within standard +/-90 coordinate bounds.
    * @param longitude longitude value: must be within standard +/-180 coordinate bounds.
-   * @throws IllegalArgumentException if the field name is null or latitude or longitude are out of bounds
+   * @throws IllegalArgumentException if the field name is null or latitude or longitude are out of
+   *     bounds
    */
   public LatLonDocValuesField(String name, double latitude, double longitude) {
     super(name, TYPE);
     setLocationValue(latitude, longitude);
   }
-  
+
   /**
    * Change the values of this field
+   *
    * @param latitude latitude value: must be within standard +/-90 coordinate bounds.
    * @param longitude longitude value: must be within standard +/-180 coordinate bounds.
    * @throws IllegalArgumentException if latitude or longitude are out of bounds
@@ -89,19 +97,28 @@ public class LatLonDocValuesField extends Field {
   public void setLocationValue(double latitude, double longitude) {
     int latitudeEncoded = encodeLatitude(latitude);
     int longitudeEncoded = encodeLongitude(longitude);
-    fieldsData = Long.valueOf((((long)latitudeEncoded) << 32) | (longitudeEncoded & 0xFFFFFFFFL));
+    fieldsData = Long.valueOf((((long) latitudeEncoded) << 32) | (longitudeEncoded & 0xFFFFFFFFL));
   }
 
-  /** helper: checks a fieldinfo and throws exception if its definitely not a LatLonDocValuesField */
+  /**
+   * helper: checks a fieldinfo and throws exception if its definitely not a LatLonDocValuesField
+   */
   static void checkCompatible(FieldInfo fieldInfo) {
-    // dv properties could be "unset", if you e.g. used only StoredField with this same name in the segment.
-    if (fieldInfo.getDocValuesType() != DocValuesType.NONE && fieldInfo.getDocValuesType() != TYPE.docValuesType()) {
-      throw new IllegalArgumentException("field=\"" + fieldInfo.name + "\" was indexed with docValuesType=" + fieldInfo.getDocValuesType() + 
-                                         " but this type has docValuesType=" + TYPE.docValuesType() + 
-                                         ", is the field really a LatLonDocValuesField?");
+    // dv properties could be "unset", if you e.g. used only StoredField with this same name in the
+    // segment.
+    if (fieldInfo.getDocValuesType() != DocValuesType.NONE
+        && fieldInfo.getDocValuesType() != TYPE.docValuesType()) {
+      throw new IllegalArgumentException(
+          "field=\""
+              + fieldInfo.name
+              + "\" was indexed with docValuesType="
+              + fieldInfo.getDocValuesType()
+              + " but this type has docValuesType="
+              + TYPE.docValuesType()
+              + ", is the field really a LatLonDocValuesField?");
     }
   }
-  
+
   @Override
   public String toString() {
     StringBuilder result = new StringBuilder();
@@ -110,10 +127,10 @@ public class LatLonDocValuesField extends Field {
     result.append(name);
     result.append(':');
 
-    long currentValue = (Long)fieldsData;
-    result.append(decodeLatitude((int)(currentValue >> 32)));
+    long currentValue = (Long) fieldsData;
+    result.append(decodeLatitude((int) (currentValue >> 32)));
     result.append(',');
-    result.append(decodeLongitude((int)(currentValue & 0xFFFFFFFF)));
+    result.append(decodeLongitude((int) (currentValue & 0xFFFFFFFF)));
 
     result.append('>');
     return result.toString();
@@ -121,15 +138,16 @@ public class LatLonDocValuesField extends Field {
 
   /**
    * Creates a SortField for sorting by distance from a location.
-   * <p>
-   * This sort orders documents by ascending distance from the location. The value returned in {@link FieldDoc} for
-   * the hits contains a Double instance with the distance in meters.
-   * <p>
-   * If a document is missing the field, then by default it is treated as having {@link Double#POSITIVE_INFINITY} distance
-   * (missing values sort last).
-   * <p>
-   * If a document contains multiple values for the field, the <i>closest</i> distance to the location is used.
-   * 
+   *
+   * <p>This sort orders documents by ascending distance from the location. The value returned in
+   * {@link FieldDoc} for the hits contains a Double instance with the distance in meters.
+   *
+   * <p>If a document is missing the field, then by default it is treated as having {@link
+   * Double#POSITIVE_INFINITY} distance (missing values sort last).
+   *
+   * <p>If a document contains multiple values for the field, the <i>closest</i> distance to the
+   * location is used.
+   *
    * @param field field name. must not be null.
    * @param latitude latitude at the center: must be within standard +/-90 coordinate bounds.
    * @param longitude longitude at the center: must be within standard +/-180 coordinate bounds.
@@ -141,15 +159,21 @@ public class LatLonDocValuesField extends Field {
   }
 
   /**
-   * Create a query for matching a bounding box using doc values.
-   * This query is usually slow as it does not use an index structure and needs
-   * to verify documents one-by-one in order to know whether they match. It is
-   * best used wrapped in an {@link IndexOrDocValuesQuery} alongside a
+   * Create a query for matching a bounding box using doc values. This query is usually slow as it
+   * does not use an index structure and needs to verify documents one-by-one in order to know
+   * whether they match. It is best used wrapped in an {@link IndexOrDocValuesQuery} alongside a
    * {@link LatLonPoint#newBoxQuery}.
    */
-  public static Query newSlowBoxQuery(String field, double minLatitude, double maxLatitude, double minLongitude, double maxLongitude) {
-    // exact double values of lat=90.0D and lon=180.0D must be treated special as they are not represented in the encoding
-    // and should not drag in extra bogus junk! TODO: should encodeCeil just throw ArithmeticException to be less trappy here?
+  public static Query newSlowBoxQuery(
+      String field,
+      double minLatitude,
+      double maxLatitude,
+      double minLongitude,
+      double maxLongitude) {
+    // exact double values of lat=90.0D and lon=180.0D must be treated special as they are not
+    // represented in the encoding
+    // and should not drag in extra bogus junk! TODO: should encodeCeil just throw
+    // ArithmeticException to be less trappy here?
     if (minLatitude == 90.0) {
       // range cannot match as 90.0 can never exist
       return new MatchNoDocsQuery("LatLonDocValuesField.newBoxQuery with minLatitude=90.0");
@@ -157,7 +181,8 @@ public class LatLonDocValuesField extends Field {
     if (minLongitude == 180.0) {
       if (maxLongitude == 180.0) {
         // range cannot match as 180.0 can never exist
-        return new MatchNoDocsQuery("LatLonDocValuesField.newBoxQuery with minLongitude=maxLongitude=180.0");
+        return new MatchNoDocsQuery(
+            "LatLonDocValuesField.newBoxQuery with minLongitude=maxLongitude=180.0");
       } else if (maxLongitude < minLongitude) {
         // encodeCeil() with dateline wrapping!
         minLongitude = -180.0;
@@ -167,48 +192,54 @@ public class LatLonDocValuesField extends Field {
   }
 
   /**
-   * Create a query for matching points within the specified distance of the supplied location.
-   * This query is usually slow as it does not use an index structure and needs
-   * to verify documents one-by-one in order to know whether they match. It is
-   * best used wrapped in an {@link IndexOrDocValuesQuery} alongside a
-   * {@link LatLonPoint#newDistanceQuery}.
+   * Create a query for matching points within the specified distance of the supplied location. This
+   * query is usually slow as it does not use an index structure and needs to verify documents
+   * one-by-one in order to know whether they match. It is best used wrapped in an {@link
+   * IndexOrDocValuesQuery} alongside a {@link LatLonPoint#newDistanceQuery}.
+   *
    * @param field field name. must not be null.
    * @param latitude latitude at the center: must be within standard +/-90 coordinate bounds.
    * @param longitude longitude at the center: must be within standard +/-180 coordinate bounds.
-   * @param radiusMeters maximum distance from the center in meters: must be non-negative and finite.
+   * @param radiusMeters maximum distance from the center in meters: must be non-negative and
+   *     finite.
    * @return query matching points within this distance
-   * @throws IllegalArgumentException if {@code field} is null, location has invalid coordinates, or radius is invalid.
+   * @throws IllegalArgumentException if {@code field} is null, location has invalid coordinates, or
+   *     radius is invalid.
    */
-  public static Query newSlowDistanceQuery(String field, double latitude, double longitude, double radiusMeters) {
+  public static Query newSlowDistanceQuery(
+      String field, double latitude, double longitude, double radiusMeters) {
     Circle circle = new Circle(latitude, longitude, radiusMeters);
     return newSlowGeometryQuery(field, circle);
   }
 
   /**
-   * Create a query for matching points within the supplied polygons.
-   * This query is usually slow as it does not use an index structure and needs
-   * to verify documents one-by-one in order to know whether they match. It is
-   * best used wrapped in an {@link IndexOrDocValuesQuery} alongside a
+   * Create a query for matching points within the supplied polygons. This query is usually slow as
+   * it does not use an index structure and needs to verify documents one-by-one in order to know
+   * whether they match. It is best used wrapped in an {@link IndexOrDocValuesQuery} alongside a
    * {@link LatLonPoint#newPolygonQuery(String, Polygon...)}.
+   *
    * @param field field name. must not be null.
    * @param polygons array of polygons. must not be null or empty.
    * @return query matching points within the given polygons.
-   * @throws IllegalArgumentException if {@code field} is null or polygons is empty or contain a null polygon.
+   * @throws IllegalArgumentException if {@code field} is null or polygons is empty or contain a
+   *     null polygon.
    */
   public static Query newSlowPolygonQuery(String field, Polygon... polygons) {
     return newSlowGeometryQuery(field, polygons);
   }
 
   /**
-   * Create a query for matching points within the supplied geometries. Line geometries are not supported.
-   * This query is usually slow as it does not use an index structure and needs
-   * to verify documents one-by-one in order to know whether they match. It is
-   * best used wrapped in an {@link IndexOrDocValuesQuery} alongside a
-   * {@link LatLonPoint#newGeometryQuery(String, LatLonGeometry...)}.
+   * Create a query for matching points within the supplied geometries. Line geometries are not
+   * supported. This query is usually slow as it does not use an index structure and needs to verify
+   * documents one-by-one in order to know whether they match. It is best used wrapped in an {@link
+   * IndexOrDocValuesQuery} alongside a {@link LatLonPoint#newGeometryQuery(String,
+   * LatLonGeometry...)}.
+   *
    * @param field field name. must not be null.
    * @param latLonGeometries array of LatLonGeometries. must not be null or empty.
    * @return query matching points within the given polygons.
-   * @throws IllegalArgumentException if {@code field} is null, {@code latLonGeometries} is null, empty or contain a null or line geometry.
+   * @throws IllegalArgumentException if {@code field} is null, {@code latLonGeometries} is null,
+   *     empty or contain a null or line geometry.
    */
   public static Query newSlowGeometryQuery(String field, LatLonGeometry... latLonGeometries) {
     if (latLonGeometries.length == 1 && latLonGeometries[0] instanceof Rectangle) {
diff --git a/lucene/core/src/java/org/apache/lucene/document/LatLonDocValuesPointInGeometryQuery.java b/lucene/core/src/java/org/apache/lucene/document/LatLonDocValuesPointInGeometryQuery.java
index 04cb612..5bb1550 100644
--- a/lucene/core/src/java/org/apache/lucene/document/LatLonDocValuesPointInGeometryQuery.java
+++ b/lucene/core/src/java/org/apache/lucene/document/LatLonDocValuesPointInGeometryQuery.java
@@ -17,6 +17,8 @@
 
 package org.apache.lucene.document;
 
+import java.io.IOException;
+import java.util.Arrays;
 import org.apache.lucene.geo.Component2D;
 import org.apache.lucene.geo.GeoEncodingUtils;
 import org.apache.lucene.geo.LatLonGeometry;
@@ -34,16 +36,12 @@ import org.apache.lucene.search.Scorer;
 import org.apache.lucene.search.TwoPhaseIterator;
 import org.apache.lucene.search.Weight;
 
-import java.io.IOException;
-import java.util.Arrays;
-
 /** Geometry query for {@link LatLonDocValuesField}. */
 public class LatLonDocValuesPointInGeometryQuery extends Query {
 
   private final String field;
   private final LatLonGeometry[] geometries;
 
-
   LatLonDocValuesPointInGeometryQuery(String field, LatLonGeometry... geometries) {
     if (field == null) {
       throw new IllegalArgumentException("field must not be null");
@@ -59,7 +57,8 @@ public class LatLonDocValuesPointInGeometryQuery extends Query {
         throw new IllegalArgumentException("geometries[" + i + "] must not be null");
       }
       if (geometries[i] instanceof Line) {
-        throw new IllegalArgumentException("LatLonDocValuesPointInGeometryQuery does not support queries with line geometries");
+        throw new IllegalArgumentException(
+            "LatLonDocValuesPointInGeometryQuery does not support queries with line geometries");
       }
     }
     this.field = field;
@@ -83,8 +82,7 @@ public class LatLonDocValuesPointInGeometryQuery extends Query {
       return false;
     }
     LatLonDocValuesPointInGeometryQuery other = (LatLonDocValuesPointInGeometryQuery) obj;
-    return field.equals(other.field) &&
-           Arrays.equals(geometries, other.geometries);
+    return field.equals(other.field) && Arrays.equals(geometries, other.geometries);
   }
 
   @Override
@@ -103,7 +101,8 @@ public class LatLonDocValuesPointInGeometryQuery extends Query {
   }
 
   @Override
-  public Weight createWeight(IndexSearcher searcher, ScoreMode scoreMode, float boost) throws IOException {
+  public Weight createWeight(IndexSearcher searcher, ScoreMode scoreMode, float boost)
+      throws IOException {
     final Component2D tree = LatLonGeometry.create(geometries);
 
     if (tree.getMinY() > tree.getMaxY()) {
@@ -122,10 +121,11 @@ public class LatLonDocValuesPointInGeometryQuery extends Query {
       };
     }
 
-    final GeoEncodingUtils.Component2DPredicate component2DPredicate = GeoEncodingUtils.createComponentPredicate(tree);
-    
+    final GeoEncodingUtils.Component2DPredicate component2DPredicate =
+        GeoEncodingUtils.createComponentPredicate(tree);
+
     return new ConstantScoreWeight(this, boost) {
-      
+
       @Override
       public Scorer scorer(LeafReaderContext context) throws IOException {
         final SortedNumericDocValues values = context.reader().getSortedNumericDocValues(field);
@@ -133,26 +133,27 @@ public class LatLonDocValuesPointInGeometryQuery extends Query {
           return null;
         }
 
-        final TwoPhaseIterator iterator = new TwoPhaseIterator(values) {
+        final TwoPhaseIterator iterator =
+            new TwoPhaseIterator(values) {
+
+              @Override
+              public boolean matches() throws IOException {
+                for (int i = 0, count = values.docValueCount(); i < count; ++i) {
+                  final long value = values.nextValue();
+                  final int lat = (int) (value >>> 32);
+                  final int lon = (int) (value & 0xFFFFFFFF);
+                  if (component2DPredicate.test(lat, lon)) {
+                    return true;
+                  }
+                }
+                return false;
+              }
 
-          @Override
-          public boolean matches() throws IOException {
-            for (int i = 0, count = values.docValueCount(); i < count; ++i) {
-              final long value = values.nextValue();
-              final int lat = (int) (value >>> 32);
-              final int lon = (int) (value & 0xFFFFFFFF);
-              if (component2DPredicate.test(lat, lon)) {
-                return true;
+              @Override
+              public float matchCost() {
+                return 1000f; // TODO: what should it be?
               }
-            }
-            return false;
-          }
-
-          @Override
-          public float matchCost() {
-            return 1000f; // TODO: what should it be?
-          }
-        };
+            };
         return new ConstantScoreScorer(this, boost, scoreMode, iterator);
       }
 
@@ -160,7 +161,6 @@ public class LatLonDocValuesPointInGeometryQuery extends Query {
       public boolean isCacheable(LeafReaderContext ctx) {
         return DocValues.isCacheable(ctx, field);
       }
-
     };
   }
 }
diff --git a/lucene/core/src/java/org/apache/lucene/document/LatLonPoint.java b/lucene/core/src/java/org/apache/lucene/document/LatLonPoint.java
index 7dfb5a0..06de3cf 100644
--- a/lucene/core/src/java/org/apache/lucene/document/LatLonPoint.java
+++ b/lucene/core/src/java/org/apache/lucene/document/LatLonPoint.java
@@ -16,6 +16,13 @@
  */
 package org.apache.lucene.document;
 
+import static org.apache.lucene.geo.GeoEncodingUtils.decodeLatitude;
+import static org.apache.lucene.geo.GeoEncodingUtils.decodeLongitude;
+import static org.apache.lucene.geo.GeoEncodingUtils.encodeLatitude;
+import static org.apache.lucene.geo.GeoEncodingUtils.encodeLatitudeCeil;
+import static org.apache.lucene.geo.GeoEncodingUtils.encodeLongitude;
+import static org.apache.lucene.geo.GeoEncodingUtils.encodeLongitudeCeil;
+
 import org.apache.lucene.geo.Circle;
 import org.apache.lucene.geo.LatLonGeometry;
 import org.apache.lucene.geo.Polygon;
@@ -23,8 +30,8 @@ import org.apache.lucene.geo.Rectangle;
 import org.apache.lucene.index.FieldInfo;
 import org.apache.lucene.index.PointValues;
 import org.apache.lucene.search.BooleanClause;
-import org.apache.lucene.search.BooleanQuery;
 import org.apache.lucene.search.BooleanClause.Occur;
+import org.apache.lucene.search.BooleanQuery;
 import org.apache.lucene.search.BoostQuery;
 import org.apache.lucene.search.ConstantScoreQuery;
 import org.apache.lucene.search.MatchNoDocsQuery;
@@ -33,56 +40,58 @@ import org.apache.lucene.search.Query;
 import org.apache.lucene.util.BytesRef;
 import org.apache.lucene.util.NumericUtils;
 
-import static org.apache.lucene.geo.GeoEncodingUtils.decodeLatitude;
-import static org.apache.lucene.geo.GeoEncodingUtils.decodeLongitude;
-import static org.apache.lucene.geo.GeoEncodingUtils.encodeLatitude;
-import static org.apache.lucene.geo.GeoEncodingUtils.encodeLatitudeCeil;
-import static org.apache.lucene.geo.GeoEncodingUtils.encodeLongitude;
-import static org.apache.lucene.geo.GeoEncodingUtils.encodeLongitudeCeil;
-
-/** 
+/**
  * An indexed location field.
- * <p>
- * Finding all documents within a range at search time is
- * efficient.  Multiple values for the same field in one document
- * is allowed. 
- * <p>
- * This field defines static factory methods for common operations:
+ *
+ * <p>Finding all documents within a range at search time is efficient. Multiple values for the same
+ * field in one document is allowed.
+ *
+ * <p>This field defines static factory methods for common operations:
+ *
  * <ul>
  *   <li>{@link #newBoxQuery newBoxQuery()} for matching points within a bounding box.
- *   <li>{@link #newDistanceQuery newDistanceQuery()} for matching points within a specified distance.
+ *   <li>{@link #newDistanceQuery newDistanceQuery()} for matching points within a specified
+ *       distance.
  *   <li>{@link #newPolygonQuery newPolygonQuery()} for matching points within an arbitrary polygon.
- *   <li>{@link #newGeometryQuery newGeometryQuery()} for matching points within an arbitrary geometry collection.
+ *   <li>{@link #newGeometryQuery newGeometryQuery()} for matching points within an arbitrary
+ *       geometry collection.
  * </ul>
- * <p>
- * If you also need per-document operations such as sort by distance, add a separate {@link LatLonDocValuesField} instance.
- * If you also need to store the value, you should add a separate {@link StoredField} instance.
- * <p>
- * <b>WARNING</b>: Values are indexed with some loss of precision from the
- * original {@code double} values (4.190951585769653E-8 for the latitude component
- * and 8.381903171539307E-8 for longitude).
+ *
+ * <p>If you also need per-document operations such as sort by distance, add a separate {@link
+ * LatLonDocValuesField} instance. If you also need to store the value, you should add a separate
+ * {@link StoredField} instance.
+ *
+ * <p><b>WARNING</b>: Values are indexed with some loss of precision from the original {@code
+ * double} values (4.190951585769653E-8 for the latitude component and 8.381903171539307E-8 for
+ * longitude).
+ *
  * @see PointValues
  * @see LatLonDocValuesField
  */
-// TODO ^^^ that is very sandy and hurts the API, usage, and tests tremendously, because what the user passes
-// to the field is not actually what gets indexed. Float would be 1E-5 error vs 1E-7, but it might be
-// a better tradeoff? then it would be completely transparent to the user and lucene would be "lossless".
+// TODO ^^^ that is very sandy and hurts the API, usage, and tests tremendously, because what the
+// user passes
+// to the field is not actually what gets indexed. Float would be 1E-5 error vs 1E-7, but it might
+// be
+// a better tradeoff? then it would be completely transparent to the user and lucene would be
+// "lossless".
 public class LatLonPoint extends Field {
   /** LatLonPoint is encoded as integer values so number of bytes is 4 */
   public static final int BYTES = Integer.BYTES;
   /**
    * Type for an indexed LatLonPoint
-   * <p>
-   * Each point stores two dimensions with 4 bytes per dimension.
+   *
+   * <p>Each point stores two dimensions with 4 bytes per dimension.
    */
   public static final FieldType TYPE = new FieldType();
+
   static {
     TYPE.setDimensions(2, Integer.BYTES);
     TYPE.freeze();
   }
-  
+
   /**
    * Change the values of this field
+   *
    * @param latitude latitude value: must be within standard +/-90 coordinate bounds.
    * @param longitude longitude value: must be within standard +/-180 coordinate bounds.
    * @throws IllegalArgumentException if latitude or longitude are out of bounds
@@ -103,12 +112,14 @@ public class LatLonPoint extends Field {
     NumericUtils.intToSortableBytes(longitudeEncoded, bytes, Integer.BYTES);
   }
 
-  /** 
+  /**
    * Creates a new LatLonPoint with the specified latitude and longitude
+   *
    * @param name field name
    * @param latitude latitude value: must be within standard +/-90 coordinate bounds.
    * @param longitude longitude value: must be within standard +/-180 coordinate bounds.
-   * @throws IllegalArgumentException if the field name is null or latitude or longitude are out of bounds
+   * @throws IllegalArgumentException if the field name is null or latitude or longitude are out of
+   *     bounds
    */
   public LatLonPoint(String name, double latitude, double longitude) {
     super(name, TYPE);
@@ -131,7 +142,7 @@ public class LatLonPoint extends Field {
     result.append('>');
     return result.toString();
   }
-  
+
   /** sugar encodes a single point as a byte array */
   private static byte[] encode(double latitude, double longitude) {
     byte[] bytes = new byte[2 * Integer.BYTES];
@@ -139,7 +150,7 @@ public class LatLonPoint extends Field {
     NumericUtils.intToSortableBytes(encodeLongitude(longitude), bytes, Integer.BYTES);
     return bytes;
   }
-  
+
   /** sugar encodes a single point as a byte array, rounding values up */
   private static byte[] encodeCeil(double latitude, double longitude) {
     byte[] bytes = new byte[2 * Integer.BYTES];
@@ -150,16 +161,28 @@ public class LatLonPoint extends Field {
 
   /** helper: checks a fieldinfo and throws exception if its definitely not a LatLonPoint */
   static void checkCompatible(FieldInfo fieldInfo) {
-    // point/dv properties could be "unset", if you e.g. used only StoredField with this same name in the segment.
-    if (fieldInfo.getPointDimensionCount() != 0 && fieldInfo.getPointDimensionCount() != TYPE.pointDimensionCount()) {
-      throw new IllegalArgumentException("field=\"" + fieldInfo.name + "\" was indexed with numDims=" + fieldInfo.getPointDimensionCount() +
-          " but this point type has numDims=" + TYPE.pointDimensionCount() +
-                                         ", is the field really a LatLonPoint?");
+    // point/dv properties could be "unset", if you e.g. used only StoredField with this same name
+    // in the segment.
+    if (fieldInfo.getPointDimensionCount() != 0
+        && fieldInfo.getPointDimensionCount() != TYPE.pointDimensionCount()) {
+      throw new IllegalArgumentException(
+          "field=\""
+              + fieldInfo.name
+              + "\" was indexed with numDims="
+              + fieldInfo.getPointDimensionCount()
+              + " but this point type has numDims="
+              + TYPE.pointDimensionCount()
+              + ", is the field really a LatLonPoint?");
     }
     if (fieldInfo.getPointNumBytes() != 0 && fieldInfo.getPointNumBytes() != TYPE.pointNumBytes()) {
-      throw new IllegalArgumentException("field=\"" + fieldInfo.name + "\" was indexed with bytesPerDim=" + fieldInfo.getPointNumBytes() + 
-                                         " but this point type has bytesPerDim=" + TYPE.pointNumBytes() + 
-                                         ", is the field really a LatLonPoint?");
+      throw new IllegalArgumentException(
+          "field=\""
+              + fieldInfo.name
+              + "\" was indexed with bytesPerDim="
+              + fieldInfo.getPointNumBytes()
+              + " but this point type has bytesPerDim="
+              + TYPE.pointNumBytes()
+              + ", is the field really a LatLonPoint?");
     }
   }
 
@@ -167,8 +190,9 @@ public class LatLonPoint extends Field {
 
   /**
    * Create a query for matching a bounding box.
-   * <p>
-   * The box may cross over the dateline.
+   *
+   * <p>The box may cross over the dateline.
+   *
    * @param field field name. must not be null.
    * @param minLatitude latitude lower bound: must be within standard +/-90 coordinate bounds.
    * @param maxLatitude latitude upper bound: must be within standard +/-90 coordinate bounds.
@@ -177,9 +201,16 @@ public class LatLonPoint extends Field {
    * @return query matching points within this box
    * @throws IllegalArgumentException if {@code field} is null, or the box has invalid coordinates.
    */
-  public static Query newBoxQuery(String field, double minLatitude, double maxLatitude, double minLongitude, double maxLongitude) {
-    // exact double values of lat=90.0D and lon=180.0D must be treated special as they are not represented in the encoding
-    // and should not drag in extra bogus junk! TODO: should encodeCeil just throw ArithmeticException to be less trappy here?
+  public static Query newBoxQuery(
+      String field,
+      double minLatitude,
+      double maxLatitude,
+      double minLongitude,
+      double maxLongitude) {
+    // exact double values of lat=90.0D and lon=180.0D must be treated special as they are not
+    // represented in the encoding
+    // and should not drag in extra bogus junk! TODO: should encodeCeil just throw
+    // ArithmeticException to be less trappy here?
     if (minLatitude == 90.0) {
       // range cannot match as 90.0 can never exist
       return new MatchNoDocsQuery("LatLonPoint.newBoxQuery with minLatitude=90.0");
@@ -197,7 +228,8 @@ public class LatLonPoint extends Field {
     byte[] upper = encode(maxLatitude, maxLongitude);
     // Crosses date line: we just rewrite into OR of two bboxes, with longitude as an open range:
     if (maxLongitude < minLongitude) {
-      // Disable coord here because a multi-valued doc could match both rects and get unfairly boosted:
+      // Disable coord here because a multi-valued doc could match both rects and get unfairly
+      // boosted:
       BooleanQuery.Builder q = new BooleanQuery.Builder();
 
       // E.g.: maxLon = -179, minLon = 179
@@ -217,7 +249,7 @@ public class LatLonPoint extends Field {
       return newBoxInternal(field, lower, upper);
     }
   }
-  
+
   private static Query newBoxInternal(String field, byte[] min, byte[] max) {
     return new PointRangeQuery(field, min, max, 2) {
       @Override
@@ -232,22 +264,27 @@ public class LatLonPoint extends Field {
       }
     };
   }
-  
+
   /**
    * Create a query for matching points within the specified distance of the supplied location.
+   *
    * @param field field name. must not be null.
    * @param latitude latitude at the center: must be within standard +/-90 coordinate bounds.
    * @param longitude longitude at the center: must be within standard +/-180 coordinate bounds.
-   * @param radiusMeters maximum distance from the center in meters: must be non-negative and finite.
+   * @param radiusMeters maximum distance from the center in meters: must be non-negative and
+   *     finite.
    * @return query matching points within this distance
-   * @throws IllegalArgumentException if {@code field} is null, location has invalid coordinates, or radius is invalid.
+   * @throws IllegalArgumentException if {@code field} is null, location has invalid coordinates, or
+   *     radius is invalid.
    */
-  public static Query newDistanceQuery(String field, double latitude, double longitude, double radiusMeters) {
+  public static Query newDistanceQuery(
+      String field, double latitude, double longitude, double radiusMeters) {
     return new LatLonPointDistanceQuery(field, latitude, longitude, radiusMeters);
   }
-  
-  /** 
+
+  /**
    * Create a query for matching one or more polygons.
+   *
    * @param field field name. must not be null.
    * @param polygons array of polygons. must not be null or empty
    * @return query matching points within this polygon
@@ -260,10 +297,12 @@ public class LatLonPoint extends Field {
 
   /**
    * Create a query for matching one or more geometries. Line geometries are not supported.
+   *
    * @param field field name. must not be null.
    * @param latLonGeometries array of LatLonGeometries. must not be null or empty.
    * @return query matching points within at least one geometry.
-   * @throws IllegalArgumentException  if {@code field} is null, {@code latLonGeometries} is null, empty or contain a null or line geometry.
+   * @throws IllegalArgumentException if {@code field} is null, {@code latLonGeometries} is null,
+   *     empty or contain a null or line geometry.
    * @see LatLonGeometry
    */
   public static Query newGeometryQuery(String field, LatLonGeometry... latLonGeometries) {
@@ -281,25 +320,24 @@ public class LatLonPoint extends Field {
   }
 
   /**
-   * Given a field that indexes point values into a {@link LatLonPoint}
-   * and doc values into {@link LatLonDocValuesField}, this returns a query that scores
-   * documents based on their haversine distance in meters to {@code (originLat, originLon)}:
-   * {@code score = weight * pivotDistanceMeters / (pivotDistanceMeters + distance)}, ie.
-   * score is in the {@code [0, weight]} range, is equal to {@code weight} when
-   * the document's value is equal to {@code (originLat, originLon)} and is equal to
-   * {@code weight/2}  when the document's value is distant of
-   * {@code pivotDistanceMeters} from {@code (originLat, originLon)}.
-   * In case of multi-valued fields, only the closest point to {@code (originLat, originLon)}
-   * will be considered.
-   * This query is typically useful to boost results based on distance by adding
-   * this query to a {@link Occur#SHOULD} clause of a {@link BooleanQuery}.
+   * Given a field that indexes point values into a {@link LatLonPoint} and doc values into {@link
+   * LatLonDocValuesField}, this returns a query that scores documents based on their haversine
+   * distance in meters to {@code (originLat, originLon)}: {@code score = weight *
+   * pivotDistanceMeters / (pivotDistanceMeters + distance)}, ie. score is in the {@code [0,
+   * weight]} range, is equal to {@code weight} when the document's value is equal to {@code
+   * (originLat, originLon)} and is equal to {@code weight/2} when the document's value is distant
+   * of {@code pivotDistanceMeters} from {@code (originLat, originLon)}. In case of multi-valued
+   * fields, only the closest point to {@code (originLat, originLon)} will be considered. This query
+   * is typically useful to boost results based on distance by adding this query to a {@link
+   * Occur#SHOULD} clause of a {@link BooleanQuery}.
    */
-  public static Query newDistanceFeatureQuery(String field, float weight, double originLat, double originLon, double pivotDistanceMeters) {
-    Query query = new LatLonPointDistanceFeatureQuery(field, originLat, originLon, pivotDistanceMeters);
+  public static Query newDistanceFeatureQuery(
+      String field, float weight, double originLat, double originLon, double pivotDistanceMeters) {
+    Query query =
+        new LatLonPointDistanceFeatureQuery(field, originLat, originLon, pivotDistanceMeters);
     if (weight != 1f) {
       query = new BoostQuery(query, weight);
     }
     return query;
   }
-
 }
diff --git a/lucene/core/src/java/org/apache/lucene/document/LatLonPointDistanceComparator.java b/lucene/core/src/java/org/apache/lucene/document/LatLonPointDistanceComparator.java
index 10566b6..ef11ef5 100644
--- a/lucene/core/src/java/org/apache/lucene/document/LatLonPointDistanceComparator.java
+++ b/lucene/core/src/java/org/apache/lucene/document/LatLonPointDistanceComparator.java
@@ -16,8 +16,12 @@
  */
 package org.apache.lucene.document;
 
-import java.io.IOException;
+import static org.apache.lucene.geo.GeoEncodingUtils.decodeLatitude;
+import static org.apache.lucene.geo.GeoEncodingUtils.decodeLongitude;
+import static org.apache.lucene.geo.GeoEncodingUtils.encodeLatitude;
+import static org.apache.lucene.geo.GeoEncodingUtils.encodeLongitude;
 
+import java.io.IOException;
 import org.apache.lucene.geo.Rectangle;
 import org.apache.lucene.index.DocValues;
 import org.apache.lucene.index.FieldInfo;
@@ -30,16 +34,11 @@ import org.apache.lucene.search.Scorable;
 import org.apache.lucene.util.ArrayUtil;
 import org.apache.lucene.util.SloppyMath;
 
-import static org.apache.lucene.geo.GeoEncodingUtils.decodeLatitude;
-import static org.apache.lucene.geo.GeoEncodingUtils.decodeLongitude;
-import static org.apache.lucene.geo.GeoEncodingUtils.encodeLatitude;
-import static org.apache.lucene.geo.GeoEncodingUtils.encodeLongitude;
-
 /**
  * Compares documents by distance from an origin point
- * <p>
- * When the least competitive item on the priority queue changes (setBottom), we recompute
- * a bounding box representing competitive distance to the top-N. Then in compareBottom, we can
+ *
+ * <p>When the least competitive item on the priority queue changes (setBottom), we recompute a
+ * bounding box representing competitive distance to the top-N. Then in compareBottom, we can
  * quickly reject hits based on bounding box alone without computing distance for every element.
  */
 class LatLonPointDistanceComparator extends FieldComparator<Double> implements LeafFieldComparator {
@@ -51,9 +50,9 @@ class LatLonPointDistanceComparator extends FieldComparator<Double> implements L
   double bottom;
   double topValue;
   SortedNumericDocValues currentDocs;
-  
+
   // current bounding box(es) for the bottom distance on the PQ.
-  // these are pre-encoded with LatLonPoint's encoding and 
+  // these are pre-encoded with LatLonPoint's encoding and
   // used to exclude uncompetitive hits faster.
   int minLon = Integer.MIN_VALUE;
   int maxLon = Integer.MAX_VALUE;
@@ -69,13 +68,14 @@ class LatLonPointDistanceComparator extends FieldComparator<Double> implements L
   private long[] currentValues = new long[4];
   private int valuesDocID = -1;
 
-  public LatLonPointDistanceComparator(String field, double latitude, double longitude, int numHits) {
+  public LatLonPointDistanceComparator(
+      String field, double latitude, double longitude, int numHits) {
     this.field = field;
     this.latitude = latitude;
     this.longitude = longitude;
     this.values = new double[numHits];
   }
-  
+
   @Override
   public void setScorer(Scorable scorer) {}
 
@@ -83,7 +83,7 @@ class LatLonPointDistanceComparator extends FieldComparator<Double> implements L
   public int compare(int slot1, int slot2) {
     return Double.compare(values[slot1], values[slot2]);
   }
-  
+
   @Override
   public void setBottom(int slot) {
     bottom = values[slot];
@@ -92,7 +92,7 @@ class LatLonPointDistanceComparator extends FieldComparator<Double> implements L
     // boxes if comparator hits a worst case order (e.g. backwards distance order)
     if (setBottomCounter < 1024 || (setBottomCounter & 0x3F) == 0x3F) {
       Rectangle box = Rectangle.fromPointDistance(latitude, longitude, haversin2(bottom));
-      // pre-encode our box to our integer encoding, so we don't have to decode 
+      // pre-encode our box to our integer encoding, so we don't have to decode
       // to double values for uncompetitive hits. This has some cost!
       minLat = encodeLatitude(box.minLat);
       maxLat = encodeLatitude(box.maxLat);
@@ -111,7 +111,7 @@ class LatLonPointDistanceComparator extends FieldComparator<Double> implements L
     }
     setBottomCounter++;
   }
-  
+
   @Override
   public void setTopValue(Double value) {
     topValue = value.doubleValue();
@@ -119,18 +119,19 @@ class LatLonPointDistanceComparator extends FieldComparator<Double> implements L
 
   private void setValues() throws IOException {
     if (valuesDocID != currentDocs.docID()) {
-      assert valuesDocID < currentDocs.docID(): " valuesDocID=" + valuesDocID + " vs " + currentDocs.docID();
+      assert valuesDocID < currentDocs.docID()
+          : " valuesDocID=" + valuesDocID + " vs " + currentDocs.docID();
       valuesDocID = currentDocs.docID();
       int count = currentDocs.docValueCount();
       if (count > currentValues.length) {
         currentValues = new long[ArrayUtil.oversize(count, Long.BYTES)];
       }
-      for(int i=0;i<count;i++) {
+      for (int i = 0; i < count; i++) {
         currentValues[i] = currentDocs.nextValue();
       }
     }
   }
-  
+
   @Override
   public int compareBottom(int doc) throws IOException {
     if (doc > currentDocs.docID()) {
@@ -149,11 +150,11 @@ class LatLonPointDistanceComparator extends FieldComparator<Double> implements L
       long encoded = currentValues[i];
 
       // test bounding box
-      int latitudeBits = (int)(encoded >> 32);
+      int latitudeBits = (int) (encoded >> 32);
       if (latitudeBits < minLat || latitudeBits > maxLat) {
         continue;
       }
-      int longitudeBits = (int)(encoded & 0xFFFFFFFF);
+      int longitudeBits = (int) (encoded & 0xFFFFFFFF);
       if ((longitudeBits < minLon || longitudeBits > maxLon) && (longitudeBits < minLon2)) {
         continue;
       }
@@ -161,7 +162,12 @@ class LatLonPointDistanceComparator extends FieldComparator<Double> implements L
       // only compute actual distance if its inside "competitive bounding box"
       double docLatitude = decodeLatitude(latitudeBits);
       double docLongitude = decodeLongitude(longitudeBits);
-      cmp = Math.max(cmp, Double.compare(bottom, SloppyMath.haversinSortKey(latitude, longitude, docLatitude, docLongitude)));
+      cmp =
+          Math.max(
+              cmp,
+              Double.compare(
+                  bottom,
+                  SloppyMath.haversinSortKey(latitude, longitude, docLatitude, docLongitude)));
       // once we compete in the PQ, no need to continue.
       if (cmp > 0) {
         return cmp;
@@ -169,12 +175,12 @@ class LatLonPointDistanceComparator extends FieldComparator<Double> implements L
     }
     return cmp;
   }
-  
+
   @Override
   public void copy(int slot, int doc) throws IOException {
     values[slot] = sortKey(doc);
   }
-  
+
   @Override
   public LeafFieldComparator getLeafComparator(LeafReaderContext context) throws IOException {
     LeafReader reader = context.reader();
@@ -186,17 +192,17 @@ class LatLonPointDistanceComparator extends FieldComparator<Double> implements L
     valuesDocID = -1;
     return this;
   }
-  
+
   @Override
   public Double value(int slot) {
     return Double.valueOf(haversin2(values[slot]));
   }
-  
+
   @Override
   public int compareTop(int doc) throws IOException {
     return Double.compare(topValue, haversin2(sortKey(doc)));
   }
-  
+
   // TODO: optimize for single-valued case?
   // TODO: do all kinds of other optimizations!
   double sortKey(int doc) throws IOException {
@@ -209,15 +215,19 @@ class LatLonPointDistanceComparator extends FieldComparator<Double> implements L
       int numValues = currentDocs.docValueCount();
       for (int i = 0; i < numValues; i++) {
         long encoded = currentValues[i];
-        double docLatitude = decodeLatitude((int)(encoded >> 32));
-        double docLongitude = decodeLongitude((int)(encoded & 0xFFFFFFFF));
-        minValue = Math.min(minValue, SloppyMath.haversinSortKey(latitude, longitude, docLatitude, docLongitude));
+        double docLatitude = decodeLatitude((int) (encoded >> 32));
+        double docLongitude = decodeLongitude((int) (encoded & 0xFFFFFFFF));
+        minValue =
+            Math.min(
+                minValue,
+                SloppyMath.haversinSortKey(latitude, longitude, docLatitude, docLongitude));
       }
     }
     return minValue;
   }
 
-  // second half of the haversin calculation, used to convert results from haversin1 (used internally
+  // second half of the haversin calculation, used to convert results from haversin1 (used
+  // internally
   // for sorting) for display purposes.
   static double haversin2(double partial) {
     if (Double.isInfinite(partial)) {
diff --git a/lucene/core/src/java/org/apache/lucene/document/LatLonPointDistanceFeatureQuery.java b/lucene/core/src/java/org/apache/lucene/document/LatLonPointDistanceFeatureQuery.java
index 846b353..5cf75e2 100644
--- a/lucene/core/src/java/org/apache/lucene/document/LatLonPointDistanceFeatureQuery.java
+++ b/lucene/core/src/java/org/apache/lucene/document/LatLonPointDistanceFeatureQuery.java
@@ -19,7 +19,6 @@ package org.apache.lucene.document;
 import java.io.IOException;
 import java.util.Arrays;
 import java.util.Objects;
-
 import org.apache.lucene.geo.GeoEncodingUtils;
 import org.apache.lucene.geo.GeoUtils;
 import org.apache.lucene.geo.Rectangle;
@@ -43,7 +42,6 @@ import org.apache.lucene.util.DocIdSetBuilder;
 import org.apache.lucene.util.NumericUtils;
 import org.apache.lucene.util.SloppyMath;
 
-
 final class LatLonPointDistanceFeatureQuery extends Query {
 
   private final String field;
@@ -51,7 +49,8 @@ final class LatLonPointDistanceFeatureQuery extends Query {
   private final double originLon;
   private final double pivotDistance;
 
-  LatLonPointDistanceFeatureQuery(String field, double originLat, double originLon, double pivotDistance) {
+  LatLonPointDistanceFeatureQuery(
+      String field, double originLat, double originLon, double pivotDistance) {
     this.field = Objects.requireNonNull(field);
     GeoUtils.checkLatitude(originLat);
     GeoUtils.checkLongitude(originLon);
@@ -72,15 +71,14 @@ final class LatLonPointDistanceFeatureQuery extends Query {
 
   @Override
   public final boolean equals(Object o) {
-    return sameClassAs(o) &&
-        equalsTo(getClass().cast(o));
+    return sameClassAs(o) && equalsTo(getClass().cast(o));
   }
 
   private boolean equalsTo(LatLonPointDistanceFeatureQuery other) {
-    return Objects.equals(field, other.field) &&
-        originLon == other.originLon &&
-        originLat == other.originLat &&
-        pivotDistance == other.pivotDistance;
+    return Objects.equals(field, other.field)
+        && originLon == other.originLon
+        && originLat == other.originLat
+        && pivotDistance == other.pivotDistance;
   }
 
   @Override
@@ -95,11 +93,21 @@ final class LatLonPointDistanceFeatureQuery extends Query {
 
   @Override
   public String toString(String field) {
-    return getClass().getSimpleName() + "(field=" + field + ",originLat=" + originLat + ",originLon=" + originLon + ",pivotDistance=" + pivotDistance + ")";
+    return getClass().getSimpleName()
+        + "(field="
+        + field
+        + ",originLat="
+        + originLat
+        + ",originLon="
+        + originLon
+        + ",pivotDistance="
+        + pivotDistance
+        + ")";
   }
 
   @Override
-  public Weight createWeight(IndexSearcher searcher, ScoreMode scoreMode, float boost) throws IOException {
+  public Weight createWeight(IndexSearcher searcher, ScoreMode scoreMode, float boost)
+      throws IOException {
     return new Weight(this) {
 
       @Override
@@ -111,16 +119,19 @@ final class LatLonPointDistanceFeatureQuery extends Query {
       public Explanation explain(LeafReaderContext context, int doc) throws IOException {
         SortedNumericDocValues multiDocValues = DocValues.getSortedNumeric(context.reader(), field);
         if (multiDocValues.advanceExact(doc) == false) {
-          return Explanation.noMatch("Document " + doc + " doesn't have a value for field " + field);
+          return Explanation.noMatch(
+              "Document " + doc + " doesn't have a value for field " + field);
         }
         long encoded = selectValue(multiDocValues);
-        int latitudeBits = (int)(encoded >> 32);
-        int longitudeBits = (int)(encoded & 0xFFFFFFFF);
+        int latitudeBits = (int) (encoded >> 32);
+        int longitudeBits = (int) (encoded & 0xFFFFFFFF);
         double lat = GeoEncodingUtils.decodeLatitude(latitudeBits);
         double lon = GeoEncodingUtils.decodeLongitude(longitudeBits);
         double distance = SloppyMath.haversinMeters(originLat, originLon, lat, lon);
         float score = (float) (boost * (pivotDistance / (pivotDistance + distance)));
-        return Explanation.match(score, "Distance score, computed as weight * pivotDistance / (pivotDistance + abs(distance)) from:",
+        return Explanation.match(
+            score,
+            "Distance score, computed as weight * pivotDistance / (pivotDistance + abs(distance)) from:",
             Explanation.match(boost, "weight"),
             Explanation.match(pivotDistance, "pivotDistance"),
             Explanation.match(originLat, "originLat"),
@@ -154,7 +165,7 @@ final class LatLonPointDistanceFeatureQuery extends Query {
         if (singleton != null) {
           return singleton;
         }
-        return  new NumericDocValues() {
+        return new NumericDocValues() {
 
           long value;
 
@@ -192,7 +203,6 @@ final class LatLonPointDistanceFeatureQuery extends Query {
           public long cost() {
             return multiDocValues.cost();
           }
-
         };
       }
 
@@ -203,7 +213,8 @@ final class LatLonPointDistanceFeatureQuery extends Query {
           // No data on this segment
           return null;
         }
-        final SortedNumericDocValues multiDocValues = DocValues.getSortedNumeric(context.reader(), field);
+        final SortedNumericDocValues multiDocValues =
+            DocValues.getSortedNumeric(context.reader(), field);
         final NumericDocValues docValues = selectValues(multiDocValues);
 
         final Weight weight = this;
@@ -211,7 +222,8 @@ final class LatLonPointDistanceFeatureQuery extends Query {
 
           @Override
           public Scorer get(long leadCost) throws IOException {
-            return new DistanceScorer(weight, context.reader().maxDoc(), leadCost, boost, pointValues, docValues);
+            return new DistanceScorer(
+                weight, context.reader().maxDoc(), leadCost, boost, pointValues, docValues);
           }
 
           @Override
@@ -229,7 +241,6 @@ final class LatLonPointDistanceFeatureQuery extends Query {
         }
         return scorerSupplier.get(Long.MAX_VALUE);
       }
-
     };
   }
 
@@ -238,8 +249,8 @@ final class LatLonPointDistanceFeatureQuery extends Query {
   }
 
   private double getDistanceKeyFromEncoded(long encoded) {
-    int latitudeBits = (int)(encoded >> 32);
-    int longitudeBits = (int)(encoded & 0xFFFFFFFF);
+    int latitudeBits = (int) (encoded >> 32);
+    int longitudeBits = (int) (encoded & 0xFFFFFFFF);
     double lat = GeoEncodingUtils.decodeLatitude(latitudeBits);
     double lon = GeoEncodingUtils.decodeLongitude(longitudeBits);
     return SloppyMath.haversinSortKey(originLat, originLon, lat, lon);
@@ -256,8 +267,13 @@ final class LatLonPointDistanceFeatureQuery extends Query {
     private final NumericDocValues docValues;
     private double maxDistance = GeoUtils.EARTH_MEAN_RADIUS_METERS * Math.PI;
 
-    protected DistanceScorer(Weight weight, int maxDoc, long leadCost, float boost,
-        PointValues pointValues, NumericDocValues docValues) {
+    protected DistanceScorer(
+        Weight weight,
+        int maxDoc,
+        long leadCost,
+        float boost,
+        PointValues pointValues,
+        NumericDocValues docValues) {
       super(weight);
       this.maxDoc = maxDoc;
       this.leadCost = leadCost;
@@ -279,9 +295,8 @@ final class LatLonPointDistanceFeatureQuery extends Query {
     }
 
     /**
-     * Inverting the score computation is very hard due to all potential
-     * rounding errors, so we binary search the maximum distance. The limit
-     * is set to 1 meter.
+     * Inverting the score computation is very hard due to all potential rounding errors, so we
+     * binary search the maximum distance. The limit is set to 1 meter.
      */
     private double computeMaxDistance(float minScore, double previousMaxDistance) {
       assert score(0) >= minScore;
@@ -337,7 +352,7 @@ final class LatLonPointDistanceFeatureQuery extends Query {
 
         @Override
         public int advance(int target) throws IOException {
-        return doc = it.advance(target);
+          return doc = it.advance(target);
         }
       };
     }
@@ -349,7 +364,6 @@ final class LatLonPointDistanceFeatureQuery extends Query {
 
     private int setMinCompetitiveScoreCounter = 0;
 
-
     @Override
     public void setMinCompetitiveScore(float minScore) throws IOException {
       if (minScore > boost) {
@@ -370,8 +384,8 @@ final class LatLonPointDistanceFeatureQuery extends Query {
         return;
       }
 
-      //Ideally we would be doing a distance query but that is too expensive so we approximate
-      //with a box query which performs better.
+      // Ideally we would be doing a distance query but that is too expensive so we approximate
+      // with a box query which performs better.
       Rectangle box = Rectangle.fromPointDistance(originLat, originLon, maxDistance);
       final byte minLat[] = new byte[LatLonPoint.BYTES];
       final byte maxLat[] = new byte[LatLonPoint.BYTES];
@@ -379,7 +393,6 @@ final class LatLonPointDistanceFeatureQuery extends Query {
       final byte maxLon[] = new byte[LatLonPoint.BYTES];
       final boolean crossDateLine = box.crossesDateline();
 
-
       NumericUtils.intToSortableBytes(GeoEncodingUtils.encodeLatitude(box.minLat), minLat, 0);
       NumericUtils.intToSortableBytes(GeoEncodingUtils.encodeLatitude(box.maxLat), maxLat, 0);
       NumericUtils.intToSortableBytes(GeoEncodingUtils.encodeLongitude(box.minLon), minLon, 0);
@@ -387,89 +400,190 @@ final class LatLonPointDistanceFeatureQuery extends Query {
 
       DocIdSetBuilder result = new DocIdSetBuilder(maxDoc);
       final int doc = docID();
-      IntersectVisitor visitor = new IntersectVisitor() {
-
-        DocIdSetBuilder.BulkAdder adder;
+      IntersectVisitor visitor =
+          new IntersectVisitor() {
 
-        @Override
-        public void grow(int count) {
-          adder = result.grow(count);
-        }
+            DocIdSetBuilder.BulkAdder adder;
 
-        @Override
-        public void visit(int docID) {
-          if (docID <= doc) {
-            // Already visited or skipped
-            return;
-          }
-          adder.add(docID);
-        }
-
-        @Override
-        public void visit(int docID, byte[] packedValue) {
-          if (docID <= doc) {
-            // Already visited or skipped
-            return;
-          }
-          if (Arrays.compareUnsigned(packedValue, 0, LatLonPoint.BYTES, maxLat, 0, LatLonPoint.BYTES) > 0 ||
-              Arrays.compareUnsigned(packedValue, 0, LatLonPoint.BYTES, minLat, 0, LatLonPoint.BYTES) < 0) {
-            //Latitude out of range
-            return;
-          }
-          if (crossDateLine) {
-            if (Arrays.compareUnsigned(packedValue, LatLonPoint.BYTES, 2 * LatLonPoint.BYTES, minLon, 0, LatLonPoint.BYTES) < 0 &&
-                Arrays.compareUnsigned(packedValue, LatLonPoint.BYTES, 2 * LatLonPoint.BYTES, maxLon, 0, LatLonPoint.BYTES)  > 0) {
-              //Longitude out of range
-              return;
+            @Override
+            public void grow(int count) {
+              adder = result.grow(count);
             }
 
-          } else {
-            if (Arrays.compareUnsigned(packedValue, LatLonPoint.BYTES, 2 * LatLonPoint.BYTES, maxLon, 0, LatLonPoint.BYTES) > 0 ||
-                Arrays.compareUnsigned(packedValue, LatLonPoint.BYTES, 2 * LatLonPoint.BYTES, minLon, 0, LatLonPoint.BYTES) < 0) {
-              //Longitude out of range
-              return;
+            @Override
+            public void visit(int docID) {
+              if (docID <= doc) {
+                // Already visited or skipped
+                return;
+              }
+              adder.add(docID);
             }
-          }
-          adder.add(docID);
-        }
 
-        @Override
-        public Relation compare(byte[] minPackedValue, byte[] maxPackedValue) {
-
-          if (Arrays.compareUnsigned(minPackedValue, 0, LatLonPoint.BYTES, maxLat, 0, LatLonPoint.BYTES) > 0 ||
-              Arrays.compareUnsigned(maxPackedValue, 0, LatLonPoint.BYTES, minLat, 0, LatLonPoint.BYTES) < 0) {
-            return Relation.CELL_OUTSIDE_QUERY;
-          }
-          boolean crosses = Arrays.compareUnsigned(minPackedValue, 0, LatLonPoint.BYTES, minLat, 0, LatLonPoint.BYTES) < 0 ||
-              Arrays.compareUnsigned(maxPackedValue, 0, LatLonPoint.BYTES, maxLat, 0, LatLonPoint.BYTES) > 0;
-
-          if (crossDateLine) {
-            if (Arrays.compareUnsigned(minPackedValue, LatLonPoint.BYTES, 2 * LatLonPoint.BYTES, maxLon, 0, LatLonPoint.BYTES) > 0 &&
-                Arrays.compareUnsigned(maxPackedValue, LatLonPoint.BYTES, 2 * LatLonPoint.BYTES, minLon, 0, LatLonPoint.BYTES) < 0) {
-              return Relation.CELL_OUTSIDE_QUERY;
+            @Override
+            public void visit(int docID, byte[] packedValue) {
+              if (docID <= doc) {
+                // Already visited or skipped
+                return;
+              }
+              if (Arrays.compareUnsigned(
+                          packedValue, 0, LatLonPoint.BYTES, maxLat, 0, LatLonPoint.BYTES)
+                      > 0
+                  || Arrays.compareUnsigned(
+                          packedValue, 0, LatLonPoint.BYTES, minLat, 0, LatLonPoint.BYTES)
+                      < 0) {
+                // Latitude out of range
+                return;
+              }
+              if (crossDateLine) {
+                if (Arrays.compareUnsigned(
+                            packedValue,
+                            LatLonPoint.BYTES,
+                            2 * LatLonPoint.BYTES,
+                            minLon,
+                            0,
+                            LatLonPoint.BYTES)
+                        < 0
+                    && Arrays.compareUnsigned(
+                            packedValue,
+                            LatLonPoint.BYTES,
+                            2 * LatLonPoint.BYTES,
+                            maxLon,
+                            0,
+                            LatLonPoint.BYTES)
+                        > 0) {
+                  // Longitude out of range
+                  return;
+                }
+
+              } else {
+                if (Arrays.compareUnsigned(
+                            packedValue,
+                            LatLonPoint.BYTES,
+                            2 * LatLonPoint.BYTES,
+                            maxLon,
+                            0,
+                            LatLonPoint.BYTES)
+                        > 0
+                    || Arrays.compareUnsigned(
+                            packedValue,
+                            LatLonPoint.BYTES,
+                            2 * LatLonPoint.BYTES,
+                            minLon,
+                            0,
+                            LatLonPoint.BYTES)
+                        < 0) {
+                  // Longitude out of range
+                  return;
+                }
+              }
+              adder.add(docID);
             }
-            crosses |= Arrays.compareUnsigned(minPackedValue, LatLonPoint.BYTES, 2 * LatLonPoint.BYTES, maxLon, 0, LatLonPoint.BYTES) < 0 ||
-                Arrays.compareUnsigned(maxPackedValue, LatLonPoint.BYTES, 2 * LatLonPoint.BYTES, minLon, 0, LatLonPoint.BYTES) > 0;
 
-          } else {
-            if (Arrays.compareUnsigned(minPackedValue, LatLonPoint.BYTES, 2 * LatLonPoint.BYTES, maxLon, 0, LatLonPoint.BYTES) > 0 ||
-                Arrays.compareUnsigned(maxPackedValue, LatLonPoint.BYTES, 2 * LatLonPoint.BYTES, minLon, 0, LatLonPoint.BYTES) < 0) {
-              return Relation.CELL_OUTSIDE_QUERY;
+            @Override
+            public Relation compare(byte[] minPackedValue, byte[] maxPackedValue) {
+
+              if (Arrays.compareUnsigned(
+                          minPackedValue, 0, LatLonPoint.BYTES, maxLat, 0, LatLonPoint.BYTES)
+                      > 0
+                  || Arrays.compareUnsigned(
+                          maxPackedValue, 0, LatLonPoint.BYTES, minLat, 0, LatLonPoint.BYTES)
+                      < 0) {
+                return Relation.CELL_OUTSIDE_QUERY;
+              }
+              boolean crosses =
+                  Arrays.compareUnsigned(
+                              minPackedValue, 0, LatLonPoint.BYTES, minLat, 0, LatLonPoint.BYTES)
+                          < 0
+                      || Arrays.compareUnsigned(
+                              maxPackedValue, 0, LatLonPoint.BYTES, maxLat, 0, LatLonPoint.BYTES)
+                          > 0;
+
+              if (crossDateLine) {
+                if (Arrays.compareUnsigned(
+                            minPackedValue,
+                            LatLonPoint.BYTES,
+                            2 * LatLonPoint.BYTES,
+                            maxLon,
+                            0,
+                            LatLonPoint.BYTES)
+                        > 0
+                    && Arrays.compareUnsigned(
+                            maxPackedValue,
+                            LatLonPoint.BYTES,
+                            2 * LatLonPoint.BYTES,
+                            minLon,
+                            0,
+                            LatLonPoint.BYTES)
+                        < 0) {
+                  return Relation.CELL_OUTSIDE_QUERY;
+                }
+                crosses |=
+                    Arrays.compareUnsigned(
+                                minPackedValue,
+                                LatLonPoint.BYTES,
+                                2 * LatLonPoint.BYTES,
+                                maxLon,
+                                0,
+                                LatLonPoint.BYTES)
+                            < 0
+                        || Arrays.compareUnsigned(
+                                maxPackedValue,
+                                LatLonPoint.BYTES,
+                                2 * LatLonPoint.BYTES,
+                                minLon,
+                                0,
+                                LatLonPoint.BYTES)
+                            > 0;
+
+              } else {
+                if (Arrays.compareUnsigned(
+                            minPackedValue,
+                            LatLonPoint.BYTES,
+                            2 * LatLonPoint.BYTES,
+                            maxLon,
+                            0,
+                            LatLonPoint.BYTES)
+                        > 0
+                    || Arrays.compareUnsigned(
+                            maxPackedValue,
+                            LatLonPoint.BYTES,
+                            2 * LatLonPoint.BYTES,
+                            minLon,
+                            0,
+                            LatLonPoint.BYTES)
+                        < 0) {
+                  return Relation.CELL_OUTSIDE_QUERY;
+                }
+                crosses |=
+                    Arrays.compareUnsigned(
+                                minPackedValue,
+                                LatLonPoint.BYTES,
+                                2 * LatLonPoint.BYTES,
+                                minLon,
+                                0,
+                                LatLonPoint.BYTES)
+                            < 0
+                        || Arrays.compareUnsigned(
+                                maxPackedValue,
+                                LatLonPoint.BYTES,
+                                2 * LatLonPoint.BYTES,
+                                maxLon,
+                                0,
+                                LatLonPoint.BYTES)
+                            > 0;
+              }
+              if (crosses) {
+                return Relation.CELL_CROSSES_QUERY;
+              } else {
+                return Relation.CELL_INSIDE_QUERY;
+              }
             }
-            crosses |= Arrays.compareUnsigned(minPackedValue, LatLonPoint.BYTES, 2 * LatLonPoint.BYTES, minLon, 0, LatLonPoint.BYTES) < 0 ||
-                Arrays.compareUnsigned(maxPackedValue, LatLonPoint.BYTES, 2 * LatLonPoint.BYTES, maxLon, 0, LatLonPoint.BYTES) > 0;
-          }
-          if (crosses) {
-            return Relation.CELL_CROSSES_QUERY;
-          } else {
-            return Relation.CELL_INSIDE_QUERY;
-          }
-        }
-      };
+          };
 
       final long currentQueryCost = Math.min(leadCost, it.cost());
       final long threshold = currentQueryCost >>> 3;
-      long estimatedNumberOfMatches = pointValues.estimatePointCount(visitor); // runs in O(log(numPoints))
+      long estimatedNumberOfMatches =
+          pointValues.estimatePointCount(visitor); // runs in O(log(numPoints))
       // TODO: what is the right factor compared to the current disi? Is 8 optimal?
       if (estimatedNumberOfMatches >= threshold) {
         // the new range is not selective enough to be worth materializing
@@ -478,6 +592,5 @@ final class LatLonPointDistanceFeatureQuery extends Query {
       pointValues.intersect(visitor);
       it = result.build().iterator();
     }
-
   }
 }
diff --git a/lucene/core/src/java/org/apache/lucene/document/LatLonPointDistanceQuery.java b/lucene/core/src/java/org/apache/lucene/document/LatLonPointDistanceQuery.java
index 79fabf3..bca9128 100644
--- a/lucene/core/src/java/org/apache/lucene/document/LatLonPointDistanceQuery.java
+++ b/lucene/core/src/java/org/apache/lucene/document/LatLonPointDistanceQuery.java
@@ -16,9 +16,13 @@
  */
 package org.apache.lucene.document;
 
+import static org.apache.lucene.geo.GeoEncodingUtils.decodeLatitude;
+import static org.apache.lucene.geo.GeoEncodingUtils.decodeLongitude;
+import static org.apache.lucene.geo.GeoEncodingUtils.encodeLatitude;
+import static org.apache.lucene.geo.GeoEncodingUtils.encodeLongitude;
+
 import java.io.IOException;
 import java.util.Arrays;
-
 import org.apache.lucene.geo.GeoEncodingUtils;
 import org.apache.lucene.geo.GeoUtils;
 import org.apache.lucene.geo.Rectangle;
@@ -43,21 +47,15 @@ import org.apache.lucene.util.DocIdSetBuilder;
 import org.apache.lucene.util.FixedBitSet;
 import org.apache.lucene.util.NumericUtils;
 
-import static org.apache.lucene.geo.GeoEncodingUtils.decodeLatitude;
-import static org.apache.lucene.geo.GeoEncodingUtils.decodeLongitude;
-import static org.apache.lucene.geo.GeoEncodingUtils.encodeLatitude;
-import static org.apache.lucene.geo.GeoEncodingUtils.encodeLongitude;
-
-/**
- * Distance query for {@link LatLonPoint}.
- */
+/** Distance query for {@link LatLonPoint}. */
 final class LatLonPointDistanceQuery extends Query {
   final String field;
   final double latitude;
   final double longitude;
   final double radiusMeters;
 
-  public LatLonPointDistanceQuery(String field, double latitude, double longitude, double radiusMeters) {
+  public LatLonPointDistanceQuery(
+      String field, double latitude, double longitude, double radiusMeters) {
     if (field == null) {
       throw new IllegalArgumentException("field must not be null");
     }
@@ -80,7 +78,8 @@ final class LatLonPointDistanceQuery extends Query {
   }
 
   @Override
-  public Weight createWeight(IndexSearcher searcher, ScoreMode scoreMode, float boost) throws IOException {
+  public Weight createWeight(IndexSearcher searcher, ScoreMode scoreMode, float boost)
+      throws IOException {
     Rectangle box = Rectangle.fromPointDistance(latitude, longitude, radiusMeters);
     // create bounding box(es) for the distance range
     // these are pre-encoded with LatLonPoint's encoding
@@ -115,7 +114,8 @@ final class LatLonPointDistanceQuery extends Query {
 
     return new ConstantScoreWeight(this, boost) {
 
-      final GeoEncodingUtils.DistancePredicate distancePredicate = GeoEncodingUtils.createDistancePredicate(latitude, longitude, radiusMeters);
+      final GeoEncodingUtils.DistancePredicate distancePredicate =
+          GeoEncodingUtils.createDistancePredicate(latitude, longitude, radiusMeters);
 
       @Override
       public Scorer scorer(LeafReaderContext context) throws IOException {
@@ -165,7 +165,7 @@ final class LatLonPointDistanceQuery extends Query {
               // by computing the set of documents that do NOT match the range
               final FixedBitSet result = new FixedBitSet(reader.maxDoc());
               result.set(0, reader.maxDoc());
-              int[] cost = new int[]{reader.maxDoc()};
+              int[] cost = new int[] {reader.maxDoc()};
               values.intersect(getInverseIntersectVisitor(result, cost));
               final DocIdSetIterator iterator = new BitSetIterator(result, cost[0]);
               return new ConstantScoreScorer(weight, score(), scoreMode, iterator);
@@ -183,20 +183,41 @@ final class LatLonPointDistanceQuery extends Query {
             return cost;
           }
         };
-
       }
 
       private boolean matches(byte[] packedValue) {
         // bounding box check
-        if (Arrays.compareUnsigned(packedValue, 0, Integer.BYTES, maxLat, 0, Integer.BYTES) > 0 ||
-            Arrays.compareUnsigned(packedValue, 0, Integer.BYTES, minLat, 0, Integer.BYTES) < 0) {
+        if (Arrays.compareUnsigned(packedValue, 0, Integer.BYTES, maxLat, 0, Integer.BYTES) > 0
+            || Arrays.compareUnsigned(packedValue, 0, Integer.BYTES, minLat, 0, Integer.BYTES)
+                < 0) {
           // latitude out of bounding box range
           return false;
         }
 
-        if ((Arrays.compareUnsigned(packedValue, Integer.BYTES, Integer.BYTES + Integer.BYTES, maxLon, 0, Integer.BYTES) > 0 ||
-            Arrays.compareUnsigned(packedValue, Integer.BYTES, Integer.BYTES + Integer.BYTES, minLon, 0, Integer.BYTES) < 0)
-            && Arrays.compareUnsigned(packedValue, Integer.BYTES, Integer.BYTES + Integer.BYTES, minLon2, 0, Integer.BYTES) < 0) {
+        if ((Arrays.compareUnsigned(
+                        packedValue,
+                        Integer.BYTES,
+                        Integer.BYTES + Integer.BYTES,
+                        maxLon,
+                        0,
+                        Integer.BYTES)
+                    > 0
+                || Arrays.compareUnsigned(
+                        packedValue,
+                        Integer.BYTES,
+                        Integer.BYTES + Integer.BYTES,
+                        minLon,
+                        0,
+                        Integer.BYTES)
+                    < 0)
+            && Arrays.compareUnsigned(
+                    packedValue,
+                    Integer.BYTES,
+                    Integer.BYTES + Integer.BYTES,
+                    minLon2,
+                    0,
+                    Integer.BYTES)
+                < 0) {
           // longitude out of bounding box range
           return false;
         }
@@ -211,19 +232,43 @@ final class LatLonPointDistanceQuery extends Query {
 
       // algorithm: we create a bounding box (two bounding boxes if we cross the dateline).
       // 1. check our bounding box(es) first. if the subtree is entirely outside of those, bail.
-      // 2. check if the subtree is disjoint. it may cross the bounding box but not intersect with circle
-      // 3. see if the subtree is fully contained. if the subtree is enormous along the x axis, wrapping half way around the world, etc: then this can't work, just go to step 4.
+      // 2. check if the subtree is disjoint. it may cross the bounding box but not intersect with
+      // circle
+      // 3. see if the subtree is fully contained. if the subtree is enormous along the x axis,
+      // wrapping half way around the world, etc: then this can't work, just go to step 4.
       // 4. recurse naively (subtrees crossing over circle edge)
       private Relation relate(byte[] minPackedValue, byte[] maxPackedValue) {
-        if (Arrays.compareUnsigned(minPackedValue, 0, Integer.BYTES, maxLat, 0, Integer.BYTES) > 0 ||
-            Arrays.compareUnsigned(maxPackedValue, 0, Integer.BYTES, minLat, 0, Integer.BYTES) < 0) {
+        if (Arrays.compareUnsigned(minPackedValue, 0, Integer.BYTES, maxLat, 0, Integer.BYTES) > 0
+            || Arrays.compareUnsigned(maxPackedValue, 0, Integer.BYTES, minLat, 0, Integer.BYTES)
+                < 0) {
           // latitude out of bounding box range
           return Relation.CELL_OUTSIDE_QUERY;
         }
 
-        if ((Arrays.compareUnsigned(minPackedValue, Integer.BYTES, Integer.BYTES + Integer.BYTES, maxLon, 0, Integer.BYTES) > 0 ||
-            Arrays.compareUnsigned(maxPackedValue, Integer.BYTES, Integer.BYTES + Integer.BYTES, minLon, 0, Integer.BYTES) < 0)
-            && Arrays.compareUnsigned(maxPackedValue, Integer.BYTES, Integer.BYTES + Integer.BYTES, minLon2, 0, Integer.BYTES) < 0) {
+        if ((Arrays.compareUnsigned(
+                        minPackedValue,
+                        Integer.BYTES,
+                        Integer.BYTES + Integer.BYTES,
+                        maxLon,
+                        0,
+                        Integer.BYTES)
+                    > 0
+                || Arrays.compareUnsigned(
+                        maxPackedValue,
+                        Integer.BYTES,
+                        Integer.BYTES + Integer.BYTES,
+                        minLon,
+                        0,
+                        Integer.BYTES)
+                    < 0)
+            && Arrays.compareUnsigned(
+                    maxPackedValue,
+                    Integer.BYTES,
+                    Integer.BYTES + Integer.BYTES,
+                    minLon2,
+                    0,
+                    Integer.BYTES)
+                < 0) {
           // longitude out of bounding box range
           return Relation.CELL_OUTSIDE_QUERY;
         }
@@ -233,12 +278,11 @@ final class LatLonPointDistanceQuery extends Query {
         double latMax = decodeLatitude(maxPackedValue, 0);
         double lonMax = decodeLongitude(maxPackedValue, Integer.BYTES);
 
-        return GeoUtils.relate(latMin, latMax, lonMin, lonMax, latitude, longitude, sortKey, axisLat);
+        return GeoUtils.relate(
+            latMin, latMax, lonMin, lonMax, latitude, longitude, sortKey, axisLat);
       }
 
-      /**
-       * Create a visitor that collects documents matching the range.
-       */
+      /** Create a visitor that collects documents matching the range. */
       private IntersectVisitor getIntersectVisitor(DocIdSetBuilder result) {
         return new IntersectVisitor() {
 
@@ -278,9 +322,7 @@ final class LatLonPointDistanceQuery extends Query {
         };
       }
 
-      /**
-       * Create a visitor that clears documents that do NOT match the range.
-       */
+      /** Create a visitor that clears documents that do NOT match the range. */
       private IntersectVisitor getInverseIntersectVisitor(FixedBitSet result, int[] cost) {
         return new IntersectVisitor() {
 
@@ -359,15 +401,14 @@ final class LatLonPointDistanceQuery extends Query {
 
   @Override
   public boolean equals(Object other) {
-    return sameClassAs(other) &&
-           equalsTo(getClass().cast(other));
+    return sameClassAs(other) && equalsTo(getClass().cast(other));
   }
 
   private boolean equalsTo(LatLonPointDistanceQuery other) {
-    return field.equals(other.field) &&
-           Double.doubleToLongBits(latitude) == Double.doubleToLongBits(other.latitude) &&
-           Double.doubleToLongBits(longitude) == Double.doubleToLongBits(other.longitude) &&
-           Double.doubleToLongBits(radiusMeters) == Double.doubleToLongBits(other.radiusMeters);
+    return field.equals(other.field)
+        && Double.doubleToLongBits(latitude) == Double.doubleToLongBits(other.latitude)
+        && Double.doubleToLongBits(longitude) == Double.doubleToLongBits(other.longitude)
+        && Double.doubleToLongBits(radiusMeters) == Double.doubleToLongBits(other.radiusMeters);
   }
 
   @Override
diff --git a/lucene/core/src/java/org/apache/lucene/document/LatLonPointInGeometryQuery.java b/lucene/core/src/java/org/apache/lucene/document/LatLonPointInGeometryQuery.java
index 2d749cc..66ad777 100644
--- a/lucene/core/src/java/org/apache/lucene/document/LatLonPointInGeometryQuery.java
+++ b/lucene/core/src/java/org/apache/lucene/document/LatLonPointInGeometryQuery.java
@@ -16,6 +16,13 @@
  */
 package org.apache.lucene.document;
 
+import static org.apache.lucene.geo.GeoEncodingUtils.decodeLatitude;
+import static org.apache.lucene.geo.GeoEncodingUtils.decodeLongitude;
+import static org.apache.lucene.geo.GeoEncodingUtils.encodeLatitude;
+import static org.apache.lucene.geo.GeoEncodingUtils.encodeLongitude;
+
+import java.io.IOException;
+import java.util.Arrays;
 import org.apache.lucene.geo.Component2D;
 import org.apache.lucene.geo.GeoEncodingUtils;
 import org.apache.lucene.geo.LatLonGeometry;
@@ -39,20 +46,13 @@ import org.apache.lucene.search.Weight;
 import org.apache.lucene.util.DocIdSetBuilder;
 import org.apache.lucene.util.NumericUtils;
 
-import java.io.IOException;
-import java.util.Arrays;
-
-import static org.apache.lucene.geo.GeoEncodingUtils.decodeLatitude;
-import static org.apache.lucene.geo.GeoEncodingUtils.decodeLongitude;
-import static org.apache.lucene.geo.GeoEncodingUtils.encodeLatitude;
-import static org.apache.lucene.geo.GeoEncodingUtils.encodeLongitude;
-
-/** Finds all previously indexed points that fall within the specified geometries.
+/**
+ * Finds all previously indexed points that fall within the specified geometries.
  *
- *  <p>The field must be indexed with using {@link LatLonPoint} added per document.
+ * <p>The field must be indexed with using {@link LatLonPoint} added per document.
  *
- *  @lucene.experimental */
-
+ * @lucene.experimental
+ */
 final class LatLonPointInGeometryQuery extends Query {
   final String field;
   final LatLonGeometry[] geometries;
@@ -72,7 +72,8 @@ final class LatLonPointInGeometryQuery extends Query {
         throw new IllegalArgumentException("geometries[" + i + "] must not be null");
       }
       if (geometries[i] instanceof Line) {
-        throw new IllegalArgumentException("LatLonPointInGeometryQuery does not support queries with line geometries");
+        throw new IllegalArgumentException(
+            "LatLonPointInGeometryQuery does not support queries with line geometries");
       }
     }
     this.field = field;
@@ -86,62 +87,86 @@ final class LatLonPointInGeometryQuery extends Query {
     }
   }
 
-  private IntersectVisitor getIntersectVisitor(DocIdSetBuilder result, Component2D tree, GeoEncodingUtils.Component2DPredicate component2DPredicate,
-                                               byte[] minLat, byte[] maxLat, byte[] minLon, byte[] maxLon) {
+  private IntersectVisitor getIntersectVisitor(
+      DocIdSetBuilder result,
+      Component2D tree,
+      GeoEncodingUtils.Component2DPredicate component2DPredicate,
+      byte[] minLat,
+      byte[] maxLat,
+      byte[] minLon,
+      byte[] maxLon) {
     return new IntersectVisitor() {
-          DocIdSetBuilder.BulkAdder adder;
+      DocIdSetBuilder.BulkAdder adder;
 
-          @Override
-          public void grow(int count) {
-            adder = result.grow(count);
-          }
+      @Override
+      public void grow(int count) {
+        adder = result.grow(count);
+      }
 
-          @Override
-          public void visit(int docID) {
-            adder.add(docID);
-          }
+      @Override
+      public void visit(int docID) {
+        adder.add(docID);
+      }
 
-          @Override
-          public void visit(int docID, byte[] packedValue) {
-            if (component2DPredicate.test(NumericUtils.sortableBytesToInt(packedValue, 0),
-                NumericUtils.sortableBytesToInt(packedValue, Integer.BYTES))) {
-              visit(docID);
-            }
-          }
+      @Override
+      public void visit(int docID, byte[] packedValue) {
+        if (component2DPredicate.test(
+            NumericUtils.sortableBytesToInt(packedValue, 0),
+            NumericUtils.sortableBytesToInt(packedValue, Integer.BYTES))) {
+          visit(docID);
+        }
+      }
 
-          @Override
-          public void visit(DocIdSetIterator iterator, byte[] packedValue) throws IOException {
-            if (component2DPredicate.test(NumericUtils.sortableBytesToInt(packedValue, 0),
-                NumericUtils.sortableBytesToInt(packedValue, Integer.BYTES))) {
-              int docID;
-              while ((docID = iterator.nextDoc()) != DocIdSetIterator.NO_MORE_DOCS) {
-                visit(docID);
-              }
-            }
+      @Override
+      public void visit(DocIdSetIterator iterator, byte[] packedValue) throws IOException {
+        if (component2DPredicate.test(
+            NumericUtils.sortableBytesToInt(packedValue, 0),
+            NumericUtils.sortableBytesToInt(packedValue, Integer.BYTES))) {
+          int docID;
+          while ((docID = iterator.nextDoc()) != DocIdSetIterator.NO_MORE_DOCS) {
+            visit(docID);
           }
+        }
+      }
 
-          @Override
-          public Relation compare(byte[] minPackedValue, byte[] maxPackedValue) {
-            if (Arrays.compareUnsigned(minPackedValue, 0, Integer.BYTES, maxLat, 0, Integer.BYTES) > 0 ||
-                Arrays.compareUnsigned(maxPackedValue, 0, Integer.BYTES, minLat, 0, Integer.BYTES) < 0 ||
-                Arrays.compareUnsigned(minPackedValue, Integer.BYTES, Integer.BYTES + Integer.BYTES, maxLon, 0, Integer.BYTES) > 0 ||
-                Arrays.compareUnsigned(maxPackedValue, Integer.BYTES, Integer.BYTES + Integer.BYTES, minLon, 0, Integer.BYTES) < 0) {
-              // outside of global bounding box range
-              return Relation.CELL_OUTSIDE_QUERY;
-            }
+      @Override
+      public Relation compare(byte[] minPackedValue, byte[] maxPackedValue) {
+        if (Arrays.compareUnsigned(minPackedValue, 0, Integer.BYTES, maxLat, 0, Integer.BYTES) > 0
+            || Arrays.compareUnsigned(maxPackedValue, 0, Integer.BYTES, minLat, 0, Integer.BYTES)
+                < 0
+            || Arrays.compareUnsigned(
+                    minPackedValue,
+                    Integer.BYTES,
+                    Integer.BYTES + Integer.BYTES,
+                    maxLon,
+                    0,
+                    Integer.BYTES)
+                > 0
+            || Arrays.compareUnsigned(
+                    maxPackedValue,
+                    Integer.BYTES,
+                    Integer.BYTES + Integer.BYTES,
+                    minLon,
+                    0,
+                    Integer.BYTES)
+                < 0) {
+          // outside of global bounding box range
+          return Relation.CELL_OUTSIDE_QUERY;
+        }
 
-            double cellMinLat = decodeLatitude(minPackedValue, 0);
-            double cellMinLon = decodeLongitude(minPackedValue, Integer.BYTES);
-            double cellMaxLat = decodeLatitude(maxPackedValue, 0);
-            double cellMaxLon = decodeLongitude(maxPackedValue, Integer.BYTES);
+        double cellMinLat = decodeLatitude(minPackedValue, 0);
+        double cellMinLon = decodeLongitude(minPackedValue, Integer.BYTES);
+        double cellMaxLat = decodeLatitude(maxPackedValue, 0);
+        double cellMaxLon = decodeLongitude(maxPackedValue, Integer.BYTES);
 
-            return tree.relate(cellMinLon, cellMaxLon, cellMinLat, cellMaxLat);
-          }
-        };
+        return tree.relate(cellMinLon, cellMaxLon, cellMinLat, cellMaxLat);
+      }
+    };
   }
 
   @Override
-  public Weight createWeight(IndexSearcher searcher, ScoreMode scoreMode, float boost) throws IOException {
+  public Weight createWeight(IndexSearcher searcher, ScoreMode scoreMode, float boost)
+      throws IOException {
     final Component2D tree = LatLonGeometry.create(geometries);
     if (tree.getMinY() > tree.getMaxY()) {
       // encodeLatitudeCeil may cause minY to be > maxY iff
@@ -158,8 +183,10 @@ final class LatLonPointInGeometryQuery extends Query {
         }
       };
     }
-    final GeoEncodingUtils.Component2DPredicate component2DPredicate = GeoEncodingUtils.createComponentPredicate(tree);
-    // bounding box over all geometries, this can speed up tree intersection/cheaply improve approximation for complex multi-geometries
+    final GeoEncodingUtils.Component2DPredicate component2DPredicate =
+        GeoEncodingUtils.createComponentPredicate(tree);
+    // bounding box over all geometries, this can speed up tree intersection/cheaply improve
+    // approximation for complex multi-geometries
     final byte minLat[] = new byte[Integer.BYTES];
     final byte maxLat[] = new byte[Integer.BYTES];
     final byte minLon[] = new byte[Integer.BYTES];
@@ -191,7 +218,9 @@ final class LatLonPointInGeometryQuery extends Query {
 
           long cost = -1;
           DocIdSetBuilder result = new DocIdSetBuilder(reader.maxDoc(), values, field);
-          final IntersectVisitor visitor = getIntersectVisitor(result, tree, component2DPredicate, minLat, maxLat, minLon, maxLon);
+          final IntersectVisitor visitor =
+              getIntersectVisitor(
+                  result, tree, component2DPredicate, minLat, maxLat, minLon, maxLon);
 
           @Override
           public Scorer get(long leadCost) throws IOException {
@@ -202,7 +231,7 @@ final class LatLonPointInGeometryQuery extends Query {
           @Override
           public long cost() {
             if (cost == -1) {
-               // Computing the cost may be expensive, so only do it if necessary
+              // Computing the cost may be expensive, so only do it if necessary
               cost = values.estimateDocCount(visitor);
               assert cost >= 0;
             }
@@ -225,7 +254,6 @@ final class LatLonPointInGeometryQuery extends Query {
         return true;
       }
     };
-
   }
 
   /** Returns the query field */
@@ -249,13 +277,11 @@ final class LatLonPointInGeometryQuery extends Query {
 
   @Override
   public boolean equals(Object other) {
-    return sameClassAs(other) &&
-           equalsTo(getClass().cast(other));
+    return sameClassAs(other) && equalsTo(getClass().cast(other));
   }
 
   private boolean equalsTo(LatLonPointInGeometryQuery other) {
-    return field.equals(other.field) &&
-           Arrays.equals(geometries, other.geometries);
+    return field.equals(other.field) && Arrays.equals(geometries, other.geometries);
   }
 
   @Override
diff --git a/lucene/core/src/java/org/apache/lucene/document/LatLonPointSortField.java b/lucene/core/src/java/org/apache/lucene/document/LatLonPointSortField.java
index 8d6f652..36f3935 100644
--- a/lucene/core/src/java/org/apache/lucene/document/LatLonPointSortField.java
+++ b/lucene/core/src/java/org/apache/lucene/document/LatLonPointSortField.java
@@ -20,9 +20,7 @@ import org.apache.lucene.geo.GeoUtils;
 import org.apache.lucene.search.FieldComparator;
 import org.apache.lucene.search.SortField;
 
-/**
- * Sorts by distance from an origin location.
- */
+/** Sorts by distance from an origin location. */
 final class LatLonPointSortField extends SortField {
   final double latitude;
   final double longitude;
@@ -38,7 +36,7 @@ final class LatLonPointSortField extends SortField {
     this.longitude = longitude;
     setMissingValue(Double.POSITIVE_INFINITY);
   }
-  
+
   @Override
   public FieldComparator<?> getComparator(int numHits, int sortPos) {
     return new LatLonPointDistanceComparator(getField(), latitude, longitude, numHits);
@@ -52,11 +50,13 @@ final class LatLonPointSortField extends SortField {
   @Override
   public void setMissingValue(Object missingValue) {
     if (Double.valueOf(Double.POSITIVE_INFINITY).equals(missingValue) == false) {
-      throw new IllegalArgumentException("Missing value can only be Double.POSITIVE_INFINITY (missing values last), but got " + missingValue);
+      throw new IllegalArgumentException(
+          "Missing value can only be Double.POSITIVE_INFINITY (missing values last), but got "
+              + missingValue);
     }
     this.missingValue = missingValue;
   }
-  
+
   @Override
   public int hashCode() {
     final int prime = 31;
@@ -76,7 +76,8 @@ final class LatLonPointSortField extends SortField {
     if (getClass() != obj.getClass()) return false;
     LatLonPointSortField other = (LatLonPointSortField) obj;
     if (Double.doubleToLongBits(latitude) != Double.doubleToLongBits(other.latitude)) return false;
-    if (Double.doubleToLongBits(longitude) != Double.doubleToLongBits(other.longitude)) return false;
+    if (Double.doubleToLongBits(longitude) != Double.doubleToLongBits(other.longitude))
+      return false;
     return true;
   }
 
diff --git a/lucene/core/src/java/org/apache/lucene/document/LatLonShape.java b/lucene/core/src/java/org/apache/lucene/document/LatLonShape.java
index 5e442dd..a35af35 100644
--- a/lucene/core/src/java/org/apache/lucene/document/LatLonShape.java
+++ b/lucene/core/src/java/org/apache/lucene/document/LatLonShape.java
@@ -16,9 +16,11 @@
  */
 package org.apache.lucene.document;
 
+import static org.apache.lucene.geo.GeoEncodingUtils.encodeLatitude;
+import static org.apache.lucene.geo.GeoEncodingUtils.encodeLongitude;
+
 import java.util.ArrayList;
 import java.util.List;
-
 import org.apache.lucene.document.ShapeField.QueryRelation; // javadoc
 import org.apache.lucene.document.ShapeField.Triangle;
 import org.apache.lucene.geo.Circle;
@@ -35,36 +37,37 @@ import org.apache.lucene.search.BooleanQuery;
 import org.apache.lucene.search.ConstantScoreQuery;
 import org.apache.lucene.search.Query;
 
-import static org.apache.lucene.geo.GeoEncodingUtils.encodeLatitude;
-import static org.apache.lucene.geo.GeoEncodingUtils.encodeLongitude;
-
 /**
- * An geo shape utility class for indexing and searching gis geometries
- * whose vertices are latitude, longitude values (in decimal degrees).
- * <p>
- * This class defines seven static factory methods for common indexing and search operations:
+ * An geo shape utility class for indexing and searching gis geometries whose vertices are latitude,
+ * longitude values (in decimal degrees).
+ *
+ * <p>This class defines seven static factory methods for common indexing and search operations:
+ *
  * <ul>
  *   <li>{@link #createIndexableFields(String, Polygon)} for indexing a geo polygon.
  *   <li>{@link #createIndexableFields(String, Line)} for indexing a geo linestring.
  *   <li>{@link #createIndexableFields(String, double, double)} for indexing a lat, lon geo point.
- *   <li>{@link #newBoxQuery newBoxQuery()} for matching geo shapes that have some {@link QueryRelation} with a bounding box.
- *   <li>{@link #newLineQuery newLineQuery()} for matching geo shapes that have some {@link QueryRelation} with a linestring.
- *   <li>{@link #newPolygonQuery newPolygonQuery()} for matching geo shapes that have some {@link QueryRelation} with a polygon.
- *   <li>{@link #newGeometryQuery newGeometryQuery()} for matching geo shapes that have some {@link QueryRelation}
- *   with one or more {@link LatLonGeometry}.
+ *   <li>{@link #newBoxQuery newBoxQuery()} for matching geo shapes that have some {@link
+ *       QueryRelation} with a bounding box.
+ *   <li>{@link #newLineQuery newLineQuery()} for matching geo shapes that have some {@link
+ *       QueryRelation} with a linestring.
+ *   <li>{@link #newPolygonQuery newPolygonQuery()} for matching geo shapes that have some {@link
+ *       QueryRelation} with a polygon.
+ *   <li>{@link #newGeometryQuery newGeometryQuery()} for matching geo shapes that have some {@link
+ *       QueryRelation} with one or more {@link LatLonGeometry}.
  * </ul>
-
- * <b>WARNING</b>: Like {@link LatLonPoint}, vertex values are indexed with some loss of precision from the
- * original {@code double} values (4.190951585769653E-8 for the latitude component
- * and 8.381903171539307E-8 for longitude).
+ *
+ * <b>WARNING</b>: Like {@link LatLonPoint}, vertex values are indexed with some loss of precision
+ * from the original {@code double} values (4.190951585769653E-8 for the latitude component and
+ * 8.381903171539307E-8 for longitude).
+ *
  * @see PointValues
  * @see LatLonDocValuesField
  */
 public class LatLonShape {
 
   // no instance:
-  private LatLonShape() {
-  }
+  private LatLonShape() {}
 
   /** create indexable fields for polygon geometry */
   public static Field[] createIndexableFields(String fieldName, Polygon polygon) {
@@ -83,71 +86,104 @@ public class LatLonShape {
     Field[] fields = new Field[numPoints - 1];
     // create "flat" triangles
     for (int i = 0, j = 1; j < numPoints; ++i, ++j) {
-      fields[i] = new Triangle(fieldName,
-          encodeLongitude(line.getLon(i)), encodeLatitude(line.getLat(i)),
-          encodeLongitude(line.getLon(j)), encodeLatitude(line.getLat(j)),
-          encodeLongitude(line.getLon(i)), encodeLatitude(line.getLat(i)));
+      fields[i] =
+          new Triangle(
+              fieldName,
+              encodeLongitude(line.getLon(i)),
+              encodeLatitude(line.getLat(i)),
+              encodeLongitude(line.getLon(j)),
+              encodeLatitude(line.getLat(j)),
+              encodeLongitude(line.getLon(i)),
+              encodeLatitude(line.getLat(i)));
     }
     return fields;
   }
 
   /** create indexable fields for point geometry */
   public static Field[] createIndexableFields(String fieldName, double lat, double lon) {
-    return new Field[] {new Triangle(fieldName,
-        encodeLongitude(lon), encodeLatitude(lat),
-        encodeLongitude(lon), encodeLatitude(lat),
-        encodeLongitude(lon), encodeLatitude(lat))};
+    return new Field[] {
+      new Triangle(
+          fieldName,
+          encodeLongitude(lon),
+          encodeLatitude(lat),
+          encodeLongitude(lon),
+          encodeLatitude(lat),
+          encodeLongitude(lon),
+          encodeLatitude(lat))
+    };
   }
 
-  /** create a query to find all indexed geo shapes that intersect a defined bounding box **/
-  public static Query newBoxQuery(String field, QueryRelation queryRelation, double minLatitude, double maxLatitude, double minLongitude, double maxLongitude) {
+  /** create a query to find all indexed geo shapes that intersect a defined bounding box * */
+  public static Query newBoxQuery(
+      String field,
+      QueryRelation queryRelation,
+      double minLatitude,
+      double maxLatitude,
+      double minLongitude,
+      double maxLongitude) {
     if (queryRelation == QueryRelation.CONTAINS && minLongitude > maxLongitude) {
       BooleanQuery.Builder builder = new BooleanQuery.Builder();
-      builder.add(newBoxQuery(field, queryRelation, minLatitude, maxLatitude, minLongitude, GeoUtils.MAX_LON_INCL), BooleanClause.Occur.MUST);
-      builder.add(newBoxQuery(field, queryRelation, minLatitude, maxLatitude, GeoUtils.MIN_LON_INCL, maxLongitude), BooleanClause.Occur.MUST);
+      builder.add(
+          newBoxQuery(
+              field, queryRelation, minLatitude, maxLatitude, minLongitude, GeoUtils.MAX_LON_INCL),
+          BooleanClause.Occur.MUST);
+      builder.add(
+          newBoxQuery(
+              field, queryRelation, minLatitude, maxLatitude, GeoUtils.MIN_LON_INCL, maxLongitude),
+          BooleanClause.Occur.MUST);
       return builder.build();
     }
     Rectangle rectangle = new Rectangle(minLatitude, maxLatitude, minLongitude, maxLongitude);
     return new LatLonShapeBoundingBoxQuery(field, queryRelation, rectangle);
   }
 
-  /** create a query to find all indexed geo shapes that intersect a provided linestring (or array of linestrings)
-   *  note: does not support dateline crossing
-   **/
+  /**
+   * create a query to find all indexed geo shapes that intersect a provided linestring (or array of
+   * linestrings) note: does not support dateline crossing
+   */
   public static Query newLineQuery(String field, QueryRelation queryRelation, Line... lines) {
     return newGeometryQuery(field, queryRelation, lines);
   }
 
-  /** create a query to find all indexed geo shapes that intersect a provided polygon (or array of polygons)
-   *  note: does not support dateline crossing
-   **/
-  public static Query newPolygonQuery(String field, QueryRelation queryRelation, Polygon... polygons) {
+  /**
+   * create a query to find all indexed geo shapes that intersect a provided polygon (or array of
+   * polygons) note: does not support dateline crossing
+   */
+  public static Query newPolygonQuery(
+      String field, QueryRelation queryRelation, Polygon... polygons) {
     return newGeometryQuery(field, queryRelation, polygons);
   }
 
-  /** create a query to find all indexed shapes that comply the {@link QueryRelation} with the provided points
-   **/
+  /**
+   * create a query to find all indexed shapes that comply the {@link QueryRelation} with the
+   * provided points
+   */
   public static Query newPointQuery(String field, QueryRelation queryRelation, double[]... points) {
     Point[] pointArray = new Point[points.length];
-    for (int i =0; i < points.length; i++) {
+    for (int i = 0; i < points.length; i++) {
       pointArray[i] = new Point(points[i][0], points[i][1]);
     }
     return newGeometryQuery(field, queryRelation, pointArray);
   }
 
   /** create a query to find all polygons that intersect a provided circle. */
-  public static Query newDistanceQuery(String field, QueryRelation queryRelation, Circle... circle) {
+  public static Query newDistanceQuery(
+      String field, QueryRelation queryRelation, Circle... circle) {
     return newGeometryQuery(field, queryRelation, circle);
   }
 
-  /** create a query to find all indexed geo shapes that intersect a provided geometry (or array of geometries).
-   **/
-  public static Query newGeometryQuery(String field, QueryRelation queryRelation, LatLonGeometry... latLonGeometries) {
-    if  (latLonGeometries.length == 1) {
+  /**
+   * create a query to find all indexed geo shapes that intersect a provided geometry (or array of
+   * geometries).
+   */
+  public static Query newGeometryQuery(
+      String field, QueryRelation queryRelation, LatLonGeometry... latLonGeometries) {
+    if (latLonGeometries.length == 1) {
       LatLonGeometry geometry = latLonGeometries[0];
       if (geometry instanceof Rectangle) {
         Rectangle rect = (Rectangle) geometry;
-        return newBoxQuery(field, queryRelation, rect.minLat, rect.maxLat, rect.minLon, rect.maxLon);
+        return newBoxQuery(
+            field, queryRelation, rect.minLat, rect.maxLat, rect.minLon, rect.maxLon);
       } else {
         return new LatLonShapeQuery(field, queryRelation, latLonGeometries);
       }
@@ -166,12 +202,16 @@ public class LatLonShape {
       if (geometry instanceof Rectangle) {
         // this handles rectangles across the dateline
         Rectangle rect = (Rectangle) geometry;
-        builder.add(newBoxQuery(field, QueryRelation.CONTAINS, rect.minLat, rect.maxLat, rect.minLon, rect.maxLon), BooleanClause.Occur.MUST);
+        builder.add(
+            newBoxQuery(
+                field, QueryRelation.CONTAINS, rect.minLat, rect.maxLat, rect.minLon, rect.maxLon),
+            BooleanClause.Occur.MUST);
       } else {
-        builder.add(new LatLonShapeQuery(field, QueryRelation.CONTAINS, geometry), BooleanClause.Occur.MUST);
+        builder.add(
+            new LatLonShapeQuery(field, QueryRelation.CONTAINS, geometry),
+            BooleanClause.Occur.MUST);
       }
     }
     return new ConstantScoreQuery(builder.build());
   }
-
 }
diff --git a/lucene/core/src/java/org/apache/lucene/document/LatLonShapeBoundingBoxQuery.java b/lucene/core/src/java/org/apache/lucene/document/LatLonShapeBoundingBoxQuery.java
index aca9349..4dcdc47 100644
--- a/lucene/core/src/java/org/apache/lucene/document/LatLonShapeBoundingBoxQuery.java
+++ b/lucene/core/src/java/org/apache/lucene/document/LatLonShapeBoundingBoxQuery.java
@@ -16,15 +16,6 @@
  */
 package org.apache.lucene.document;
 
-import java.util.Arrays;
-
-import org.apache.lucene.document.ShapeField.QueryRelation;
-import org.apache.lucene.geo.Component2D;
-import org.apache.lucene.geo.GeoUtils;
-import org.apache.lucene.geo.Rectangle;
-import org.apache.lucene.index.PointValues.Relation;
-import org.apache.lucene.util.NumericUtils;
-
 import static java.lang.Integer.BYTES;
 import static org.apache.lucene.geo.GeoEncodingUtils.MAX_LON_ENCODED;
 import static org.apache.lucene.geo.GeoEncodingUtils.MIN_LON_ENCODED;
@@ -33,12 +24,20 @@ import static org.apache.lucene.geo.GeoEncodingUtils.encodeLatitudeCeil;
 import static org.apache.lucene.geo.GeoEncodingUtils.encodeLongitude;
 import static org.apache.lucene.geo.GeoEncodingUtils.encodeLongitudeCeil;
 
+import java.util.Arrays;
+import org.apache.lucene.document.ShapeField.QueryRelation;
+import org.apache.lucene.geo.Component2D;
+import org.apache.lucene.geo.GeoUtils;
+import org.apache.lucene.geo.Rectangle;
+import org.apache.lucene.index.PointValues.Relation;
+import org.apache.lucene.util.NumericUtils;
+
 /**
  * Finds all previously indexed geo shapes that intersect the specified bounding box.
  *
- * <p>The field must be indexed using
- * {@link org.apache.lucene.document.LatLonShape#createIndexableFields} added per document.
- **/
+ * <p>The field must be indexed using {@link
+ * org.apache.lucene.document.LatLonShape#createIndexableFields} added per document.
+ */
 final class LatLonShapeBoundingBoxQuery extends ShapeQuery {
   private final Rectangle rectangle;
   private final EncodedRectangle encodedRectangle;
@@ -46,44 +45,57 @@ final class LatLonShapeBoundingBoxQuery extends ShapeQuery {
   LatLonShapeBoundingBoxQuery(String field, QueryRelation queryRelation, Rectangle rectangle) {
     super(field, queryRelation);
     this.rectangle = rectangle;
-    this.encodedRectangle = new EncodedRectangle(rectangle.minLat, rectangle.maxLat, rectangle.minLon, rectangle.maxLon);
+    this.encodedRectangle =
+        new EncodedRectangle(
+            rectangle.minLat, rectangle.maxLat, rectangle.minLon, rectangle.maxLon);
   }
 
   @Override
-  protected Relation relateRangeBBoxToQuery(int minXOffset, int minYOffset, byte[] minTriangle,
-                                            int maxXOffset, int maxYOffset, byte[] maxTriangle) {
+  protected Relation relateRangeBBoxToQuery(
+      int minXOffset,
+      int minYOffset,
+      byte[] minTriangle,
+      int maxXOffset,
+      int maxYOffset,
+      byte[] maxTriangle) {
     if (queryRelation == QueryRelation.INTERSECTS || queryRelation == QueryRelation.DISJOINT) {
-      return encodedRectangle.intersectRangeBBox(minXOffset, minYOffset, minTriangle, maxXOffset, maxYOffset, maxTriangle);
+      return encodedRectangle.intersectRangeBBox(
+          minXOffset, minYOffset, minTriangle, maxXOffset, maxYOffset, maxTriangle);
     }
-    return encodedRectangle.relateRangeBBox(minXOffset, minYOffset, minTriangle, maxXOffset, maxYOffset, maxTriangle);
+    return encodedRectangle.relateRangeBBox(
+        minXOffset, minYOffset, minTriangle, maxXOffset, maxYOffset, maxTriangle);
   }
 
-
   @Override
   protected boolean queryIntersects(byte[] t, ShapeField.DecodedTriangle scratchTriangle) {
     ShapeField.decodeTriangle(t, scratchTriangle);
 
     switch (scratchTriangle.type) {
-      case POINT: {
-        return encodedRectangle.contains(scratchTriangle.aX, scratchTriangle.aY);
-      }
-      case LINE: {
-        int aY = scratchTriangle.aY;
-        int aX = scratchTriangle.aX;
-        int bY = scratchTriangle.bY;
-        int bX = scratchTriangle.bX;
-        return encodedRectangle.intersectsLine(aX, aY, bX, bY);
-      }
-      case TRIANGLE: {
-        int aY = scratchTriangle.aY;
-        int aX = scratchTriangle.aX;
-        int bY = scratchTriangle.bY;
-        int bX = scratchTriangle.bX;
-        int cY = scratchTriangle.cY;
-        int cX = scratchTriangle.cX;
-        return encodedRectangle.intersectsTriangle(aX, aY, bX, bY, cX, cY);
-      }
-      default: throw new IllegalArgumentException("Unsupported triangle type :[" + scratchTriangle.type + "]");
+      case POINT:
+        {
+          return encodedRectangle.contains(scratchTriangle.aX, scratchTriangle.aY);
+        }
+      case LINE:
+        {
+          int aY = scratchTriangle.aY;
+          int aX = scratchTriangle.aX;
+          int bY = scratchTriangle.bY;
+          int bX = scratchTriangle.bX;
+          return encodedRectangle.intersectsLine(aX, aY, bX, bY);
+        }
+      case TRIANGLE:
+        {
+          int aY = scratchTriangle.aY;
+          int aX = scratchTriangle.aX;
+          int bY = scratchTriangle.bY;
+          int bX = scratchTriangle.bX;
+          int cY = scratchTriangle.cY;
+          int cX = scratchTriangle.cX;
+          return encodedRectangle.intersectsTriangle(aX, aY, bX, bY, cX, cY);
+        }
+      default:
+        throw new IllegalArgumentException(
+            "Unsupported triangle type :[" + scratchTriangle.type + "]");
     }
   }
 
@@ -92,58 +104,82 @@ final class LatLonShapeBoundingBoxQuery extends ShapeQuery {
     ShapeField.decodeTriangle(t, scratchTriangle);
 
     switch (scratchTriangle.type) {
-      case POINT: {
-        return encodedRectangle.contains(scratchTriangle.aX, scratchTriangle.aY);
-      }
-      case LINE: {
-        int aY = scratchTriangle.aY;
-        int aX = scratchTriangle.aX;
-        int bY = scratchTriangle.bY;
-        int bX = scratchTriangle.bX;
-        return encodedRectangle.containsLine(aX, aY, bX, bY);
-      }
-      case TRIANGLE: {
-        int aY = scratchTriangle.aY;
-        int aX = scratchTriangle.aX;
-        int bY = scratchTriangle.bY;
-        int bX = scratchTriangle.bX;
-        int cY = scratchTriangle.cY;
-        int cX = scratchTriangle.cX;
-        return encodedRectangle.containsTriangle(aX, aY, bX, bY, cX, cY);
-      }
-      default: throw new IllegalArgumentException("Unsupported triangle type :[" + scratchTriangle.type + "]");
+      case POINT:
+        {
+          return encodedRectangle.contains(scratchTriangle.aX, scratchTriangle.aY);
+        }
+      case LINE:
+        {
+          int aY = scratchTriangle.aY;
+          int aX = scratchTriangle.aX;
+          int bY = scratchTriangle.bY;
+          int bX = scratchTriangle.bX;
+          return encodedRectangle.containsLine(aX, aY, bX, bY);
+        }
+      case TRIANGLE:
+        {
+          int aY = scratchTriangle.aY;
+          int aX = scratchTriangle.aX;
+          int bY = scratchTriangle.bY;
+          int bX = scratchTriangle.bX;
+          int cY = scratchTriangle.cY;
+          int cX = scratchTriangle.cX;
+          return encodedRectangle.containsTriangle(aX, aY, bX, bY, cX, cY);
+        }
+      default:
+        throw new IllegalArgumentException(
+            "Unsupported triangle type :[" + scratchTriangle.type + "]");
     }
   }
 
   @Override
-  protected Component2D.WithinRelation queryWithin(byte[] t, ShapeField.DecodedTriangle scratchTriangle) {
+  protected Component2D.WithinRelation queryWithin(
+      byte[] t, ShapeField.DecodedTriangle scratchTriangle) {
     if (encodedRectangle.crossesDateline()) {
-      throw new IllegalArgumentException("withinTriangle is not supported for rectangles crossing the date line");
+      throw new IllegalArgumentException(
+          "withinTriangle is not supported for rectangles crossing the date line");
     }
     // decode indexed triangle
     ShapeField.decodeTriangle(t, scratchTriangle);
 
     switch (scratchTriangle.type) {
-      case POINT: {
-        return  encodedRectangle.contains(scratchTriangle.aX, scratchTriangle.aY) 
-                ? Component2D.WithinRelation.NOTWITHIN : Component2D.WithinRelation.DISJOINT;
-      }
-      case LINE: {
-        return encodedRectangle.withinLine(scratchTriangle.aX, scratchTriangle.aY, scratchTriangle.ab,
-            scratchTriangle.bX, scratchTriangle.bY);
-      }
-      case TRIANGLE: {
-        return encodedRectangle.withinTriangle(scratchTriangle.aX, scratchTriangle.aY, scratchTriangle.ab,
-            scratchTriangle.bX, scratchTriangle.bY, scratchTriangle.bc,
-            scratchTriangle.cX, scratchTriangle.cY, scratchTriangle.ca);
-      }
-      default: throw new IllegalArgumentException("Unsupported triangle type :[" + scratchTriangle.type + "]");
+      case POINT:
+        {
+          return encodedRectangle.contains(scratchTriangle.aX, scratchTriangle.aY)
+              ? Component2D.WithinRelation.NOTWITHIN
+              : Component2D.WithinRelation.DISJOINT;
+        }
+      case LINE:
+        {
+          return encodedRectangle.withinLine(
+              scratchTriangle.aX,
+              scratchTriangle.aY,
+              scratchTriangle.ab,
+              scratchTriangle.bX,
+              scratchTriangle.bY);
+        }
+      case TRIANGLE:
+        {
+          return encodedRectangle.withinTriangle(
+              scratchTriangle.aX,
+              scratchTriangle.aY,
+              scratchTriangle.ab,
+              scratchTriangle.bX,
+              scratchTriangle.bY,
+              scratchTriangle.bc,
+              scratchTriangle.cX,
+              scratchTriangle.cY,
+              scratchTriangle.ca);
+        }
+      default:
+        throw new IllegalArgumentException(
+            "Unsupported triangle type :[" + scratchTriangle.type + "]");
     }
   }
 
   @Override
   protected boolean equalsTo(Object o) {
-    return super.equalsTo(o) && rectangle.equals(((LatLonShapeBoundingBoxQuery)o).rectangle);
+    return super.equalsTo(o) && rectangle.equals(((LatLonShapeBoundingBoxQuery) o).rectangle);
   }
 
   @Override
@@ -184,7 +220,7 @@ final class LatLonShapeBoundingBoxQuery extends ShapeQuery {
       }
       this.minX = encodeLongitudeCeil(minLon);
       this.maxX = encodeLongitude(maxLon);
-      this.minY  = encodeLatitudeCeil(minLat);
+      this.minY = encodeLatitudeCeil(minLat);
       this.maxY = encodeLatitude(maxLat);
       this.crossesDateline = minLon > maxLon;
       if (this.crossesDateline) {
@@ -198,10 +234,9 @@ final class LatLonShapeBoundingBoxQuery extends ShapeQuery {
       }
     }
 
-    /**
-     * encodes a bounding box into the provided byte array
-     */
-    private static void encode(final int minX, final int maxX, final int minY, final int maxY, byte[] b) {
+    /** encodes a bounding box into the provided byte array */
+    private static void encode(
+        final int minX, final int maxX, final int minY, final int maxY, byte[] b) {
       if (b == null) {
         b = new byte[4 * BYTES];
       }
@@ -215,47 +250,71 @@ final class LatLonShapeBoundingBoxQuery extends ShapeQuery {
       return crossesDateline;
     }
 
-    /**
-     * compare this to a provided range bounding box
-     **/
-    Relation relateRangeBBox(int minXOffset, int minYOffset, byte[] minTriangle,
-                             int maxXOffset, int maxYOffset, byte[] maxTriangle) {
-      Relation eastRelation = compareBBoxToRangeBBox(this.bbox,
-          minXOffset, minYOffset, minTriangle, maxXOffset, maxYOffset, maxTriangle);
+    /** compare this to a provided range bounding box */
+    Relation relateRangeBBox(
+        int minXOffset,
+        int minYOffset,
+        byte[] minTriangle,
+        int maxXOffset,
+        int maxYOffset,
+        byte[] maxTriangle) {
+      Relation eastRelation =
+          compareBBoxToRangeBBox(
+              this.bbox, minXOffset, minYOffset, minTriangle, maxXOffset, maxYOffset, maxTriangle);
       if (this.crossesDateline() && eastRelation == Relation.CELL_OUTSIDE_QUERY) {
-        return compareBBoxToRangeBBox(this.west, minXOffset, minYOffset, minTriangle, maxXOffset, maxYOffset, maxTriangle);
+        return compareBBoxToRangeBBox(
+            this.west, minXOffset, minYOffset, minTriangle, maxXOffset, maxYOffset, maxTriangle);
       }
       return eastRelation;
     }
 
-    /**
-     * intersects this to a provided range bounding box
-     **/
-    Relation intersectRangeBBox(int minXOffset, int minYOffset, byte[] minTriangle,
-                                int maxXOffset, int maxYOffset, byte[] maxTriangle) {
-      Relation eastRelation = intersectBBoxWithRangeBBox(this.bbox,
-          minXOffset, minYOffset, minTriangle, maxXOffset, maxYOffset, maxTriangle);
+    /** intersects this to a provided range bounding box */
+    Relation intersectRangeBBox(
+        int minXOffset,
+        int minYOffset,
+        byte[] minTriangle,
+        int maxXOffset,
+        int maxYOffset,
+        byte[] maxTriangle) {
+      Relation eastRelation =
+          intersectBBoxWithRangeBBox(
+              this.bbox, minXOffset, minYOffset, minTriangle, maxXOffset, maxYOffset, maxTriangle);
       if (this.crossesDateline() && eastRelation == Relation.CELL_OUTSIDE_QUERY) {
-        return intersectBBoxWithRangeBBox(this.west, minXOffset, minYOffset, minTriangle, maxXOffset, maxYOffset, maxTriangle);
+        return intersectBBoxWithRangeBBox(
+            this.west, minXOffset, minYOffset, minTriangle, maxXOffset, maxYOffset, maxTriangle);
       }
       return eastRelation;
     }
 
     /**
-     * static utility method to compare a bbox with a range of triangles (just the bbox of the triangle collection)
-     **/
-    private static Relation compareBBoxToRangeBBox(final byte[] bbox,
-                                                   int minXOffset, int minYOffset, byte[] minTriangle,
-                                                   int maxXOffset, int maxYOffset, byte[] maxTriangle) {
+     * static utility method to compare a bbox with a range of triangles (just the bbox of the
+     * triangle collection)
+     */
+    private static Relation compareBBoxToRangeBBox(
+        final byte[] bbox,
+        int minXOffset,
+        int minYOffset,
+        byte[] minTriangle,
+        int maxXOffset,
+        int maxYOffset,
+        byte[] maxTriangle) {
       // check bounding box (DISJOINT)
-      if (disjoint(bbox, minXOffset, minYOffset, minTriangle, maxXOffset, maxYOffset, maxTriangle)) {
+      if (disjoint(
+          bbox, minXOffset, minYOffset, minTriangle, maxXOffset, maxYOffset, maxTriangle)) {
         return Relation.CELL_OUTSIDE_QUERY;
       }
 
-      if (Arrays.compareUnsigned(minTriangle, minXOffset, minXOffset + BYTES, bbox, BYTES, 2 * BYTES) >= 0 &&
-          Arrays.compareUnsigned(maxTriangle, maxXOffset, maxXOffset + BYTES, bbox, 3 * BYTES, 4 * BYTES) <= 0 &&
-          Arrays.compareUnsigned(minTriangle, minYOffset, minYOffset + BYTES, bbox, 0, BYTES) >= 0 &&
-          Arrays.compareUnsigned(maxTriangle, maxYOffset, maxYOffset + BYTES, bbox, 2 * BYTES, 3 * BYTES) <= 0) {
+      if (Arrays.compareUnsigned(
+                  minTriangle, minXOffset, minXOffset + BYTES, bbox, BYTES, 2 * BYTES)
+              >= 0
+          && Arrays.compareUnsigned(
+                  maxTriangle, maxXOffset, maxXOffset + BYTES, bbox, 3 * BYTES, 4 * BYTES)
+              <= 0
+          && Arrays.compareUnsigned(minTriangle, minYOffset, minYOffset + BYTES, bbox, 0, BYTES)
+              >= 0
+          && Arrays.compareUnsigned(
+                  maxTriangle, maxYOffset, maxYOffset + BYTES, bbox, 2 * BYTES, 3 * BYTES)
+              <= 0) {
         return Relation.CELL_INSIDE_QUERY;
       }
 
@@ -263,37 +322,64 @@ final class LatLonShapeBoundingBoxQuery extends ShapeQuery {
     }
 
     /**
-     * static utility method to compare a bbox with a range of triangles (just the bbox of the triangle collection)
-     * for intersection
-     **/
-    private static Relation intersectBBoxWithRangeBBox(final byte[] bbox,
-                                                       int minXOffset, int minYOffset, byte[] minTriangle,
-                                                       int maxXOffset, int maxYOffset, byte[] maxTriangle) {
+     * static utility method to compare a bbox with a range of triangles (just the bbox of the
+     * triangle collection) for intersection
+     */
+    private static Relation intersectBBoxWithRangeBBox(
+        final byte[] bbox,
+        int minXOffset,
+        int minYOffset,
+        byte[] minTriangle,
+        int maxXOffset,
+        int maxYOffset,
+        byte[] maxTriangle) {
       // check bounding box (DISJOINT)
-      if (disjoint(bbox, minXOffset, minYOffset, minTriangle, maxXOffset, maxYOffset, maxTriangle)) {
+      if (disjoint(
+          bbox, minXOffset, minYOffset, minTriangle, maxXOffset, maxYOffset, maxTriangle)) {
         return Relation.CELL_OUTSIDE_QUERY;
       }
 
-      if (Arrays.compareUnsigned(minTriangle, minXOffset, minXOffset + BYTES, bbox, BYTES, 2 * BYTES) >= 0 &&
-          Arrays.compareUnsigned(minTriangle, minYOffset, minYOffset + BYTES, bbox, 0, BYTES) >= 0) {
-        if (Arrays.compareUnsigned(maxTriangle, minXOffset, minXOffset + BYTES, bbox, 3 * BYTES, 4 * BYTES) <= 0 &&
-            Arrays.compareUnsigned(maxTriangle, maxYOffset, maxYOffset + BYTES, bbox, 2 * BYTES, 3 * BYTES) <= 0) {
+      if (Arrays.compareUnsigned(
+                  minTriangle, minXOffset, minXOffset + BYTES, bbox, BYTES, 2 * BYTES)
+              >= 0
+          && Arrays.compareUnsigned(minTriangle, minYOffset, minYOffset + BYTES, bbox, 0, BYTES)
+              >= 0) {
+        if (Arrays.compareUnsigned(
+                    maxTriangle, minXOffset, minXOffset + BYTES, bbox, 3 * BYTES, 4 * BYTES)
+                <= 0
+            && Arrays.compareUnsigned(
+                    maxTriangle, maxYOffset, maxYOffset + BYTES, bbox, 2 * BYTES, 3 * BYTES)
+                <= 0) {
           return Relation.CELL_INSIDE_QUERY;
         }
-        if (Arrays.compareUnsigned(maxTriangle, maxXOffset, maxXOffset + BYTES, bbox, 3 * BYTES, 4 * BYTES) <= 0 &&
-            Arrays.compareUnsigned(maxTriangle, minYOffset, minYOffset + BYTES, bbox, 2 * BYTES, 3 * BYTES) <= 0) {
+        if (Arrays.compareUnsigned(
+                    maxTriangle, maxXOffset, maxXOffset + BYTES, bbox, 3 * BYTES, 4 * BYTES)
+                <= 0
+            && Arrays.compareUnsigned(
+                    maxTriangle, minYOffset, minYOffset + BYTES, bbox, 2 * BYTES, 3 * BYTES)
+                <= 0) {
           return Relation.CELL_INSIDE_QUERY;
         }
       }
 
-      if (Arrays.compareUnsigned(maxTriangle, maxXOffset, maxXOffset + BYTES, bbox, 3 * BYTES, 4 * BYTES) <= 0 &&
-          Arrays.compareUnsigned(maxTriangle, maxYOffset, maxYOffset + BYTES, bbox, 2 * BYTES, 3 * BYTES) <= 0) {
-        if (Arrays.compareUnsigned(minTriangle, minXOffset, minXOffset + BYTES, bbox, BYTES, 2 * BYTES) >= 0 &&
-            Arrays.compareUnsigned(minTriangle, maxYOffset, maxYOffset + BYTES, bbox, 0, BYTES) >= 0) {
+      if (Arrays.compareUnsigned(
+                  maxTriangle, maxXOffset, maxXOffset + BYTES, bbox, 3 * BYTES, 4 * BYTES)
+              <= 0
+          && Arrays.compareUnsigned(
+                  maxTriangle, maxYOffset, maxYOffset + BYTES, bbox, 2 * BYTES, 3 * BYTES)
+              <= 0) {
+        if (Arrays.compareUnsigned(
+                    minTriangle, minXOffset, minXOffset + BYTES, bbox, BYTES, 2 * BYTES)
+                >= 0
+            && Arrays.compareUnsigned(minTriangle, maxYOffset, maxYOffset + BYTES, bbox, 0, BYTES)
+                >= 0) {
           return Relation.CELL_INSIDE_QUERY;
         }
-        if (Arrays.compareUnsigned(minTriangle, maxXOffset, maxXOffset + BYTES, bbox, BYTES, 2 * BYTES) >= 0 &&
-            Arrays.compareUnsigned(minTriangle, minYOffset, minYOffset + BYTES, bbox, 0, BYTES) >= 0) {
+        if (Arrays.compareUnsigned(
+                    minTriangle, maxXOffset, maxXOffset + BYTES, bbox, BYTES, 2 * BYTES)
+                >= 0
+            && Arrays.compareUnsigned(minTriangle, minYOffset, minYOffset + BYTES, bbox, 0, BYTES)
+                >= 0) {
           return Relation.CELL_INSIDE_QUERY;
         }
       }
@@ -301,21 +387,29 @@ final class LatLonShapeBoundingBoxQuery extends ShapeQuery {
       return Relation.CELL_CROSSES_QUERY;
     }
 
-    /**
-     * static utility method to check a bbox is disjoint with a range of triangles
-     **/
-    private static boolean disjoint(final byte[] bbox,
-                                    int minXOffset, int minYOffset, byte[] minTriangle,
-                                    int maxXOffset, int maxYOffset, byte[] maxTriangle) {
-      return Arrays.compareUnsigned(minTriangle, minXOffset, minXOffset + BYTES, bbox, 3 * BYTES, 4 * BYTES) > 0 ||
-             Arrays.compareUnsigned(maxTriangle, maxXOffset, maxXOffset + BYTES, bbox, BYTES, 2 * BYTES) < 0 ||
-             Arrays.compareUnsigned(minTriangle, minYOffset, minYOffset + BYTES, bbox, 2 * BYTES, 3 * BYTES) > 0 ||
-             Arrays.compareUnsigned(maxTriangle, maxYOffset, maxYOffset + BYTES, bbox, 0, BYTES) < 0;
+    /** static utility method to check a bbox is disjoint with a range of triangles */
+    private static boolean disjoint(
+        final byte[] bbox,
+        int minXOffset,
+        int minYOffset,
+        byte[] minTriangle,
+        int maxXOffset,
+        int maxYOffset,
+        byte[] maxTriangle) {
+      return Arrays.compareUnsigned(
+                  minTriangle, minXOffset, minXOffset + BYTES, bbox, 3 * BYTES, 4 * BYTES)
+              > 0
+          || Arrays.compareUnsigned(
+                  maxTriangle, maxXOffset, maxXOffset + BYTES, bbox, BYTES, 2 * BYTES)
+              < 0
+          || Arrays.compareUnsigned(
+                  minTriangle, minYOffset, minYOffset + BYTES, bbox, 2 * BYTES, 3 * BYTES)
+              > 0
+          || Arrays.compareUnsigned(maxTriangle, maxYOffset, maxYOffset + BYTES, bbox, 0, BYTES)
+              < 0;
     }
 
-    /**
-     * Checks if the rectangle contains the provided point
-     **/
+    /** Checks if the rectangle contains the provided point */
     boolean contains(int x, int y) {
       if (y < minY || y > maxY) {
         return false;
@@ -327,9 +421,7 @@ final class LatLonShapeBoundingBoxQuery extends ShapeQuery {
       }
     }
 
-    /**
-     * Checks if the rectangle intersects the provided LINE
-     **/
+    /** Checks if the rectangle intersects the provided LINE */
     boolean intersectsLine(int aX, int aY, int bX, int bY) {
       if (contains(aX, aY) || contains(bX, bY)) {
         return true;
@@ -351,9 +443,7 @@ final class LatLonShapeBoundingBoxQuery extends ShapeQuery {
       return edgeIntersectsQuery(aX, aY, bX, bY);
     }
 
-    /**
-     * Checks if the rectangle intersects the provided triangle
-     **/
+    /** Checks if the rectangle intersects the provided triangle */
     boolean intersectsTriangle(int aX, int aY, int bX, int bY, int cX, int cY) {
       // query contains any triangle points
       if (contains(aX, aY) || contains(bX, bY) || contains(cX, cY)) {
@@ -378,60 +468,48 @@ final class LatLonShapeBoundingBoxQuery extends ShapeQuery {
         }
       }
       // expensive part
-      return Component2D.pointInTriangle(tMinX, tMaxX, tMinY, tMaxY, minX, minY, aX, aY, bX, bY, cX, cY) ||
-             edgeIntersectsQuery(aX, aY, bX, bY) ||
-             edgeIntersectsQuery(bX, bY, cX, cY) ||
-             edgeIntersectsQuery(cX, cY, aX, aY);
+      return Component2D.pointInTriangle(
+              tMinX, tMaxX, tMinY, tMaxY, minX, minY, aX, aY, bX, bY, cX, cY)
+          || edgeIntersectsQuery(aX, aY, bX, bY)
+          || edgeIntersectsQuery(bX, bY, cX, cY)
+          || edgeIntersectsQuery(cX, cY, aX, aY);
     }
 
-    /**
-     * Checks if the rectangle contains the provided LINE
-     **/
+    /** Checks if the rectangle contains the provided LINE */
     boolean containsLine(int aX, int aY, int bX, int bY) {
-      if (aY < minY || bY < minY ||
-          aY > maxY || bY > maxY ) {
+      if (aY < minY || bY < minY || aY > maxY || bY > maxY) {
         return false;
       }
       if (crossesDateline) { // crosses dateline
-        return (aX >= minX && bX >= minX) ||
-               (aX <= maxX && bX <= maxX);
+        return (aX >= minX && bX >= minX) || (aX <= maxX && bX <= maxX);
       } else {
-        return aX >= minX && bX >= minX &&
-               aX <= maxX && bX <= maxX;
+        return aX >= minX && bX >= minX && aX <= maxX && bX <= maxX;
       }
     }
 
-    /**
-     * Checks if the rectangle contains the provided triangle
-     **/
+    /** Checks if the rectangle contains the provided triangle */
     boolean containsTriangle(int aX, int aY, int bX, int bY, int cX, int cY) {
-      if (aY < minY || bY < minY || cY < minY ||
-          aY > maxY || bY > maxY || cY > maxY) {
+      if (aY < minY || bY < minY || cY < minY || aY > maxY || bY > maxY || cY > maxY) {
         return false;
       }
       if (crossesDateline) { // crosses dateline
-        return (aX >= minX && bX >= minX && cX >= minX) ||
-               (aX <= maxX && bX <= maxX && cX <= maxX);
+        return (aX >= minX && bX >= minX && cX >= minX) || (aX <= maxX && bX <= maxX && cX <= maxX);
       } else {
-        return aX >= minX && bX >= minX && cX >= minX &&
-               aX <= maxX && bX <= maxX && cX <= maxX;
+        return aX >= minX && bX >= minX && cX >= minX && aX <= maxX && bX <= maxX && cX <= maxX;
       }
     }
 
-    /**
-     * Returns the Within relation to the provided triangle
-     */
+    /** Returns the Within relation to the provided triangle */
     Component2D.WithinRelation withinLine(int ax, int ay, boolean ab, int bx, int by) {
       if (ab == true && edgeIntersectsBox(ax, ay, bx, by, minX, maxX, minY, maxY) == true) {
-          return Component2D.WithinRelation.NOTWITHIN;
+        return Component2D.WithinRelation.NOTWITHIN;
       }
       return Component2D.WithinRelation.DISJOINT;
     }
 
-    /**
-     * Returns the Within relation to the provided triangle
-     */
-    Component2D.WithinRelation withinTriangle(int aX, int aY, boolean ab, int bX, int bY, boolean bc, int cX, int cY, boolean ca) {
+    /** Returns the Within relation to the provided triangle */
+    Component2D.WithinRelation withinTriangle(
+        int aX, int aY, boolean ab, int bX, int bY, boolean bc, int cX, int cY, boolean ca) {
       // Points belong to the shape so if points are inside the rectangle then it cannot be within.
       if (contains(aX, aY) || contains(bX, bY) || contains(cX, cY)) {
         return Component2D.WithinRelation.NOTWITHIN;
@@ -480,16 +558,15 @@ final class LatLonShapeBoundingBoxQuery extends ShapeQuery {
         }
       }
       // Check if shape is within the triangle
-      if (relation == Component2D.WithinRelation.CANDIDATE ||
-          Component2D.pointInTriangle(tMinX, tMaxX, tMinY, tMaxY, minX, minY, aX, aY, bX, bY, cX, cY)) {
+      if (relation == Component2D.WithinRelation.CANDIDATE
+          || Component2D.pointInTriangle(
+              tMinX, tMaxX, tMinY, tMaxY, minX, minY, aX, aY, bX, bY, cX, cY)) {
         return Component2D.WithinRelation.CANDIDATE;
       }
       return relation;
     }
 
-    /**
-     * returns true if the edge (defined by (aX, aY) (bX, bY)) intersects the query
-     */
+    /** returns true if the edge (defined by (aX, aY) (bX, bY)) intersects the query */
     private boolean edgeIntersectsQuery(int aX, int aY, int bX, int bY) {
       if (crossesDateline) {
         return edgeIntersectsBox(aX, aY, bX, bY, MIN_LON_ENCODED, this.maxX, this.minY, this.maxY)
@@ -498,18 +575,22 @@ final class LatLonShapeBoundingBoxQuery extends ShapeQuery {
       return edgeIntersectsBox(aX, aY, bX, bY, this.minX, this.maxX, this.minY, this.maxY);
     }
 
-    /**
-     * returns true if the edge (defined by (aX, aY) (bX, bY)) intersects the box
-     */
-    private static boolean edgeIntersectsBox(int aX, int aY, int bX, int bY,
-                                             int minX, int maxX, int minY, int maxY) {
-      if (Math.max(aX, bX) < minX || Math.min(aX, bX) > maxX || Math.min(aY, bY) > maxY || Math.max(aY, bY) < minY) {
+    /** returns true if the edge (defined by (aX, aY) (bX, bY)) intersects the box */
+    private static boolean edgeIntersectsBox(
+        int aX, int aY, int bX, int bY, int minX, int maxX, int minY, int maxY) {
+      if (Math.max(aX, bX) < minX
+          || Math.min(aX, bX) > maxX
+          || Math.min(aY, bY) > maxY
+          || Math.max(aY, bY) < minY) {
         return false;
       }
-      return GeoUtils.lineCrossesLineWithBoundary(aX, aY, bX, bY, minX, maxY,  maxX, maxY) || // top
-             GeoUtils.lineCrossesLineWithBoundary(aX, aY, bX, bY, maxX, maxY,  maxX, minY) || // bottom
-             GeoUtils.lineCrossesLineWithBoundary(aX, aY, bX, bY, maxX, minY,  minX, minY) || // left
-             GeoUtils.lineCrossesLineWithBoundary(aX, aY, bX, bY, minX, minY,  minX, maxY);   // right
+      return GeoUtils.lineCrossesLineWithBoundary(aX, aY, bX, bY, minX, maxY, maxX, maxY)
+          || // top
+          GeoUtils.lineCrossesLineWithBoundary(aX, aY, bX, bY, maxX, maxY, maxX, minY)
+          || // bottom
+          GeoUtils.lineCrossesLineWithBoundary(aX, aY, bX, bY, maxX, minY, minX, minY)
+          || // left
+          GeoUtils.lineCrossesLineWithBoundary(aX, aY, bX, bY, minX, minY, minX, maxY); // right
     }
   }
 }
diff --git a/lucene/core/src/java/org/apache/lucene/document/LatLonShapeQuery.java b/lucene/core/src/java/org/apache/lucene/document/LatLonShapeQuery.java
index 400a6f2..5b7ed54 100644
--- a/lucene/core/src/java/org/apache/lucene/document/LatLonShapeQuery.java
+++ b/lucene/core/src/java/org/apache/lucene/document/LatLonShapeQuery.java
@@ -17,7 +17,6 @@
 package org.apache.lucene.document;
 
 import java.util.Arrays;
-
 import org.apache.lucene.document.ShapeField.QueryRelation;
 import org.apache.lucene.geo.Component2D;
 import org.apache.lucene.geo.GeoEncodingUtils;
@@ -31,11 +30,10 @@ import org.apache.lucene.util.NumericUtils;
  * the specified array of {@link LatLonGeometry}.
  *
  * <p>The field must be indexed using {@link LatLonShape#createIndexableFields} added per document.
- *
- **/
+ */
 final class LatLonShapeQuery extends ShapeQuery {
-  final private LatLonGeometry[] geometries;
-  final private Component2D component2D;
+  private final LatLonGeometry[] geometries;
+  private final Component2D component2D;
 
   /**
    * Creates a query that matches all indexed shapes to the provided array of {@link LatLonGeometry}
@@ -46,23 +44,34 @@ final class LatLonShapeQuery extends ShapeQuery {
       for (LatLonGeometry geometry : geometries) {
         if (geometry instanceof Line) {
           // TODO: line queries do not support within relations
-          throw new IllegalArgumentException("LatLonShapeQuery does not support " + QueryRelation.WITHIN + " queries with line geometries");
+          throw new IllegalArgumentException(
+              "LatLonShapeQuery does not support "
+                  + QueryRelation.WITHIN
+                  + " queries with line geometries");
         }
       }
-
     }
     this.component2D = LatLonGeometry.create(geometries);
     this.geometries = geometries.clone();
   }
 
   @Override
-  protected Relation relateRangeBBoxToQuery(int minXOffset, int minYOffset, byte[] minTriangle,
-                                            int maxXOffset, int maxYOffset, byte[] maxTriangle) {
-
-    double minLat = GeoEncodingUtils.decodeLatitude(NumericUtils.sortableBytesToInt(minTriangle, minYOffset));
-    double minLon = GeoEncodingUtils.decodeLongitude(NumericUtils.sortableBytesToInt(minTriangle, minXOffset));
-    double maxLat = GeoEncodingUtils.decodeLatitude(NumericUtils.sortableBytesToInt(maxTriangle, maxYOffset));
-    double maxLon = GeoEncodingUtils.decodeLongitude(NumericUtils.sortableBytesToInt(maxTriangle, maxXOffset));
+  protected Relation relateRangeBBoxToQuery(
+      int minXOffset,
+      int minYOffset,
+      byte[] minTriangle,
+      int maxXOffset,
+      int maxYOffset,
+      byte[] maxTriangle) {
+
+    double minLat =
+        GeoEncodingUtils.decodeLatitude(NumericUtils.sortableBytesToInt(minTriangle, minYOffset));
+    double minLon =
+        GeoEncodingUtils.decodeLongitude(NumericUtils.sortableBytesToInt(minTriangle, minXOffset));
+    double maxLat =
+        GeoEncodingUtils.decodeLatitude(NumericUtils.sortableBytesToInt(maxTriangle, maxYOffset));
+    double maxLon =
+        GeoEncodingUtils.decodeLongitude(NumericUtils.sortableBytesToInt(maxTriangle, maxXOffset));
 
     // check internal node against query
     return component2D.relate(minLon, maxLon, minLat, maxLat);
@@ -73,28 +82,33 @@ final class LatLonShapeQuery extends ShapeQuery {
     ShapeField.decodeTriangle(t, scratchTriangle);
 
     switch (scratchTriangle.type) {
-      case POINT: {
-        double alat = GeoEncodingUtils.decodeLatitude(scratchTriangle.aY);
-        double alon = GeoEncodingUtils.decodeLongitude(scratchTriangle.aX);
-        return component2D.contains(alon, alat);
-      }
-      case LINE: {
-        double alat = GeoEncodingUtils.decodeLatitude(scratchTriangle.aY);
-        double alon = GeoEncodingUtils.decodeLongitude(scratchTriangle.aX);
-        double blat = GeoEncodingUtils.decodeLatitude(scratchTriangle.bY);
-        double blon = GeoEncodingUtils.decodeLongitude(scratchTriangle.bX);
-        return component2D.intersectsLine(alon, alat, blon, blat);
-      }
-      case TRIANGLE: {
-        double alat = GeoEncodingUtils.decodeLatitude(scratchTriangle.aY);
-        double alon = GeoEncodingUtils.decodeLongitude(scratchTriangle.aX);
-        double blat = GeoEncodingUtils.decodeLatitude(scratchTriangle.bY);
-        double blon = GeoEncodingUtils.decodeLongitude(scratchTriangle.bX);
-        double clat = GeoEncodingUtils.decodeLatitude(scratchTriangle.cY);
-        double clon = GeoEncodingUtils.decodeLongitude(scratchTriangle.cX);
-        return component2D.intersectsTriangle(alon, alat, blon, blat, clon, clat);
-      }
-      default: throw new IllegalArgumentException("Unsupported triangle type :[" + scratchTriangle.type + "]");
+      case POINT:
+        {
+          double alat = GeoEncodingUtils.decodeLatitude(scratchTriangle.aY);
+          double alon = GeoEncodingUtils.decodeLongitude(scratchTriangle.aX);
+          return component2D.contains(alon, alat);
+        }
+      case LINE:
+        {
+          double alat = GeoEncodingUtils.decodeLatitude(scratchTriangle.aY);
+          double alon = GeoEncodingUtils.decodeLongitude(scratchTriangle.aX);
+          double blat = GeoEncodingUtils.decodeLatitude(scratchTriangle.bY);
+          double blon = GeoEncodingUtils.decodeLongitude(scratchTriangle.bX);
+          return component2D.intersectsLine(alon, alat, blon, blat);
+        }
+      case TRIANGLE:
+        {
+          double alat = GeoEncodingUtils.decodeLatitude(scratchTriangle.aY);
+          double alon = GeoEncodingUtils.decodeLongitude(scratchTriangle.aX);
+          double blat = GeoEncodingUtils.decodeLatitude(scratchTriangle.bY);
+          double blon = GeoEncodingUtils.decodeLongitude(scratchTriangle.bX);
+          double clat = GeoEncodingUtils.decodeLatitude(scratchTriangle.cY);
+          double clon = GeoEncodingUtils.decodeLongitude(scratchTriangle.cX);
+          return component2D.intersectsTriangle(alon, alat, blon, blat, clon, clat);
+        }
+      default:
+        throw new IllegalArgumentException(
+            "Unsupported triangle type :[" + scratchTriangle.type + "]");
     }
   }
 
@@ -103,58 +117,78 @@ final class LatLonShapeQuery extends ShapeQuery {
     ShapeField.decodeTriangle(t, scratchTriangle);
 
     switch (scratchTriangle.type) {
-      case POINT: {
-        double alat = GeoEncodingUtils.decodeLatitude(scratchTriangle.aY);
-        double alon = GeoEncodingUtils.decodeLongitude(scratchTriangle.aX);
-        return component2D.contains(alon, alat);
-      }
-      case LINE: {
-        double alat = GeoEncodingUtils.decodeLatitude(scratchTriangle.aY);
-        double alon = GeoEncodingUtils.decodeLongitude(scratchTriangle.aX);
-        double blat = GeoEncodingUtils.decodeLatitude(scratchTriangle.bY);
-        double blon = GeoEncodingUtils.decodeLongitude(scratchTriangle.bX);
-        return component2D.containsLine(alon, alat, blon, blat);
-      }
-      case TRIANGLE: {
-        double alat = GeoEncodingUtils.decodeLatitude(scratchTriangle.aY);
-        double alon = GeoEncodingUtils.decodeLongitude(scratchTriangle.aX);
-        double blat = GeoEncodingUtils.decodeLatitude(scratchTriangle.bY);
-        double blon = GeoEncodingUtils.decodeLongitude(scratchTriangle.bX);
-        double clat = GeoEncodingUtils.decodeLatitude(scratchTriangle.cY);
-        double clon = GeoEncodingUtils.decodeLongitude(scratchTriangle.cX);
-        return component2D.containsTriangle(alon, alat, blon, blat, clon, clat);
-      }
-      default: throw new IllegalArgumentException("Unsupported triangle type :[" + scratchTriangle.type + "]");
+      case POINT:
+        {
+          double alat = GeoEncodingUtils.decodeLatitude(scratchTriangle.aY);
+          double alon = GeoEncodingUtils.decodeLongitude(scratchTriangle.aX);
+          return component2D.contains(alon, alat);
+        }
+      case LINE:
+        {
+          double alat = GeoEncodingUtils.decodeLatitude(scratchTriangle.aY);
+          double alon = GeoEncodingUtils.decodeLongitude(scratchTriangle.aX);
+          double blat = GeoEncodingUtils.decodeLatitude(scratchTriangle.bY);
+          double blon = GeoEncodingUtils.decodeLongitude(scratchTriangle.bX);
+          return component2D.containsLine(alon, alat, blon, blat);
+        }
+      case TRIANGLE:
+        {
+          double alat = GeoEncodingUtils.decodeLatitude(scratchTriangle.aY);
+          double alon = GeoEncodingUtils.decodeLongitude(scratchTriangle.aX);
+          double blat = GeoEncodingUtils.decodeLatitude(scratchTriangle.bY);
+          double blon = GeoEncodingUtils.decodeLongitude(scratchTriangle.bX);
+          double clat = GeoEncodingUtils.decodeLatitude(scratchTriangle.cY);
+          double clon = GeoEncodingUtils.decodeLongitude(scratchTriangle.cX);
+          return component2D.containsTriangle(alon, alat, blon, blat, clon, clat);
+        }
+      default:
+        throw new IllegalArgumentException(
+            "Unsupported triangle type :[" + scratchTriangle.type + "]");
     }
   }
 
   @Override
-  protected Component2D.WithinRelation queryWithin(byte[] t, ShapeField.DecodedTriangle scratchTriangle) {
+  protected Component2D.WithinRelation queryWithin(
+      byte[] t, ShapeField.DecodedTriangle scratchTriangle) {
     ShapeField.decodeTriangle(t, scratchTriangle);
 
     switch (scratchTriangle.type) {
-      case POINT: {
-        double alat = GeoEncodingUtils.decodeLatitude(scratchTriangle.aY);
-        double alon = GeoEncodingUtils.decodeLongitude(scratchTriangle.aX);
-        return component2D.withinPoint(alon, alat);
-      }
-      case LINE: {
-        double alat = GeoEncodingUtils.decodeLatitude(scratchTriangle.aY);
-        double alon = GeoEncodingUtils.decodeLongitude(scratchTriangle.aX);
-        double blat = GeoEncodingUtils.decodeLatitude(scratchTriangle.bY);
-        double blon = GeoEncodingUtils.decodeLongitude(scratchTriangle.bX);
-        return component2D.withinLine(alon, alat, scratchTriangle.ab, blon, blat);
-      }
-      case TRIANGLE: {
-        double alat = GeoEncodingUtils.decodeLatitude(scratchTriangle.aY);
-        double alon = GeoEncodingUtils.decodeLongitude(scratchTriangle.aX);
-        double blat = GeoEncodingUtils.decodeLatitude(scratchTriangle.bY);
-        double blon = GeoEncodingUtils.decodeLongitude(scratchTriangle.bX);
-        double clat = GeoEncodingUtils.decodeLatitude(scratchTriangle.cY);
-        double clon = GeoEncodingUtils.decodeLongitude(scratchTriangle.cX);
-        return component2D.withinTriangle(alon, alat, scratchTriangle.ab, blon, blat, scratchTriangle.bc, clon, clat, scratchTriangle.ca);
-      }
-      default: throw new IllegalArgumentException("Unsupported triangle type :[" + scratchTriangle.type + "]");
+      case POINT:
+        {
+          double alat = GeoEncodingUtils.decodeLatitude(scratchTriangle.aY);
+          double alon = GeoEncodingUtils.decodeLongitude(scratchTriangle.aX);
+          return component2D.withinPoint(alon, alat);
+        }
+      case LINE:
+        {
+          double alat = GeoEncodingUtils.decodeLatitude(scratchTriangle.aY);
+          double alon = GeoEncodingUtils.decodeLongitude(scratchTriangle.aX);
+          double blat = GeoEncodingUtils.decodeLatitude(scratchTriangle.bY);
+          double blon = GeoEncodingUtils.decodeLongitude(scratchTriangle.bX);
+          return component2D.withinLine(alon, alat, scratchTriangle.ab, blon, blat);
+        }
+      case TRIANGLE:
+        {
+          double alat = GeoEncodingUtils.decodeLatitude(scratchTriangle.aY);
+          double alon = GeoEncodingUtils.decodeLongitude(scratchTriangle.aX);
+          double blat = GeoEncodingUtils.decodeLatitude(scratchTriangle.bY);
+          double blon = GeoEncodingUtils.decodeLongitude(scratchTriangle.bX);
+          double clat = GeoEncodingUtils.decodeLatitude(scratchTriangle.cY);
+          double clon = GeoEncodingUtils.decodeLongitude(scratchTriangle.cX);
+          return component2D.withinTriangle(
+              alon,
+              alat,
+              scratchTriangle.ab,
+              blon,
+              blat,
+              scratchTriangle.bc,
+              clon,
+              clat,
+              scratchTriangle.ca);
+        }
+      default:
+        throw new IllegalArgumentException(
+            "Unsupported triangle type :[" + scratchTriangle.type + "]");
     }
   }
 
@@ -179,7 +213,7 @@ final class LatLonShapeQuery extends ShapeQuery {
 
   @Override
   protected boolean equalsTo(Object o) {
-    return super.equalsTo(o) && Arrays.equals(geometries, ((LatLonShapeQuery)o).geometries);
+    return super.equalsTo(o) && Arrays.equals(geometries, ((LatLonShapeQuery) o).geometries);
   }
 
   @Override
@@ -188,4 +222,4 @@ final class LatLonShapeQuery extends ShapeQuery {
     hash = 31 * hash + Arrays.hashCode(geometries);
     return hash;
   }
-}
\ No newline at end of file
+}
diff --git a/lucene/core/src/java/org/apache/lucene/document/LongDistanceFeatureQuery.java b/lucene/core/src/java/org/apache/lucene/document/LongDistanceFeatureQuery.java
index 0b4c365..bda1112 100644
--- a/lucene/core/src/java/org/apache/lucene/document/LongDistanceFeatureQuery.java
+++ b/lucene/core/src/java/org/apache/lucene/document/LongDistanceFeatureQuery.java
@@ -19,7 +19,6 @@ package org.apache.lucene.document;
 import java.io.IOException;
 import java.util.Arrays;
 import java.util.Objects;
-
 import org.apache.lucene.index.DocValues;
 import org.apache.lucene.index.LeafReaderContext;
 import org.apache.lucene.index.NumericDocValues;
@@ -55,14 +54,13 @@ final class LongDistanceFeatureQuery extends Query {
 
   @Override
   public final boolean equals(Object o) {
-    return sameClassAs(o) &&
-        equalsTo(getClass().cast(o));
+    return sameClassAs(o) && equalsTo(getClass().cast(o));
   }
 
   private boolean equalsTo(LongDistanceFeatureQuery other) {
-    return Objects.equals(field, other.field) &&
-        origin == other.origin &&
-        pivotDistance == other.pivotDistance;
+    return Objects.equals(field, other.field)
+        && origin == other.origin
+        && pivotDistance == other.pivotDistance;
   }
 
   @Override
@@ -83,11 +81,19 @@ final class LongDistanceFeatureQuery extends Query {
 
   @Override
   public String toString(String field) {
-    return getClass().getSimpleName() + "(field=" + field + ",origin=" + origin + ",pivotDistance=" + pivotDistance + ")";
+    return getClass().getSimpleName()
+        + "(field="
+        + field
+        + ",origin="
+        + origin
+        + ",pivotDistance="
+        + pivotDistance
+        + ")";
   }
 
   @Override
-  public Weight createWeight(IndexSearcher searcher, ScoreMode scoreMode, float boost) throws IOException {
+  public Weight createWeight(IndexSearcher searcher, ScoreMode scoreMode, float boost)
+      throws IOException {
     return new Weight(this) {
 
       @Override
@@ -99,7 +105,8 @@ final class LongDistanceFeatureQuery extends Query {
       public Explanation explain(LeafReaderContext context, int doc) throws IOException {
         SortedNumericDocValues multiDocValues = DocValues.getSortedNumeric(context.reader(), field);
         if (multiDocValues.advanceExact(doc) == false) {
-          return Explanation.noMatch("Document " + doc + " doesn't have a value for field " + field);
+          return Explanation.noMatch(
+              "Document " + doc + " doesn't have a value for field " + field);
         }
         long value = selectValue(multiDocValues);
         long distance = Math.max(value, origin) - Math.min(value, origin);
@@ -108,7 +115,9 @@ final class LongDistanceFeatureQuery extends Query {
           distance = Long.MAX_VALUE;
         }
         float score = (float) (boost * (pivotDistance / (pivotDistance + (double) distance)));
-        return Explanation.match(score, "Distance score, computed as weight * pivotDistance / (pivotDistance + abs(value - origin)) from:",
+        return Explanation.match(
+            score,
+            "Distance score, computed as weight * pivotDistance / (pivotDistance + abs(value - origin)) from:",
             Explanation.match(boost, "weight"),
             Explanation.match(pivotDistance, "pivotDistance"),
             Explanation.match(origin, "origin"),
@@ -145,7 +154,7 @@ final class LongDistanceFeatureQuery extends Query {
         if (singleton != null) {
           return singleton;
         }
-        return  new NumericDocValues() {
+        return new NumericDocValues() {
 
           long value;
 
@@ -183,7 +192,6 @@ final class LongDistanceFeatureQuery extends Query {
           public long cost() {
             return multiDocValues.cost();
           }
-
         };
       }
 
@@ -194,7 +202,8 @@ final class LongDistanceFeatureQuery extends Query {
           // No data on this segment
           return null;
         }
-        final SortedNumericDocValues multiDocValues = DocValues.getSortedNumeric(context.reader(), field);
+        final SortedNumericDocValues multiDocValues =
+            DocValues.getSortedNumeric(context.reader(), field);
         final NumericDocValues docValues = selectValues(multiDocValues);
 
         final Weight weight = this;
@@ -202,7 +211,8 @@ final class LongDistanceFeatureQuery extends Query {
 
           @Override
           public Scorer get(long leadCost) throws IOException {
-            return new DistanceScorer(weight, context.reader().maxDoc(), leadCost, boost, pointValues, docValues);
+            return new DistanceScorer(
+                weight, context.reader().maxDoc(), leadCost, boost, pointValues, docValues);
           }
 
           @Override
@@ -220,7 +230,6 @@ final class LongDistanceFeatureQuery extends Query {
         }
         return scorerSupplier.get(Long.MAX_VALUE);
       }
-
     };
   }
 
@@ -235,8 +244,13 @@ final class LongDistanceFeatureQuery extends Query {
     private final NumericDocValues docValues;
     private long maxDistance = Long.MAX_VALUE;
 
-    protected DistanceScorer(Weight weight, int maxDoc, long leadCost, float boost,
-        PointValues pointValues, NumericDocValues docValues) {
+    protected DistanceScorer(
+        Weight weight,
+        int maxDoc,
+        long leadCost,
+        float boost,
+        PointValues pointValues,
+        NumericDocValues docValues) {
       super(weight);
       this.maxDoc = maxDoc;
       this.leadCost = leadCost;
@@ -258,8 +272,8 @@ final class LongDistanceFeatureQuery extends Query {
     }
 
     /**
-     * Inverting the score computation is very hard due to all potential
-     * rounding errors, so we binary search the maximum distance.
+     * Inverting the score computation is very hard due to all potential rounding errors, so we
+     * binary search the maximum distance.
      */
     private long computeMaxDistance(float minScore, long previousMaxDistance) {
       assert score(0) >= minScore;
@@ -323,7 +337,7 @@ final class LongDistanceFeatureQuery extends Query {
 
         @Override
         public int advance(int target) throws IOException {
-        return doc = it.advance(target);
+          return doc = it.advance(target);
         }
       };
     }
@@ -372,62 +386,74 @@ final class LongDistanceFeatureQuery extends Query {
 
       DocIdSetBuilder result = new DocIdSetBuilder(maxDoc);
       final int doc = docID();
-      IntersectVisitor visitor = new IntersectVisitor() {
-
-        DocIdSetBuilder.BulkAdder adder;
-
-        @Override
-        public void grow(int count) {
-          adder = result.grow(count);
-        }
+      IntersectVisitor visitor =
+          new IntersectVisitor() {
 
-        @Override
-        public void visit(int docID) {
-          if (docID <= doc) {
-            // Already visited or skipped
-            return;
-          }
-          adder.add(docID);
-        }
-
-        @Override
-        public void visit(int docID, byte[] packedValue) {
-          if (docID <= doc) {
-            // Already visited or skipped
-            return;
-          }
-          if (Arrays.compareUnsigned(packedValue, 0, Long.BYTES, minValueAsBytes, 0, Long.BYTES) < 0) {
-            // Doc's value is too low, in this dimension
-            return;
-          }
-          if (Arrays.compareUnsigned(packedValue, 0, Long.BYTES, maxValueAsBytes, 0, Long.BYTES) > 0) {
-            // Doc's value is too high, in this dimension
-            return;
-          }
+            DocIdSetBuilder.BulkAdder adder;
 
-          // Doc is in-bounds
-          adder.add(docID);
-        }
+            @Override
+            public void grow(int count) {
+              adder = result.grow(count);
+            }
 
-        @Override
-        public Relation compare(byte[] minPackedValue, byte[] maxPackedValue) {
-          if (Arrays.compareUnsigned(minPackedValue, 0, Long.BYTES, maxValueAsBytes, 0, Long.BYTES) > 0 ||
-              Arrays.compareUnsigned(maxPackedValue, 0, Long.BYTES, minValueAsBytes, 0, Long.BYTES) < 0) {
-            return Relation.CELL_OUTSIDE_QUERY;
-          }
+            @Override
+            public void visit(int docID) {
+              if (docID <= doc) {
+                // Already visited or skipped
+                return;
+              }
+              adder.add(docID);
+            }
 
-          if (Arrays.compareUnsigned(minPackedValue, 0, Long.BYTES, minValueAsBytes, 0, Long.BYTES) < 0 ||
-              Arrays.compareUnsigned(maxPackedValue, 0, Long.BYTES, maxValueAsBytes, 0, Long.BYTES) > 0) {
-            return Relation.CELL_CROSSES_QUERY;
-          }
+            @Override
+            public void visit(int docID, byte[] packedValue) {
+              if (docID <= doc) {
+                // Already visited or skipped
+                return;
+              }
+              if (Arrays.compareUnsigned(packedValue, 0, Long.BYTES, minValueAsBytes, 0, Long.BYTES)
+                  < 0) {
+                // Doc's value is too low, in this dimension
+                return;
+              }
+              if (Arrays.compareUnsigned(packedValue, 0, Long.BYTES, maxValueAsBytes, 0, Long.BYTES)
+                  > 0) {
+                // Doc's value is too high, in this dimension
+                return;
+              }
+
+              // Doc is in-bounds
+              adder.add(docID);
+            }
 
-          return Relation.CELL_INSIDE_QUERY;
-        }
-      };
+            @Override
+            public Relation compare(byte[] minPackedValue, byte[] maxPackedValue) {
+              if (Arrays.compareUnsigned(
+                          minPackedValue, 0, Long.BYTES, maxValueAsBytes, 0, Long.BYTES)
+                      > 0
+                  || Arrays.compareUnsigned(
+                          maxPackedValue, 0, Long.BYTES, minValueAsBytes, 0, Long.BYTES)
+                      < 0) {
+                return Relation.CELL_OUTSIDE_QUERY;
+              }
+
+              if (Arrays.compareUnsigned(
+                          minPackedValue, 0, Long.BYTES, minValueAsBytes, 0, Long.BYTES)
+                      < 0
+                  || Arrays.compareUnsigned(
+                          maxPackedValue, 0, Long.BYTES, maxValueAsBytes, 0, Long.BYTES)
+                      > 0) {
+                return Relation.CELL_CROSSES_QUERY;
+              }
+
+              return Relation.CELL_INSIDE_QUERY;
+            }
+          };
 
       final long currentQueryCost = Math.min(leadCost, it.cost());
       final long threshold = currentQueryCost >>> 3;
-      long estimatedNumberOfMatches = pointValues.estimatePointCount(visitor); // runs in O(log(numPoints))
+      long estimatedNumberOfMatches =
+          pointValues.estimatePointCount(visitor); // runs in O(log(numPoints))
       // TODO: what is the right factor compared to the current disi? Is 8 optimal?
       if (estimatedNumberOfMatches >= threshold) {
         // the new range is not selective enough to be worth materializing
@@ -436,6 +462,5 @@ final class LongDistanceFeatureQuery extends Query {
       pointValues.intersect(visitor);
       it = result.build().iterator();
     }
-
   }
 }
diff --git a/lucene/core/src/java/org/apache/lucene/document/LongPoint.java b/lucene/core/src/java/org/apache/lucene/document/LongPoint.java
index d26660f..3224c6a 100644
--- a/lucene/core/src/java/org/apache/lucene/document/LongPoint.java
+++ b/lucene/core/src/java/org/apache/lucene/document/LongPoint.java
@@ -18,32 +18,33 @@ package org.apache.lucene.document;
 
 import java.util.Arrays;
 import java.util.Collection;
-
 import org.apache.lucene.index.PointValues;
+import org.apache.lucene.search.BooleanClause.Occur;
 import org.apache.lucene.search.BooleanQuery;
 import org.apache.lucene.search.BoostQuery;
 import org.apache.lucene.search.PointInSetQuery;
 import org.apache.lucene.search.PointRangeQuery;
 import org.apache.lucene.search.Query;
-import org.apache.lucene.search.BooleanClause.Occur;
 import org.apache.lucene.util.BytesRef;
 import org.apache.lucene.util.NumericUtils;
 
-/** 
- * An indexed {@code long} field for fast range filters.  If you also
- * need to store the value, you should add a separate {@link StoredField} instance.
- * <p>
- * Finding all documents within an N-dimensional shape or range at search time is
- * efficient.  Multiple values for the same field in one document
- * is allowed.
- * <p>
- * This field defines static factory methods for creating common queries:
+/**
+ * An indexed {@code long} field for fast range filters. If you also need to store the value, you
+ * should add a separate {@link StoredField} instance.
+ *
+ * <p>Finding all documents within an N-dimensional shape or range at search time is efficient.
+ * Multiple values for the same field in one document is allowed.
+ *
+ * <p>This field defines static factory methods for creating common queries:
+ *
  * <ul>
  *   <li>{@link #newExactQuery(String, long)} for matching an exact 1D point.
  *   <li>{@link #newSetQuery(String, long...)} for matching a set of 1D values.
  *   <li>{@link #newRangeQuery(String, long, long)} for matching a 1D range.
- *   <li>{@link #newRangeQuery(String, long[], long[])} for matching points/ranges in n-dimensional space.
+ *   <li>{@link #newRangeQuery(String, long[], long[])} for matching points/ranges in n-dimensional
+ *       space.
  * </ul>
+ *
  * @see PointValues
  */
 public final class LongPoint extends Field {
@@ -62,7 +63,14 @@ public final class LongPoint extends Field {
   /** Change the values of this field */
   public void setLongValues(long... point) {
     if (type.pointDimensionCount() != point.length) {
-      throw new IllegalArgumentException("this field (name=" + name + ") uses " + type.pointDimensionCount() + " dimensions; cannot change to (incoming) " + point.length + " dimensions");
+      throw new IllegalArgumentException(
+          "this field (name="
+              + name
+              + ") uses "
+              + type.pointDimensionCount()
+              + " dimensions; cannot change to (incoming) "
+              + point.length
+              + " dimensions");
     }
     fieldsData = pack(point);
   }
@@ -75,7 +83,12 @@ public final class LongPoint extends Field {
   @Override
   public Number numericValue() {
     if (type.pointDimensionCount() != 1) {
-      throw new IllegalStateException("this field (name=" + name + ") uses " + type.pointDimensionCount() + " dimensions; cannot convert to a single numeric value");
+      throw new IllegalStateException(
+          "this field (name="
+              + name
+              + ") uses "
+              + type.pointDimensionCount()
+              + " dimensions; cannot convert to a single numeric value");
     }
     BytesRef bytes = (BytesRef) fieldsData;
     assert bytes.length == Long.BYTES;
@@ -83,7 +96,7 @@ public final class LongPoint extends Field {
   }
 
   /**
-   *  Pack a long point into a BytesRef
+   * Pack a long point into a BytesRef
    *
    * @param point long[] value
    * @throws IllegalArgumentException is the value is null or of zero length
@@ -96,7 +109,7 @@ public final class LongPoint extends Field {
       throw new IllegalArgumentException("point must not be 0 dimensions");
     }
     byte[] packed = new byte[point.length * Long.BYTES];
-    
+
     for (int dim = 0; dim < point.length; dim++) {
       encodeDimension(point[dim], packed, dim * Long.BYTES);
     }
@@ -104,17 +117,17 @@ public final class LongPoint extends Field {
     return new BytesRef(packed);
   }
 
-  /** Creates a new LongPoint, indexing the
-   *  provided N-dimensional long point.
+  /**
+   * Creates a new LongPoint, indexing the provided N-dimensional long point.
    *
-   *  @param name field name
-   *  @param point long[] value
-   *  @throws IllegalArgumentException if the field name or value is null.
+   * @param name field name
+   * @param point long[] value
+   * @throws IllegalArgumentException if the field name or value is null.
    */
   public LongPoint(String name, long... point) {
     super(name, pack(point), getType(point.length));
   }
-  
+
   @Override
   public String toString() {
     StringBuilder result = new StringBuilder();
@@ -134,26 +147,26 @@ public final class LongPoint extends Field {
     result.append('>');
     return result.toString();
   }
-  
+
   // public helper methods (e.g. for queries)
-  
+
   /** Encode single long dimension */
   public static void encodeDimension(long value, byte dest[], int offset) {
     NumericUtils.longToSortableBytes(value, dest, offset);
   }
-  
+
   /** Decode single long dimension */
   public static long decodeDimension(byte value[], int offset) {
     return NumericUtils.sortableBytesToLong(value, offset);
   }
-  
+
   // static methods for generating queries
-  
-  /** 
+
+  /**
    * Create a query for matching an exact long value.
-   * <p>
-   * This is for simple one-dimension points, for multidimensional points use
-   * {@link #newRangeQuery(String, long[], long[])} instead.
+   *
+   * <p>This is for simple one-dimension points, for multidimensional points use {@link
+   * #newRangeQuery(String, long[], long[])} instead.
    *
    * @param field field name. must not be {@code null}.
    * @param value exact value
@@ -164,17 +177,17 @@ public final class LongPoint extends Field {
     return newRangeQuery(field, value, value);
   }
 
-  /** 
+  /**
    * Create a range query for long values.
-   * <p>
-   * This is for simple one-dimension ranges, for multidimensional ranges use
-   * {@link #newRangeQuery(String, long[], long[])} instead.
-   * <p>
-   * You can have half-open ranges (which are in fact &lt;/&le; or &gt;/&ge; queries)
-   * by setting {@code lowerValue = Long.MIN_VALUE} or {@code upperValue = Long.MAX_VALUE}. 
-   * <p>
-   * Ranges are inclusive. For exclusive ranges, pass {@code Math.addExact(lowerValue, 1)}
-   * or {@code Math.addExact(upperValue, -1)}.
+   *
+   * <p>This is for simple one-dimension ranges, for multidimensional ranges use {@link
+   * #newRangeQuery(String, long[], long[])} instead.
+   *
+   * <p>You can have half-open ranges (which are in fact &lt;/&le; or &gt;/&ge; queries) by setting
+   * {@code lowerValue = Long.MIN_VALUE} or {@code upperValue = Long.MAX_VALUE}.
+   *
+   * <p>Ranges are inclusive. For exclusive ranges, pass {@code Math.addExact(lowerValue, 1)} or
+   * {@code Math.addExact(upperValue, -1)}.
    *
    * @param field field name. must not be {@code null}.
    * @param lowerValue lower portion of the range (inclusive).
@@ -183,28 +196,29 @@ public final class LongPoint extends Field {
    * @return a query matching documents within this range.
    */
   public static Query newRangeQuery(String field, long lowerValue, long upperValue) {
-    return newRangeQuery(field, new long[] { lowerValue }, new long[] { upperValue });
+    return newRangeQuery(field, new long[] {lowerValue}, new long[] {upperValue});
   }
 
-  /** 
+  /**
    * Create a range query for n-dimensional long values.
-   * <p>
-   * You can have half-open ranges (which are in fact &lt;/&le; or &gt;/&ge; queries)
-   * by setting {@code lowerValue[i] = Long.MIN_VALUE} or {@code upperValue[i] = Long.MAX_VALUE}. 
-   * <p>
-   * Ranges are inclusive. For exclusive ranges, pass {@code Math.addExact(lowerValue[i], 1)}
-   * or {@code Math.addExact(upperValue[i], -1)}.
+   *
+   * <p>You can have half-open ranges (which are in fact &lt;/&le; or &gt;/&ge; queries) by setting
+   * {@code lowerValue[i] = Long.MIN_VALUE} or {@code upperValue[i] = Long.MAX_VALUE}.
+   *
+   * <p>Ranges are inclusive. For exclusive ranges, pass {@code Math.addExact(lowerValue[i], 1)} or
+   * {@code Math.addExact(upperValue[i], -1)}.
    *
    * @param field field name. must not be {@code null}.
    * @param lowerValue lower portion of the range (inclusive). must not be {@code null}.
    * @param upperValue upper portion of the range (inclusive). must not be {@code null}.
-   * @throws IllegalArgumentException if {@code field} is null, if {@code lowerValue} is null, if {@code upperValue} is null, 
-   *                                  or if {@code lowerValue.length != upperValue.length}
+   * @throws IllegalArgumentException if {@code field} is null, if {@code lowerValue} is null, if
+   *     {@code upperValue} is null, or if {@code lowerValue.length != upperValue.length}
    * @return a query matching documents within this range.
    */
   public static Query newRangeQuery(String field, long[] lowerValue, long[] upperValue) {
     PointRangeQuery.checkArgs(field, lowerValue, upperValue);
-    return new PointRangeQuery(field, pack(lowerValue).bytes, pack(upperValue).bytes, lowerValue.length) {
+    return new PointRangeQuery(
+        field, pack(lowerValue).bytes, pack(upperValue).bytes, lowerValue.length) {
       @Override
       protected String toString(int dimension, byte[] value) {
         return Long.toString(decodeDimension(value, 0));
@@ -213,8 +227,9 @@ public final class LongPoint extends Field {
   }
 
   /**
-   * Create a query matching any of the specified 1D values.  This is the points equivalent of {@code TermsQuery}.
-   * 
+   * Create a query matching any of the specified 1D values. This is the points equivalent of {@code
+   * TermsQuery}.
+   *
    * @param field field name. must not be {@code null}.
    * @param values all values to match
    */
@@ -226,22 +241,25 @@ public final class LongPoint extends Field {
 
     final BytesRef encoded = new BytesRef(new byte[Long.BYTES]);
 
-    return new PointInSetQuery(field, 1, Long.BYTES,
-                               new PointInSetQuery.Stream() {
+    return new PointInSetQuery(
+        field,
+        1,
+        Long.BYTES,
+        new PointInSetQuery.Stream() {
 
-                                 int upto;
+          int upto;
 
-                                 @Override
-                                 public BytesRef next() {
-                                   if (upto == sortedValues.length) {
-                                     return null;
-                                   } else {
-                                     encodeDimension(sortedValues[upto], encoded.bytes, 0);
-                                     upto++;
-                                     return encoded;
-                                   }
-                                 }
-                               }) {
+          @Override
+          public BytesRef next() {
+            if (upto == sortedValues.length) {
+              return null;
+            } else {
+              encodeDimension(sortedValues[upto], encoded.bytes, 0);
+              upto++;
+              return encoded;
+            }
+          }
+        }) {
       @Override
       protected String toString(byte[] value) {
         assert value.length == Long.BYTES;
@@ -249,10 +267,11 @@ public final class LongPoint extends Field {
       }
     };
   }
-  
+
   /**
-   * Create a query matching any of the specified 1D values.  This is the points equivalent of {@code TermsQuery}.
-   * 
+   * Create a query matching any of the specified 1D values. This is the points equivalent of {@code
+   * TermsQuery}.
+   *
    * @param field field name. must not be {@code null}.
    * @param values all values to match
    */
@@ -266,21 +285,18 @@ public final class LongPoint extends Field {
   }
 
   /**
-   * Given a field that indexes the same long values into a {@link LongPoint}
-   * and doc values (either {@link NumericDocValuesField} or
-   * {@link SortedNumericDocValuesField}), this returns a query that scores
-   * documents based on their distance to {@code origin}:
-   * {@code score = weight * pivotDistance / (pivotDistance + distance)}, ie.
-   * score is in the {@code [0, weight]} range, is equal to {@code weight} when
-   * the document's value is equal to {@code origin} and is equal to
-   * {@code weight/2}  when the document's value is distant of
-   * {@code pivotDistance} from {@code origin}.
-   * In case of multi-valued fields, only the closest point to {@code origin}
-   * will be considered.
-   * This query is typically useful to boost results based on recency by adding
-   * this query to a {@link Occur#SHOULD} clause of a {@link BooleanQuery}.
+   * Given a field that indexes the same long values into a {@link LongPoint} and doc values (either
+   * {@link NumericDocValuesField} or {@link SortedNumericDocValuesField}), this returns a query
+   * that scores documents based on their distance to {@code origin}: {@code score = weight *
+   * pivotDistance / (pivotDistance + distance)}, ie. score is in the {@code [0, weight]} range, is
+   * equal to {@code weight} when the document's value is equal to {@code origin} and is equal to
+   * {@code weight/2} when the document's value is distant of {@code pivotDistance} from {@code
+   * origin}. In case of multi-valued fields, only the closest point to {@code origin} will be
+   * considered. This query is typically useful to boost results based on recency by adding this
+   * query to a {@link Occur#SHOULD} clause of a {@link BooleanQuery}.
    */
-  public static Query newDistanceFeatureQuery(String field, float weight, long origin, long pivotDistance) {
+  public static Query newDistanceFeatureQuery(
+      String field, float weight, long origin, long pivotDistance) {
     Query query = new LongDistanceFeatureQuery(field, origin, pivotDistance);
     if (weight != 1f) {
       query = new BoostQuery(query, weight);
diff --git a/lucene/core/src/java/org/apache/lucene/document/LongRange.java b/lucene/core/src/java/org/apache/lucene/document/LongRange.java
index f49ae15..6c4df42 100644
--- a/lucene/core/src/java/org/apache/lucene/document/LongRange.java
+++ b/lucene/core/src/java/org/apache/lucene/document/LongRange.java
@@ -17,7 +17,6 @@
 package org.apache.lucene.document;
 
 import java.util.Objects;
-
 import org.apache.lucene.document.RangeFieldQuery.QueryType;
 import org.apache.lucene.search.Query;
 import org.apache.lucene.util.BytesRef;
@@ -25,20 +24,25 @@ import org.apache.lucene.util.NumericUtils;
 
 /**
  * An indexed Long Range field.
- * <p>
- * This field indexes dimensional ranges defined as min/max pairs. It supports
- * up to a maximum of 4 dimensions (indexed as 8 numeric values). With 1 dimension representing a single long range,
- * 2 dimensions representing a bounding box, 3 dimensions a bounding cube, and 4 dimensions a tesseract.
- * <p>
- * Multiple values for the same field in one document is supported, and open ended ranges can be defined using
- * {@code Long.MIN_VALUE} and {@code Long.MAX_VALUE}.
  *
- * <p>
- * This field defines the following static factory methods for common search operations over long ranges:
+ * <p>This field indexes dimensional ranges defined as min/max pairs. It supports up to a maximum of
+ * 4 dimensions (indexed as 8 numeric values). With 1 dimension representing a single long range, 2
+ * dimensions representing a bounding box, 3 dimensions a bounding cube, and 4 dimensions a
+ * tesseract.
+ *
+ * <p>Multiple values for the same field in one document is supported, and open ended ranges can be
+ * defined using {@code Long.MIN_VALUE} and {@code Long.MAX_VALUE}.
+ *
+ * <p>This field defines the following static factory methods for common search operations over long
+ * ranges:
+ *
  * <ul>
- *   <li>{@link #newIntersectsQuery newIntersectsQuery()} matches ranges that intersect the defined search range.
- *   <li>{@link #newWithinQuery newWithinQuery()} matches ranges that are within the defined search range.
- *   <li>{@link #newContainsQuery newContainsQuery()} matches ranges that contain the defined search range.
+ *   <li>{@link #newIntersectsQuery newIntersectsQuery()} matches ranges that intersect the defined
+ *       search range.
+ *   <li>{@link #newWithinQuery newWithinQuery()} matches ranges that are within the defined search
+ *       range.
+ *   <li>{@link #newContainsQuery newContainsQuery()} matches ranges that contain the defined search
+ *       range.
  * </ul>
  */
 public class LongRange extends Field {
@@ -65,30 +69,38 @@ public class LongRange extends Field {
 
     FieldType ft = new FieldType();
     // dimensions is set as 2*dimension size (min/max per dimension)
-    ft.setDimensions(dimensions*2, BYTES);
+    ft.setDimensions(dimensions * 2, BYTES);
     ft.freeze();
     return ft;
   }
 
   /**
    * Changes the values of the field.
+   *
    * @param min array of min values. (accepts {@code Long.MIN_VALUE})
    * @param max array of max values. (accepts {@code Long.MAX_VALUE})
    * @throws IllegalArgumentException if {@code min} or {@code max} is invalid
    */
   public void setRangeValues(long[] min, long[] max) {
     checkArgs(min, max);
-    if (min.length*2 != type.pointDimensionCount() || max.length*2 != type.pointDimensionCount()) {
-      throw new IllegalArgumentException("field (name=" + name + ") uses " + type.pointDimensionCount()/2
-          + " dimensions; cannot change to (incoming) " + min.length + " dimensions");
+    if (min.length * 2 != type.pointDimensionCount()
+        || max.length * 2 != type.pointDimensionCount()) {
+      throw new IllegalArgumentException(
+          "field (name="
+              + name
+              + ") uses "
+              + type.pointDimensionCount() / 2
+              + " dimensions; cannot change to (incoming) "
+              + min.length
+              + " dimensions");
     }
 
     final byte[] bytes;
     if (fieldsData == null) {
-      bytes = new byte[BYTES*2*min.length];
+      bytes = new byte[BYTES * 2 * min.length];
       fieldsData = new BytesRef(bytes);
     } else {
-      bytes = ((BytesRef)fieldsData).bytes;
+      bytes = ((BytesRef) fieldsData).bytes;
     }
     verifyAndEncode(min, max, bytes);
   }
@@ -109,27 +121,29 @@ public class LongRange extends Field {
   /** Encodes the min, max ranges into a byte array */
   static byte[] encode(long[] min, long[] max) {
     checkArgs(min, max);
-    byte[] b = new byte[BYTES*2*min.length];
+    byte[] b = new byte[BYTES * 2 * min.length];
     verifyAndEncode(min, max, b);
     return b;
   }
 
   /**
    * encode the ranges into a sortable byte array ({@code Double.NaN} not allowed)
-   * <p>
-   * example for 4 dimensions (8 bytes per dimension value):
-   * minD1 ... minD4 | maxD1 ... maxD4
+   *
+   * <p>example for 4 dimensions (8 bytes per dimension value): minD1 ... minD4 | maxD1 ... maxD4
    */
   static void verifyAndEncode(long[] min, long[] max, byte[] bytes) {
-    for (int d=0,i=0,j=min.length*BYTES; d<min.length; ++d, i+=BYTES, j+=BYTES) {
+    for (int d = 0, i = 0, j = min.length * BYTES; d < min.length; ++d, i += BYTES, j += BYTES) {
       if (Double.isNaN(min[d])) {
-        throw new IllegalArgumentException("invalid min value (" + Double.NaN + ")" + " in LongRange");
+        throw new IllegalArgumentException(
+            "invalid min value (" + Double.NaN + ")" + " in LongRange");
       }
       if (Double.isNaN(max[d])) {
-        throw new IllegalArgumentException("invalid max value (" + Double.NaN + ")" + " in LongRange");
+        throw new IllegalArgumentException(
+            "invalid max value (" + Double.NaN + ")" + " in LongRange");
       }
       if (min[d] > max[d]) {
-        throw new IllegalArgumentException("min value (" + min[d] + ") is greater than max value (" + max[d] + ")");
+        throw new IllegalArgumentException(
+            "min value (" + min[d] + ") is greater than max value (" + max[d] + ")");
       }
       encode(min[d], bytes, i);
       encode(max[d], bytes, j);
@@ -143,43 +157,47 @@ public class LongRange extends Field {
 
   /**
    * Get the min value for the given dimension
+   *
    * @param dimension the dimension, always positive
    * @return the decoded min value
    */
   public long getMin(int dimension) {
-    Objects.checkIndex(dimension, type.pointDimensionCount()/2);
-    return decodeMin(((BytesRef)fieldsData).bytes, dimension);
+    Objects.checkIndex(dimension, type.pointDimensionCount() / 2);
+    return decodeMin(((BytesRef) fieldsData).bytes, dimension);
   }
 
   /**
    * Get the max value for the given dimension
+   *
    * @param dimension the dimension, always positive
    * @return the decoded max value
    */
   public long getMax(int dimension) {
-    Objects.checkIndex(dimension, type.pointDimensionCount()/2);
-    return decodeMax(((BytesRef)fieldsData).bytes, dimension);
+    Objects.checkIndex(dimension, type.pointDimensionCount() / 2);
+    return decodeMax(((BytesRef) fieldsData).bytes, dimension);
   }
 
   /** decodes the min value (for the defined dimension) from the encoded input byte array */
   static long decodeMin(byte[] b, int dimension) {
-    int offset = dimension*BYTES;
+    int offset = dimension * BYTES;
     return NumericUtils.sortableBytesToLong(b, offset);
   }
 
   /** decodes the max value (for the defined dimension) from the encoded input byte array */
   static long decodeMax(byte[] b, int dimension) {
-    int offset = b.length/2 + dimension*BYTES;
+    int offset = b.length / 2 + dimension * BYTES;
     return NumericUtils.sortableBytesToLong(b, offset);
   }
 
   /**
    * Create a query for matching indexed ranges that intersect the defined range.
+   *
    * @param field field name. must not be null.
    * @param min array of min values. (accepts {@code Long.MIN_VALUE})
    * @param max array of max values. (accepts {@code Long.MAX_VALUE})
    * @return query for matching intersecting ranges (overlap, within, or contains)
-   * @throws IllegalArgumentException if {@code field} is null, {@code min} or {@code max} is invalid
+   * @throws IllegalArgumentException if {@code field} is null, {@code min} or {@code max} is
+   *     invalid
    */
   public static Query newIntersectsQuery(String field, final long[] min, final long[] max) {
     return newRelationQuery(field, min, max, QueryType.INTERSECTS);
@@ -187,11 +205,13 @@ public class LongRange extends Field {
 
   /**
    * Create a query for matching indexed ranges that contain the defined range.
+   *
    * @param field field name. must not be null.
    * @param min array of min values. (accepts {@code Long.MIN_VALUE})
    * @param max array of max values. (accepts {@code Long.MAX_VALUE})
    * @return query for matching ranges that contain the defined range
-   * @throws IllegalArgumentException if {@code field} is null, {@code min} or {@code max} is invalid
+   * @throws IllegalArgumentException if {@code field} is null, {@code min} or {@code max} is
+   *     invalid
    */
   public static Query newContainsQuery(String field, final long[] min, final long[] max) {
     return newRelationQuery(field, min, max, QueryType.CONTAINS);
@@ -199,32 +219,37 @@ public class LongRange extends Field {
 
   /**
    * Create a query for matching indexed ranges that are within the defined range.
+   *
    * @param field field name. must not be null.
    * @param min array of min values. (accepts {@code Long.MIN_VALUE})
    * @param max array of max values. (accepts {@code Long.MAX_VALUE})
    * @return query for matching ranges within the defined range
-   * @throws IllegalArgumentException if {@code field} is null, {@code min} or {@code max} is invalid
+   * @throws IllegalArgumentException if {@code field} is null, {@code min} or {@code max} is
+   *     invalid
    */
   public static Query newWithinQuery(String field, final long[] min, final long[] max) {
     return newRelationQuery(field, min, max, QueryType.WITHIN);
   }
 
   /**
-   * Create a query for matching indexed ranges that cross the defined range.
-   * A CROSSES is defined as any set of ranges that are not disjoint and not wholly contained by
-   * the query. Effectively, its the complement of union(WITHIN, DISJOINT).
+   * Create a query for matching indexed ranges that cross the defined range. A CROSSES is defined
+   * as any set of ranges that are not disjoint and not wholly contained by the query. Effectively,
+   * its the complement of union(WITHIN, DISJOINT).
+   *
    * @param field field name. must not be null.
    * @param min array of min values. (accepts {@code Long.MIN_VALUE})
    * @param max array of max values. (accepts {@code Long.MAX_VALUE})
    * @return query for matching ranges within the defined range
-   * @throws IllegalArgumentException if {@code field} is null, {@code min} or {@code max} is invalid
+   * @throws IllegalArgumentException if {@code field} is null, {@code min} or {@code max} is
+   *     invalid
    */
   public static Query newCrossesQuery(String field, final long[] min, final long[] max) {
     return newRelationQuery(field, min, max, QueryType.CROSSES);
   }
 
   /** helper method for creating the desired relational query */
-  private static Query newRelationQuery(String field, final long[] min, final long[] max, QueryType relation) {
+  private static Query newRelationQuery(
+      String field, final long[] min, final long[] max, QueryType relation) {
     checkArgs(min, max);
     return new RangeFieldQuery(field, encode(min, max), min.length, relation) {
       @Override
@@ -241,7 +266,7 @@ public class LongRange extends Field {
     sb.append(" <");
     sb.append(name);
     sb.append(':');
-    byte[] b = ((BytesRef)fieldsData).bytes;
+    byte[] b = ((BytesRef) fieldsData).bytes;
     toString(b, 0);
     for (int d = 0; d < type.pointDimensionCount() / 2; ++d) {
       sb.append(' ');
@@ -254,12 +279,16 @@ public class LongRange extends Field {
 
   /**
    * Returns the String representation for the range at the given dimension
+   *
    * @param ranges the encoded ranges, never null
    * @param dimension the dimension of interest
    * @return The string representation for the range at the provided dimension
    */
   private static String toString(byte[] ranges, int dimension) {
-    return "[" + Long.toString(decodeMin(ranges, dimension)) + " : "
-        + Long.toString(decodeMax(ranges, dimension)) + "]";
+    return "["
+        + Long.toString(decodeMin(ranges, dimension))
+        + " : "
+        + Long.toString(decodeMax(ranges, dimension))
+        + "]";
   }
 }
diff --git a/lucene/core/src/java/org/apache/lucene/document/LongRangeDocValuesField.java b/lucene/core/src/java/org/apache/lucene/document/LongRangeDocValuesField.java
index 458635e..02433df 100644
--- a/lucene/core/src/java/org/apache/lucene/document/LongRangeDocValuesField.java
+++ b/lucene/core/src/java/org/apache/lucene/document/LongRangeDocValuesField.java
@@ -20,10 +20,10 @@ package org.apache.lucene.document;
 import org.apache.lucene.search.Query;
 
 /**
- * DocValues field for LongRange. This is a single valued field per document
- * due to being an extension of BinaryDocValuesField.
+ * DocValues field for LongRange. This is a single valued field per document due to being an
+ * extension of BinaryDocValuesField.
  */
-public class LongRangeDocValuesField extends BinaryRangeDocValuesField{
+public class LongRangeDocValuesField extends BinaryRangeDocValuesField {
   final String field;
   final long[] min;
   final long[] max;
@@ -55,22 +55,23 @@ public class LongRangeDocValuesField extends BinaryRangeDocValuesField{
     return max[dimension];
   }
 
-  private static Query newSlowRangeQuery(String field, final long[] min, final long[] max,
-                                        RangeFieldQuery.QueryType queryType) {
+  private static Query newSlowRangeQuery(
+      String field, final long[] min, final long[] max, RangeFieldQuery.QueryType queryType) {
     checkArgs(min, max);
     return new LongRangeSlowRangeQuery(field, min, max, queryType);
   }
 
-  /** Create a new range query that finds all ranges that intersect using doc values.
-   *  NOTE: This doesn't leverage indexing and may be slow.
-   *  @see LongRange#newIntersectsQuery */
+  /**
+   * Create a new range query that finds all ranges that intersect using doc values. NOTE: This
+   * doesn't leverage indexing and may be slow.
+   *
+   * @see LongRange#newIntersectsQuery
+   */
   public static Query newSlowIntersectsQuery(String field, final long[] min, final long[] max) {
     return newSlowRangeQuery(field, min, max, RangeFieldQuery.QueryType.INTERSECTS);
   }
 
-  /**
-   * validate the arguments
-   */
+  /** validate the arguments */
   private static void checkArgs(final long[] min, final long[] max) {
     if (min == null || max == null || min.length == 0 || max.length == 0) {
       throw new IllegalArgumentException("min/max range values cannot be null or empty");
diff --git a/lucene/core/src/java/org/apache/lucene/document/LongRangeSlowRangeQuery.java b/lucene/core/src/java/org/apache/lucene/document/LongRangeSlowRangeQuery.java
index 8564381..a4c1645 100644
--- a/lucene/core/src/java/org/apache/lucene/document/LongRangeSlowRangeQuery.java
+++ b/lucene/core/src/java/org/apache/lucene/document/LongRangeSlowRangeQuery.java
@@ -20,7 +20,6 @@ package org.apache.lucene.document;
 import java.io.IOException;
 import java.util.Arrays;
 import java.util.Objects;
-
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.search.Query;
 import org.apache.lucene.search.QueryVisitor;
@@ -30,7 +29,8 @@ class LongRangeSlowRangeQuery extends BinaryRangeFieldRangeQuery {
   private final long[] min;
   private final long[] max;
 
-  LongRangeSlowRangeQuery(String field, long[] min, long[] max, RangeFieldQuery.QueryType queryType) {
+  LongRangeSlowRangeQuery(
+      String field, long[] min, long[] max, RangeFieldQuery.QueryType queryType) {
     super(field, encodeRanges(min, max), LongRange.BYTES, min.length, queryType);
     this.field = field;
     this.min = min;
@@ -70,8 +70,7 @@ class LongRangeSlowRangeQuery extends BinaryRangeFieldRangeQuery {
     if (this.field.equals(field) == false) {
       b.append(this.field).append(":");
     }
-    return b
-        .append("[")
+    return b.append("[")
         .append(Arrays.toString(min))
         .append(" TO ")
         .append(Arrays.toString(max))
diff --git a/lucene/core/src/java/org/apache/lucene/document/NumericDocValuesField.java b/lucene/core/src/java/org/apache/lucene/document/NumericDocValuesField.java
index 0b20ca9..3fc36a4 100644
--- a/lucene/core/src/java/org/apache/lucene/document/NumericDocValuesField.java
+++ b/lucene/core/src/java/org/apache/lucene/document/NumericDocValuesField.java
@@ -16,9 +16,7 @@
  */
 package org.apache.lucene.document;
 
-
 import java.io.IOException;
-
 import org.apache.lucene.index.DocValues;
 import org.apache.lucene.index.DocValuesType;
 import org.apache.lucene.index.LeafReader;
@@ -28,32 +26,28 @@ import org.apache.lucene.search.IndexOrDocValuesQuery;
 import org.apache.lucene.search.Query;
 
 /**
- * <p>
- * Field that stores a per-document <code>long</code> value for scoring, 
- * sorting or value retrieval. Here's an example usage:
- * 
+ * Field that stores a per-document <code>long</code> value for scoring, sorting or value retrieval.
+ * Here's an example usage:
+ *
  * <pre class="prettyprint">
  *   document.add(new NumericDocValuesField(name, 22L));
  * </pre>
- * 
- * <p>
- * If you also need to store the value, you should add a
- * separate {@link StoredField} instance.
- * */
-
+ *
+ * <p>If you also need to store the value, you should add a separate {@link StoredField} instance.
+ */
 public class NumericDocValuesField extends Field {
 
-  /**
-   * Type for numeric DocValues.
-   */
+  /** Type for numeric DocValues. */
   public static final FieldType TYPE = new FieldType();
+
   static {
     TYPE.setDocValuesType(DocValuesType.NUMERIC);
     TYPE.freeze();
   }
 
-  /** 
-   * Creates a new DocValues field with the specified 64-bit long value 
+  /**
+   * Creates a new DocValues field with the specified 64-bit long value
+   *
    * @param name field name
    * @param value 64-bit long value
    * @throws IllegalArgumentException if the field name is null
@@ -64,8 +58,10 @@ public class NumericDocValuesField extends Field {
 
   /**
    * Creates a new DocValues field with the specified 64-bit long value
+   *
    * @param name field name
-   * @param value 64-bit long value or <code>null</code> if the existing fields value should be removed on update
+   * @param value 64-bit long value or <code>null</code> if the existing fields value should be
+   *     removed on update
    * @throws IllegalArgumentException if the field name is null
    */
   public NumericDocValuesField(String name, Long value) {
@@ -74,18 +70,18 @@ public class NumericDocValuesField extends Field {
   }
 
   /**
-   * Create a range query that matches all documents whose value is between
-   * {@code lowerValue} and {@code upperValue} included.
-   * <p>
-   * You can have half-open ranges (which are in fact &lt;/&le; or &gt;/&ge; queries)
-   * by setting {@code lowerValue = Long.MIN_VALUE} or {@code upperValue = Long.MAX_VALUE}. 
-   * <p>
-   * Ranges are inclusive. For exclusive ranges, pass {@code Math.addExact(lowerValue, 1)}
-   * or {@code Math.addExact(upperValue, -1)}.
-   * <p><b>NOTE</b>: Such queries cannot efficiently advance to the next match,
-   * which makes them slow if they are not ANDed with a selective query. As a
-   * consequence, they are best used wrapped in an {@link IndexOrDocValuesQuery},
-   * alongside a range query that executes on points, such as
+   * Create a range query that matches all documents whose value is between {@code lowerValue} and
+   * {@code upperValue} included.
+   *
+   * <p>You can have half-open ranges (which are in fact &lt;/&le; or &gt;/&ge; queries) by setting
+   * {@code lowerValue = Long.MIN_VALUE} or {@code upperValue = Long.MAX_VALUE}.
+   *
+   * <p>Ranges are inclusive. For exclusive ranges, pass {@code Math.addExact(lowerValue, 1)} or
+   * {@code Math.addExact(upperValue, -1)}.
+   *
+   * <p><b>NOTE</b>: Such queries cannot efficiently advance to the next match, which makes them
+   * slow if they are not ANDed with a selective query. As a consequence, they are best used wrapped
+   * in an {@link IndexOrDocValuesQuery}, alongside a range query that executes on points, such as
    * {@link LongPoint#newRangeQuery}.
    */
   public static Query newSlowRangeQuery(String field, long lowerValue, long upperValue) {
@@ -101,12 +97,12 @@ public class NumericDocValuesField extends Field {
... 9615 lines suppressed ...