Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gromnitsky/nfts
A FTS server for static blogs; uses sqlite under the hood.
https://github.com/gromnitsky/nfts
fts5 full-text-search jekyll sqlite
Last synced: about 4 hours ago
JSON representation
A FTS server for static blogs; uses sqlite under the hood.
- Host: GitHub
- URL: https://github.com/gromnitsky/nfts
- Owner: gromnitsky
- Created: 2018-11-04T10:07:17.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2024-02-20T22:05:45.000Z (9 months ago)
- Last Synced: 2024-11-16T03:32:41.352Z (3 days ago)
- Topics: fts5, full-text-search, jekyll, sqlite
- Language: JavaScript
- Homepage:
- Size: 57.6 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Naif Full Text Search
An FTS server for static blogs; uses sqlite under the hood.
# npm -g i nfts
## Jekyll Integration
To show how a real static blog can be augmented w/ FTS, we are going
to use the repo for the RoR blog:~~~
$ git clone https://github.com/rails/weblog.git
$ cd weblog
$ bundle install
$ jekyll s --no-watch
~~~Open http://127.0.0.1:4000 to browse the blog.
From a diff terminal:
~~~
$ cd weblog
$ nfts-create -o db.sqlite3 -p _posts/ _posts/*
$ nfts-server db.sqlite3
~~~To test the server:
$ curl 'http://localhost:3000/?q=omg'
This should return an array of snippets.
Now
1. Edit `_includes/navigation.html` to add a link that is going to
invoke a search dialog:
2. Copy `web.js` file from the nfts installation dir to `weblog` dir &
rename it to `nfts.js`. It's an es6 UMD w/ 0 dependencies.
3. Add to `_config.yml`:
~~~
nfts:
dialog_toggle_btn: '#nfts__dialog_toggle'
parent_container: 'main > article'
server: http://localhost:3000
debounce: 200
~~~
4. Add the nfts initialisation to `_includes/navigation.html`:
~~~
document.addEventListener('DOMContentLoaded', () => {
new NftsDialog(JSON.parse('{{site.nfts | jsonify }}'),
file => { // post
let prefix = NftsDialog.date_fmt(file.slice(0,10))
let basename = file.slice(10+1).replace(/\.[^.]+$/, '')
return '{{site.url}}' + '/' + prefix + '/' + basename
})
})
~~~
nfts integration is complete. Restart Jekyll, make sure it has
completed the site regeneration & refresh the blog page in the
browser, click "Search" & type "omg" (you don't need to press Enter).
## API
TODO.
## License
MIT