VSQLite++ 0.3
Loading...
Searching...
No Matches
sqlite::v2::fts Namespace Reference

Functions

bool available (connection &con)
 Detects whether the connected SQLite build exposes the FTS5 extension.
std::string match_expression (std::string_view column_or_table, std::string_view query_expr="?")
 Builds a SQL MATCH expression for FTS tables or columns.
void register_rank_function (connection &con, std::string_view function_name="fts_rank")
 Registers a custom ranking function compatible with fts5 queries.

Function Documentation

◆ available()

bool sqlite::v2::fts::available ( connection & con)

Detects whether the connected SQLite build exposes the FTS5 extension.

Returns
true when FTS5 APIs are discoverable, false otherwise.

◆ match_expression()

std::string sqlite::v2::fts::match_expression ( std::string_view column_or_table,
std::string_view query_expr = "?" )

Builds a SQL MATCH expression for FTS tables or columns.

Parameters
column_or_tableIdentifier on the left-hand side of MATCH.
query_exprSQL expression for the right-hand side (defaults to a parameter placeholder).
Returns
SQL snippet like col MATCH ?.

◆ register_rank_function()

void sqlite::v2::fts::register_rank_function ( connection & con,
std::string_view function_name = "fts_rank" )

Registers a custom ranking function compatible with fts5 queries.

The installed function uses a simple heuristic that counts matched phrases, and can be referenced inside ORDER BY clauses as fts_rank(matchinfo).

Parameters
conConnection with FTS5 available.
function_nameOptional SQL symbol name (defaults to fts_rank).
Exceptions
database_exceptionwhen FTS5 is unavailable or registration fails.