TiddlyWiki / TiddlyWiki/MultiWikiServer
Filter to sql
Open
@Arlen22 is already working on this.
Since Mar 21, 2025.
- Dominant language
- TypeScript
- Stars
- 60
- Forks
- 16
- PR merge metrics
- No merged PRs in 30d
Description
I'm going to add a src/filter-ast-util-to-sql , similar to https://github.com/syntax-tree/mdast-util-from-markdown , @Arlen22 is that the right place?
For Filter AST, I'll reuse AST intimated in https://github.com/TiddlyWiki/TiddlyWiki5/blob/master/editions/test/tiddlers/tests/test-filters.js
- Add Filter AST to https://github.com/tiddly-gittly/TW5-Typed
- Try compile some "selection constructors" described in https://tiddlywiki.com/#Selection%20Constructors to SQL
- Modify core to allow hook into
compileFilter, when creatingoperationSubFunctionand gettingfilterOperators[operator.operator], it will ask forth-getOperationSubFunctionandth-getFilterOperators, so we can provide SQL execution based function to it.- if a filter run can fully transform to SQL, we return function at
th-getOperationSubFunction, if some filter operator is JS only, cause only some part of filter run can run as SQL, we return function atth-getFilterOperators - Get transforms by
module-type: sqlfilteroperatorat runtime in the future, but now simply write them as an static JS Map.
- if a filter run can fully transform to SQL, we return function at
- For
backlinkthat has indexer, we could use a sqlite table to store indexer, and overwrite existing JS based indexer byaddIndexer(need to modify core to allow overwrite)- this is the slowest part of JS filter, we will have most of performance boost here.
- we presist the indexer tables, and only update necessary rows when that tiddler changes
- filesystem-adaptor should check tid file hashs, and report percise change to MWS, instead of loading all files and rebuild every cache from ground up every time
This involves some core changes, @Jermolene what's your suggesstion?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.