bm25 method

Expression<double> bm25({
  1. List<double> weights = const [],
})

The bm25 relevance of a match found by an fts5 query.

The optional weights can be used to assign different weights to the columns of this table, in the order in which they were declared. An omitted weight defaults to 1.0. At most one weight per column may be given.

Matches with a higher relevance evaluate to smaller values, so ordering by this expression in ascending order returns the best matches first.

select(emails)
  ..where(emails.match('hello'))
  ..orderBy([(u) => OrderingTerm(expression: emails.bm25())]);

With default weights, this is the same as rank.

Implementation

Expression<double> bm25({List<double> weights = const []}) {
  return FunctionCallExpression<double>('bm25', [
    _tableReference,
    for (final weight in weights) Variable.withReal(weight),
  ]);
}