Removing all deprecated TopScoreDocCollector + TopFieldCollector methods (#create, #createSharedManager) (#13617)

These are already marked for deprecation in 9.x and we previously removed all internal use of these methods in 10.0.

Closes #13499
This commit is contained in:
Jakub Slowinski 2024-07-30 10:33:16 +01:00 committed by GitHub
parent 8a7d4842cc
commit 74865bb92a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 2 additions and 123 deletions

View File

@ -246,6 +246,8 @@ Other
* GITHUB#13499: Remove usage of TopScoreDocCollector + TopFieldCollector deprecated methods (#create, #createSharedManager) (Jakub Slowinski)
* GITHUB#13499: Removing all deprecated TopScoreDocCollector + TopFieldCollector methods (#create, #createSharedManager) (Jakub Slowinski)
======================== Lucene 9.12.0 =======================
API Changes

View File

@ -390,73 +390,6 @@ public abstract class TopFieldCollector extends TopDocsCollector<Entry> {
}
}
/**
* Creates a new {@link TopFieldCollector} from the given arguments.
*
* <p><b>NOTE</b>: The instances returned by this method pre-allocate a full array of length
* <code>numHits</code>.
*
* @param sort the sort criteria (SortFields).
* @param numHits the number of results to collect.
* @param totalHitsThreshold the number of docs to count accurately. If the query matches more
* than {@code totalHitsThreshold} hits then its hit count will be a lower bound. On the other
* hand if the query matches less than or exactly {@code totalHitsThreshold} hits then the hit
* count of the result will be accurate. {@link Integer#MAX_VALUE} may be used to make the hit
* count accurate, but this will also make query processing slower.
* @return a {@link TopFieldCollector} instance which will sort the results by the sort criteria.
* @deprecated This method is deprecated in favor of the constructor of {@link
* TopFieldCollectorManager} due to its support for concurrency in IndexSearcher
*/
@Deprecated
public static TopFieldCollector create(Sort sort, int numHits, int totalHitsThreshold) {
return new TopFieldCollectorManager(sort, numHits, null, totalHitsThreshold, false)
.newCollector();
}
/**
* Creates a new {@link TopFieldCollector} from the given arguments.
*
* <p><b>NOTE</b>: The instances returned by this method pre-allocate a full array of length
* <code>numHits</code>.
*
* @param sort the sort criteria (SortFields).
* @param numHits the number of results to collect.
* @param after only hits after this FieldDoc will be collected
* @param totalHitsThreshold the number of docs to count accurately. If the query matches more
* than {@code totalHitsThreshold} hits then its hit count will be a lower bound. On the other
* hand if the query matches less than or exactly {@code totalHitsThreshold} hits then the hit
* count of the result will be accurate. {@link Integer#MAX_VALUE} may be used to make the hit
* count accurate, but this will also make query processing slower. Setting totalHitsThreshold
* less than {@link Integer#MAX_VALUE} instructs Lucene to skip non-competitive documents
* whenever possible. For numeric sort fields the skipping functionality works when the same
* field is indexed both with doc values and points. In this case, there is an assumption that
* the same data is stored in these points and doc values.
* @return a {@link TopFieldCollector} instance which will sort the results by the sort criteria.
* @deprecated This method is deprecated in favor of the constructor of {@link
* TopFieldCollectorManager} due to its support for concurrency in IndexSearcher
*/
@Deprecated
public static TopFieldCollector create(
Sort sort, int numHits, FieldDoc after, int totalHitsThreshold) {
return new TopFieldCollectorManager(sort, numHits, after, totalHitsThreshold, false)
.newCollector();
}
/**
* Create a CollectorManager which uses a shared hit counter to maintain number of hits and a
* shared {@link MaxScoreAccumulator} to propagate the minimum score accross segments if the
* primary sort is by relevancy.
*
* @deprecated This method is deprecated in favor of the constructor of {@link
* TopFieldCollectorManager} due to its support for concurrency in IndexSearcher
*/
@Deprecated
public static CollectorManager<TopFieldCollector, TopFieldDocs> createSharedManager(
Sort sort, int numHits, FieldDoc after, int totalHitsThreshold) {
return new TopFieldCollectorManager(sort, numHits, after, totalHitsThreshold, true);
}
/**
* Populate {@link ScoreDoc#score scores} of the given {@code topDocs}.
*

View File

@ -191,62 +191,6 @@ public abstract class TopScoreDocCollector extends TopDocsCollector<ScoreDoc> {
}
}
/**
* Creates a new {@link TopScoreDocCollector} given the number of hits to collect and the number
* of hits to count accurately.
*
* <p><b>NOTE</b>: If the total hit count of the top docs is less than or exactly {@code
* totalHitsThreshold} then this value is accurate. On the other hand, if the {@link
* TopDocs#totalHits} value is greater than {@code totalHitsThreshold} then its value is a lower
* bound of the hit count. A value of {@link Integer#MAX_VALUE} will make the hit count accurate
* but will also likely make query processing slower.
*
* <p><b>NOTE</b>: The instances returned by this method pre-allocate a full array of length
* <code>numHits</code>, and fill the array with sentinel objects.
*
* @deprecated This method is deprecated in favor of the constructor of {@link
* TopScoreDocCollectorManager} due to its support for concurrency in IndexSearcher
*/
@Deprecated
public static TopScoreDocCollector create(int numHits, int totalHitsThreshold) {
return new TopScoreDocCollectorManager(numHits, null, totalHitsThreshold, false).newCollector();
}
/**
* Creates a new {@link TopScoreDocCollector} given the number of hits to collect, the bottom of
* the previous page, and the number of hits to count accurately.
*
* <p><b>NOTE</b>: If the total hit count of the top docs is less than or exactly {@code
* totalHitsThreshold} then this value is accurate. On the other hand, if the {@link
* TopDocs#totalHits} value is greater than {@code totalHitsThreshold} then its value is a lower
* bound of the hit count. A value of {@link Integer#MAX_VALUE} will make the hit count accurate
* but will also likely make query processing slower.
*
* <p><b>NOTE</b>: The instances returned by this method pre-allocate a full array of length
* <code>numHits</code>, and fill the array with sentinel objects.
*
* @deprecated This method is deprecated in favor of the constructor of {@link
* TopScoreDocCollectorManager} due to its support for concurrency in IndexSearcher
*/
@Deprecated
public static TopScoreDocCollector create(int numHits, ScoreDoc after, int totalHitsThreshold) {
return new TopScoreDocCollectorManager(numHits, after, totalHitsThreshold, false)
.newCollector();
}
/**
* Create a CollectorManager which uses a shared hit counter to maintain number of hits and a
* shared {@link MaxScoreAccumulator} to propagate the minimum score accross segments
*
* @deprecated This method is deprecated in favor of the constructor of {@link
* TopScoreDocCollectorManager} due to its support for concurrency in IndexSearcher
*/
@Deprecated
public static CollectorManager<TopScoreDocCollector, TopDocs> createSharedManager(
int numHits, ScoreDoc after, int totalHitsThreshold) {
return new TopScoreDocCollectorManager(numHits, after, totalHitsThreshold, true);
}
int docBase;
ScoreDoc pqTop;
final HitsThresholdChecker hitsThresholdChecker;