diff --git a/package.json b/package.json
index d1e1473..564dc92 100755
--- a/package.json
+++ b/package.json
@@ -5,6 +5,7 @@
"license": "BSD",
"dependencies": {
"@toast-ui/editor": "^3.2.0",
+ "flexsearch": "^0.7.31",
"glob": "*",
"idb-keyval": "^6.2.0",
"ig-actions": "*",
diff --git a/pwiki/page.js b/pwiki/page.js
index 96ed757..1878e23 100755
--- a/pwiki/page.js
+++ b/pwiki/page.js
@@ -2325,7 +2325,22 @@ module.System = {
RecursionError: {
text: 'RECURSION ERROR: @source(../path)' },
NotFoundError: {
- text: 'NOT FOUND ERROR: @source(./path)' },
+ //text: 'NOT FOUND ERROR: @source(./path)' },
+ text: object.doc`
+
+
+
NOT FOUND ERROR: @source(./path)
+
+
+
+ ` },
NotFoundTemplateError: {
text: 'NOT FOUND TEMPLATE ERROR: @source(../path)' },
diff --git a/pwiki/store/base.js b/pwiki/store/base.js
index 0588236..e3d0892 100755
--- a/pwiki/store/base.js
+++ b/pwiki/store/base.js
@@ -7,6 +7,8 @@
(function(require){ var module={} // make module AMD/node compatible...
/*********************************************************************/
+var flexsearch = require('flexsearch')
+
var object = require('ig-object')
var types = require('ig-types')
@@ -296,6 +298,26 @@ module.BaseStore = {
// XXX text search index (???)
+ // XXX do we index .data.text or .raw or .text
+ __search: index.makeIndex('search',
+ async function(){
+ var index = new flexsearch.Index()
+ for(var path of (await this.paths)){
+ var text = (await this.get(path)).text
+ text
+ && typeof(text) != 'function'
+ && index.add(path, text) }
+ return index }, {
+ update: async function(data, path, update){
+ update.text
+ && typeof(update.text) != 'function'
+ && (await data).add(path, update.text)
+ return data },
+ remove: async function(data, path){
+ ;(await data).remove(path)
+ return data }, }),
+ search: function(){
+ return this.__search().search(...arguments) },
//
diff --git a/pwiki2.html b/pwiki2.html
index df7eaf8..fefdd94 100755
--- a/pwiki2.html
+++ b/pwiki2.html
@@ -234,6 +234,7 @@ require.config({
'pouchdb': 'node_modules/pouchdb/dist/pouchdb',
'showdown': 'node_modules/showdown/dist/showdown',
'idb-keyval': 'node_modules/idb-keyval/dist/umd',
+ 'flexsearch': 'node_modules/flexsearch/dist/flexsearch.bundle',
}, ['ext-lib']),
},
packages: [
diff --git a/pwiki2.js b/pwiki2.js
index 61ef392..3ba48d6 100755
--- a/pwiki2.js
+++ b/pwiki2.js
@@ -4,7 +4,7 @@
* XXX ASAP start writing docs in pwiki
* - minimal/functional editor - DONE
* - WYSIWYG markdown editor/viewer (ASAP) -
-* - transparent sync
+* - transparent sync/backup
* - fs store/export in browser or a simple way to export/import...
* ...can't seem to get it to work without asking for permission
* on every startup (one more thing left to try, keeping the
@@ -17,6 +17,13 @@
* - GUI -
* - CLI -
*
+* XXX things that will help:
+* - async render (infinite scroll + search + large pages)
+* unresolved -> dom placeholder
+* iterator prepends to placeholder
+* when resolved/done remove placeholder
+* -
+*
*
* XXX macro-vars: should the vars be defined as macro: (current) or
* simply as ???