fts5Match function

bool fts5Match(
  1. String document,
  2. String query
)

Match query against the contents of a single document string.

Returns true iff the query expression evaluates to true on the document's token sequence. Empty queries (whitespace only) match every document, mirroring SQLite's behaviour.

Implementation

bool fts5Match(String document, String query) {
  final node = parseFts5Query(query);
  if (node == null) return true; // empty query
  final tokens = tokenizeFts(document);
  return node.evaluate(tokens);
}