lucene/lucene/MIGRATE.txt

77 lines
3.5 KiB
Plaintext

# Apache Lucene Migration Guide
## Query.hashCode and Query.equals are now abstract methods (LUCENE-7277)
Any custom query subclasses should redeclare equivalence relationship according
to the subclass's details. See code patterns used in existing core Lucene query
classes for details.
## CompressionTools removed (LUCENE-7322)
Per-field compression has been superseded by codec-level compression, which has
the benefit of being able to compress several fields, or even documents at once,
yielding better compression ratios. In case you would still like to compress on
top of the codec, you can do it on the application side by using the utility
classes from the java.util.zip package.
## Explanation.toHtml() removed (LUCENE-7360)
Clients wishing to render Explanations as HTML should implement their own
utilities for this.
## Similarity.coord and BooleanQuery.disableCoord removed (LUCENE-7369)
Coordination factors were a workaround for the fact that the ClassicSimilarity
does not have strong enough term frequency saturation. This causes disjunctions
to get better scores on documents that have many occurrences of a few query
terms than on documents that match most clauses, which is most of time
undesirable. The new BM25Similarity does not suffer from this problem since it
has better saturation for the contribution of the term frequency so the coord
factors have been removed from scores. Things now work as if coords were always
disabled when constructing boolean queries.
## Weight.getValueForNormalization() and Weight.normalize() removed (LUCENE-7368)
Query normalization's goal was to make scores comparable across queries, which
was only implemented by the ClassicSimilarity. Since ClassicSimilarity is not
the default similarity anymore, this functionality has been removed. Boosts are
now propagated through Query#createWeight.
## AnalyzingQueryParser removed (LUCENE-7355)
The functionality of AnalyzingQueryParser has been folded into the classic
QueryParser, which now passes terms through Analyzer#normalize when generating
queries.
## CommonQueryParserConfiguration.setLowerCaseExpandedTerms removed (LUCENE-7355)
This option has been removed as expanded terms are now normalized through
Analyzer#normalize.
## Cache key and close listener refactoring (LUCENE-7410)
The way to access cache keys and add close listeners has been refactored in
order to be less trappy. You should now use IndexReader.getReaderCacheHelper()
to have manage caches that take deleted docs and doc values updates into
account, and LeafReader.getCoreCacheHelper() to manage per-segment caches that
do not take deleted docs and doc values updates into account.
## Index-time boosts removal (LUCENE-6819)
Index-time boosts are not supported anymore. As a replacement, index-time
scoring factors should be indexed in a doc value field and combined with the
score at query time using FunctionScoreQuery for instance.
## Grouping collector refactoring (LUCENE-7701)
Groups are now defined by GroupSelector classes, making it easier to define new
types of groups. Rather than having term or function specific collection
classes, FirstPassGroupingCollector, AllGroupsCollector and
AllGroupHeadsCollector are now concrete classes taking a GroupSelector.
SecondPassGroupingCollector is no longer specifically aimed at
collecting TopDocs for each group, but instead takes a GroupReducer that will
perform any type of reduction on the top groups collected on a first-pass. To
reproduce the old behaviour of SecondPassGroupingCollector, you should instead
use TopGroupsCollector.