FTS build docs inconsistency
(1) By Adrian Ho (lexfiend) on 2021-03-20 02:54:50 [source]
https://sqlite.org/fts3.html#compiling_and_enabling_fts3_and_fts4 says:
Note that enabling FTS3 also makes FTS4 available. There is not a separate SQLITE_ENABLE_FTS4
compile-time option. A build of SQLite either supports both FTS3 and FTS4 or it supports neither.
But https://sqlite.org/compile.html#_options_to_enable_features_normally_turned_off defines both SQLITE_ENABLE_FTS3
and SQLITE_ENABLE_FTS4
, and the FTS4 macro doc mentions adding both versions to the build, while the FTS3 macro doc only mentions version 3.
And from the amalgamation:
/* ** FTS4 is really an extension for FTS3. It is enabled using the ** SQLITE_ENABLE_FTS3 macro. But to avoid confusion we also all ** the SQLITE_ENABLE_FTS4 macro to serve as an alisse for SQLITE_ENABLE_FTS3. */
I don't use FTS myself, but I'll assume that the two compile-time options in fact enable exactly the same functionality, so can I suggest the following edits for clarity?
https://sqlite.org/fts3.html#compiling_and_enabling_fts3_and_fts4:
Note that enabling FTS3 also makes FTS4 available.There is not a separateA build of SQLite either supports both FTS3 and FTS4 or it supports neither.SQLITE_ENABLE_FTS4
compile-time option.
https://sqlite.org/compile.html#_options_to_enable_features_normally_turned_off:
SQLITE_ENABLE_FTS3
When this option is defined in the amalgamation, versions 3 and 4 of the full-text search engine is added to the build automatically.
SQLITE_ENABLE_FTS4
This is an alias for SQLITE_ENABLE_FTS3
.
(2) By matthewsheeran on 2024-10-06 10:58:05 in reply to 1 [link] [source]
I've got news for you - as you are on the right track: the documentation is wrong - currently System.Data.SQLite - as of this posting date - only reports and actually supports ENABLE_FTS3 and FTS4 fails! The SQLITE_ENABLE_FTS4 flag probably needs to be set and the amalgamation re-built!
Just letting you know: as I will retest and re-report as I get further along in my own Application's FTS journey.. (I am pretty sure that I am going to need more than just FTS3..)
You can also check this in a C# application:
public static int FtsVersion(SQLiteConnection conn) => ListFtsExtensions(conn).Select(_ => int.TryParse(_.Replace("ENABLE_FTS", ""), out int version) ? version : 0).Max();
public static List<string> ListFtsExtensions(SQLiteConnection conn) => ListExtensions(conn).Where(_ => _.StartsWith("ENABLE_FTS")).ToList();
public static List<string> ListExtensions(SQLiteConnection conn)
{
List<string> extensions = [];
try
{
string query = "PRAGMA compile_options;";
Console.WriteLine(query);
using SQLiteCommand cmd = new(query, conn);
using SQLiteDataReader rdr = cmd.ExecuteReader();
while (rdr.Read())
extensions.Add(rdr.GetString(0));
}
catch { }
return extensions;
}
(3) By Stephan Beal (stephan) on 2024-10-06 11:47:49 in reply to 2 [link] [source]
as of this posting date - only reports and actually supports ENABLE_FTS3 and FTS4 fails!
Yes, it only reports FTS4 if FTS4 is explicitly enabled, but a quick (that is: non-exhaustive) read of the code suggests that the same features are in place if SQLITE_ENABLE_FTS3 is defined. The only functional difference i see in the code (noting that it was not an exhaustive search) is that the list of build flags does not contain ENABLE_FTS4 if SQLITE_ENABLE_FTS4 is not explicitly defined.
i.e. i believe this to be a cosmetic issue, not a functional one.