SearchResponse.fromJson constructor

SearchResponse.fromJson(
  1. Map<String, dynamic> json
)

Implementation

factory SearchResponse.fromJson(Map<String, dynamic> json) {
  return SearchResponse(
    facets: (json['facets'] as Map<String, dynamic>?)?.map((k, e) =>
        MapEntry(k, BucketInfo.fromJson(e as Map<String, dynamic>))),
    hits: json['hits'] != null
        ? Hits.fromJson(json['hits'] as Map<String, dynamic>)
        : null,
    stats: (json['stats'] as Map<String, dynamic>?)?.map((k, e) =>
        MapEntry(k, FieldStats.fromJson(e as Map<String, dynamic>))),
    status: json['status'] != null
        ? SearchStatus.fromJson(json['status'] as Map<String, dynamic>)
        : null,
  );
}