Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enables FTS5 by default #594

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ SQLITE_COMPILATION_FLAGS = \
-DSQLITE_DISABLE_LFS \
-DSQLITE_ENABLE_FTS3 \
-DSQLITE_ENABLE_FTS3_PARENTHESIS \
-DSQLITE_ENABLE_FTS5 \
-DSQLITE_THREADSAFE=0 \
-DSQLITE_ENABLE_NORMALIZE

Expand Down
28 changes: 28 additions & 0 deletions test/test_fts5.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
exports.test = function(sql, assert){
// Create a database
var db = new sql.Database();

// Create table, insert data
db.exec("CREATE VIRTUAL TABLE Test_Fts5 USING fts5(text);");
db.exec("INSERT INTO Test_Fts5 VALUES ('welcome home'), ('wonderful'), ('thanks for all the fish');");

var res = db.exec("SELECT * FROM Test_Fts5 WHERE Test_Fts5 MATCH 'welcome';");
assert.deepEqual(res[0].values, [["welcome home"]], "full text search results");

db.close();
};

if (module == require.main) {
const target_file = process.argv[2];
const sql_loader = require('./load_sql_lib');
sql_loader(target_file).then((sql)=>{
require('test').run({
'test errors': function(assert){
exports.test(sql, assert);
}
});
})
.catch((e)=>{
console.error(e);
});
}