extractTop<T> method

List<ExtractedResult<T>> extractTop<T>(
  1. String query,
  2. List<T> choices,
  3. Applicable func,
  4. int limit, [
  5. String getter(
    1. T obj
    )?,
])

Creates a sorted list of ExtractedResult which contain the top limit most similar choices using k-top heap sort

Implementation

List<ExtractedResult<T>> extractTop<T>(
    String query, List<T> choices, Applicable func, int limit,
    [String Function(T obj)? getter]) {
  var best = extractWithoutOrder(query, choices, func, getter);
  var results = _findTopKHeap(best, limit);
  return results.reversed.toList();
}