webidx
1.0.0
WebIdx是静态网站的客户端搜索引擎。
它通过使用简单的Perl脚本(WebIdx.pl)来生成包含静态HTML文件索引的SQLite数据库。然后,SQLite数据库与静态内容一起发布。
搜索功能是在使用SQL.JS的WebIdx.js中实现的,该功能为SQLite文件提供接口。
您可以在这里看到一个现场演示。
$ /path/to/webidx.pl -x index.html -x archives.html --xP secret_files -o https://example.com -z . ./index.db
You can run webidx.pl --help to see all the available command-line options.
< script src =" https://cdnjs.cloudflare.com/ajax/libs/sql.js/1.10.1/sql-wasm.js " > </ script >
< script src =" https://cdnjs.cloudflare.com/ajax/libs/pako/2.1.0/pako.min.js " > </ script >
< script src =" /path/to/webidx.js " > </ script > < form onsubmit =" window.webidx.search({dbfile:'/webidx.db.gz',query:document.getElementById('q').value});return false; " >
< input id =" q " type =" search " >
</ form >当用户键入搜索框中的返回键时,将弹出一个包含搜索结果的模态对话框!
The object that's passed to window.webidx.search() can have the following properties:
dbfile : URL of the SQLite database filequery : search queryresultCallback : a callback which is passed an array of search results. Each result is an object with the title and url properties.如果未定义,将显示一个模态对话框。errorCallback : a callback which is passed any error string as an argument.titleSuffix : a string to be removed from the end of page titles.titlePrefix : a string to be removed from the beginning of page titles.