diff options
author | uvok cheetah | 2020-05-23 16:01:46 +0200 |
---|---|---|
committer | uvok cheetah | 2020-05-23 16:01:46 +0200 |
commit | b73cf12240749595ee1232462f965d15e5538555 (patch) | |
tree | 0abe4bea6abea559ce5ca04003923c7a46da9417 /search.html | |
parent | 1046c86029abc29c02b679473679731752e8bc5e (diff) |
Put search and index in different file
Diffstat (limited to 'search.html')
-rw-r--r-- | search.html | 27 |
1 files changed, 2 insertions, 25 deletions
diff --git a/search.html b/search.html index 84d89a6..b4794e2 100644 --- a/search.html +++ b/search.html @@ -2,30 +2,7 @@ layout: page --- <script src="/assets/js/lunr.min.js"></script> -<script> - // data - var pages = [ - {% for post in site.posts %} - { - "id": "{{ post.url | slufigy }}", - "title": {{ post.title | jsonify }}, - "content": {{ post.content | strip_html | jsonify }}, - "url": "{{ post.url | xml_escape }}" - } - {% unless forloop.last %},{% endunless %} - {% endfor %} - ]; - - // index - var idx = lunr(function () { - this.ref('url'); - this.field('title'); - this.field('content'); - pages.forEach(function (doc) { - this.add(doc); - }, this); - }); -</script> +<script src="/assets/js/search.js"></script> <p> <input id="input_qterm"></input> @@ -40,7 +17,7 @@ layout: page <script> // search function query(queryterm) { - var result = idx.search(queryterm); + var result = do_search(queryterm); const rbase = document.getElementById("results") rbase.textContent = ""; if (result.length) { |