GITHUB-13218: Add migrate entry for Collector to CollectorManager migration (#13238)

This commit is contained in:
Zach Chen 2024-04-04 12:53:12 -07:00 committed by GitHub
parent f7db975fc4
commit 5b5a02d0cd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 28 additions and 0 deletions

View File

@ -197,6 +197,34 @@ enum.
`TimeLimitingCollector` has been removed, use `IndexSearcher#setTimeout(QueryTimeout)` to time out queries instead.
### IndexSearch#search(Query, Collector) being deprecated in favor of IndexSearcher#search(Query, CollectorManager) (LUCENE-10002)
`IndexSearch#search(Query, Collector)` is now being deprecated in favor of `IndexSearcher#search(Query, CollectorManager)`,
as `CollectorManager` implementation would allow taking advantage of intra-query concurrency via its map-reduce API design.
To migrate, use a provided `CollectorManager` implementation that suits your use cases, or change your `Collector` implementation
to follow the new API pattern. The straight forward approach would be to instantiate the single-threaded `Collector` in a wrapper `CollectorManager`.
For example
```java
public class CustomCollectorManager implements CollectorManager<CustomCollector, List<Object>> {
@Override
public CustomCollector newCollector() throws IOException {
return new CustomCollector();
}
@Override
public List<Object> reduce(Collection<CustomCollector> collectors) throws IOException {
List<Object> all = new ArrayList<>();
for (CustomCollector c : collectors) {
all.addAll(c.getResult());
}
return all;
}
}
List<Object> results = searcher.search(query, new CustomCollectorManager());
```
## Migration from Lucene 9.0 to Lucene 9.1
### Test framework package migration and module (LUCENE-10301)