setExactOnSingleWordQuery method

AlgoliaQuery setExactOnSingleWordQuery(
  1. ExactOnSingleWordQuery value
)

ExactOnSingleWordQuery

Controls how the exact ranking criterion is computed when the query contains only one word.

Usage notes:

  • If exactOnSingleWordQuery is set to word, only exact matches will be highlighted in the _highlightResult property of the search response: partials and prefixes will not be.
  • searchableAttributes must not be empty nor null for disableExactOnAttributes to be applied.

Options

  • attribute: (default): The exact ranking criterion is set to 1 if the query matches exactly an entire attribute value. - For example, if you search for the TV show “Road”, and in your dataset you have 2 records, “Road” and “Road Trip”, only the record with “Road” is considered exact.
  • none: The exact ranking criterion is ignored on single word queries.
  • word: The exact ranking criterion is set to 1 if the query word is found in the record. The query word must be at least 3 characters long and must not be a stop word in any supported language. - Continuing with our “Road” TV show example, in this case, both “Road” and “Road Trip” are considered to match exactly.

Source: Learn more

Implementation

AlgoliaQuery setExactOnSingleWordQuery(ExactOnSingleWordQuery value) {
  assert(!_parameters.containsKey('exactOnSingleWordQuery'));
  return _copyWithParameters(<String, dynamic>{
    'exactOnSingleWordQuery': value.toString().split('.').last
  });
}