ctargett / refguide-asciidoc-poc

Proof of concept of Solr Ref Guide converted to asciidoc format & using Asciidoctor for publishing
2 stars 4 forks source link

Search box not working #24

Closed ctargett closed 7 years ago

ctargett commented 7 years ago

Why?

risdenk commented 7 years ago

From Chrome inspector:

Uncaught Error: SimpleJekyllSearch --- failed to get JSON (search.json)
    at throwError (http://home.apache.org/~ctargett/RefGuidePOC/jekyll-full/js/jekyll-search.js:1:3787)
    at http://home.apache.org/~ctargett/RefGuidePOC/jekyll-full/js/jekyll-search.js:1:3673
    at XMLHttpRequest.xhr.onreadystatechange (http://home.apache.org/~ctargett/RefGuidePOC/jekyll-full/js/jekyll-search.js:1:689)
risdenk commented 7 years ago

Looks like search.json isn't in the right place?

From the SimpleJekyllSearch block: dataSource: 'search.json',

ctargett commented 7 years ago

The search comes from this theme: http://idratherbewriting.com/documentation-theme-jekyll/mydoc_search_configuration.html. In the troubleshooting section of that page, there is a suggestion to look at the search.json for the site if search isn't working, and try to find any invalid JSON.

I ran the file that's generated during the build through JSONLint, and it found only a bad comma at the end of the file, before the closing bracket. I removed that from the file manually, and now the search is working.

So, next step is to figure out how the heck that errant comma is getting into the end of the JSON file.

ctargett commented 7 years ago

I filed an issue with the project for the theme: tomjohnson1492/documentation-theme-jekyll#46

Since Jekyll is designed to support both pages and posts, it seems the search is dependent on both being there.

ctargett commented 7 years ago

Fixed with PR #28. It was actually quite easy to modify the search.json file that's feeding the search box - just needed to remove the posts section and add a loop for inserting a comma between records.