ElasticResultSnippet constructor

ElasticResultSnippet({
  1. required String fullText,
  2. required List<String> textParts,
  3. required List<String> highlights,
})

Implementation

factory ElasticResultSnippet({
  /// The full snippet, matching the size provided in the [ElasticResultField]
  /// passed to the query.
  required String fullText,

  /// The snippet splitted in parts around the matched query.
  /// For example, if the document contains the string "The weather is beautiful in Florida today"
  /// and your query is "beautiful", this array will contain:
  /// "The weather is ", "beautiful", " in Florida today".
  /// This feature intends to build [RichText] on your app to highlight the query
  /// in the result.
  required List<String> textParts,

  /// The words matching the query. They can be many because even if you are querying
  /// something like "car", the result can also contain "cars". So we need to
  /// return all the words Elastic decided to match in order to highlight all the matching words.
  required List<String> highlights,
}) = _ElasticResultSnippet;