Skip to content

Commit

Permalink
Removing all deprecated TopScoreDocCollector + TopFieldCollector meth…
Browse files Browse the repository at this point in the history
…ods (#create, #createSharedManager) (apache#13617)

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

Closes apache#13499
  • Loading branch information
slow-J authored Jul 30, 2024
1 parent 8a7d484 commit 74865bb
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 123 deletions.
2 changes: 2 additions & 0 deletions lucene/CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -390,73 +390,6 @@ protected void updateMinCompetitiveScore(Scorable scorer) throws IOException {
}
}

/**
* 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}.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,62 +191,6 @@ public void collect(int doc) throws IOException {
}
}

/**
* 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;
Expand Down

0 comments on commit 74865bb

Please sign in to comment.