feat: sqlite3 page content search module
New search module for sqlite3. (using fts5).
The module allows to search by page content like implemented in server/modules/search/postgres module.
The module allows you to use expressions for searching(similar to ts-query module). Supported types of expressions:
a b c d-- "a" AND "b" AND "c" AND "d"a,b,(c d)-- "a" OR "b" OR ("c" AND "d")head*-- all words with "head" preffix- a b (!c,!d) -- "a" "b" NOT ("c" AND "d")
"foo !bar !baz"-- "foo !bar !baz"
Since Sqlite does not support OR NOT (...) expressions search query may throw errors on some inputs (a b (c, !d) for example )
Convert to draft, due to some knex troubles with index rebuild
Knex: Timeout acquiring a connection. The pool is probably full. Are you missing a transacting(trx) call?
The rebuild function has been rewritten.
It looks like knex only supports one sqlite database connection. I believe the error was caused by multiple knex function calls inside the pipeline.
await pipeline(
WIKI.models.knex.column(...).select(),
new stream.Transform({
objectMode: true,
transform: async (page, enc, cb) => {
await WIKI.models.knex.raw(...).
cb()
}
})
)
I cleaned up the engine.js file, but the match-query.js needs some reformatting too, so that it conforms to StandardJS (e.g. always use braces for if statements, use const when variable is not reassigned afterwards, no dangling commas, etc.)
Thx, I cleaned up the match-query.js.
Almost all warnings have been fixed.
There are still some warnings at the definition of this.knownLexemes. But I doubt whether it is worth rewriting it and how critical these warnings are.
match-query.js:125:19: Object properties must go on a new line if they aren't all on the same line. (object-property-newline)
match-query.js:125:31: Object properties must go on a new line if they aren't all on the same line. (object-property-newline)
match-query.js:125:31: Unnecessarily quoted property 'not' found. (quote-props)
match-query.js:126:19: Object properties must go on a new line if they aren't all on the same line. (object-property-newline)
match-query.js:126:19: Unnecessarily quoted property 'and' found. (quote-props)
match-query.js:127:18: Object properties must go on a new line if they aren't all on the same line. (object-property-newline)
match-query.js:127:18: Unnecessarily quoted property 'or' found. (quote-props)
match-query.js:127:30: Object properties must go on a new line if they aren't all on the same line. (object-property-newline)