summaryrefslogtreecommitdiff
path: root/search/elasticlunr/README
blob: 8cbebea30c25a69870590baa2a6b301812b6b781 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# Search index with elasticlunr

# Create a search index which can be served statically along the 
# static HTML pages to staticlunr.js.

# generate JSON dynamically with a JSON output generator,
# see https://halfelf.org/2017/hugos-making-json/
#curl http://localhost:1313/index.json > posts.json
curl http://www.andreasbaumann.cc/index.json > posts.json

# we need nodejs and npm
npm install JSONStream event-stream

# use posts.json in a | node create_index.js pipeline
# -> results in posts_index.json
./create_index
cp posts.index ../../static/index/.

# add as static contents to hugo site

# load from JS search code on demand (first query) if possible,
# if small, do it immediatelly when loading the search widget.