Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added lunr search to site #77

Closed
wants to merge 2 commits into from
Closed

added lunr search to site #77

wants to merge 2 commits into from

Conversation

mitzimorris
Copy link
Member

@mitzimorris mitzimorris commented Dec 27, 2018

added search to site via lunr.js, a lightweight search engine.

because GitHub pages don't allow any plugins, all search needs to be done client-side.
the search form downloads the compiled search index in file searchIdx.json.
this file is essentially a lookup table from keywords to the documents in which they occur.

the directory _tools contains scripts used to build and test this index. the compiled index has been checked into the set of jekyll source files, again because GitHub doesn't allow jekyll plugins for site generation.

the index is compiled from generated file _site/docsArray.json. pre-compiling this index speeds up search. the top-level file docsArray.json contains the logic which determines which pages to index. all documentation and interface pages are indexed; the rest of the site isn't - this provides the cleanest set of search results.

in order to index the html pages in the case-studies directory I had to add yaml headers to each file.

in order to get search working I had to remove some javascript libraries which were throwing errors. I tried to get rid of some fancy effects from the so-simple-theme which might have been causing the browser weirdness with the toolbar that Daniel saw. not sure that this works. the swoopy image for the typical set somehow got lost - is this OK?

to test this:

checkout out branch feature/lunr-search
run bundle exec jekyll serve
test in all broswers.

@mitzimorris
Copy link
Member Author

@syclik happy to get together for a code review.

@mitzimorris
Copy link
Member Author

mitzimorris commented Dec 28, 2018

I think this should be expanded to include search over the Stan manuals which are (currently) in docs repo.
see #78

Copy link
Member

@VMatthijs VMatthijs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool! I tried this in Chrome, Firefox, Edge and Internet Explorer on Windows 10 and it seems to be working fine. Have you tried it in Safari? Are there any other browsers we should test?

@mitzimorris
Copy link
Member Author

great news - many thanks!
not merging yet - I think that we need to add search over the documentation first.
the site navigation and URLS make it look like there're part of the site, which they are - it's just they're in a different repo and generated in a different way.

@mitzimorris
Copy link
Member Author

investigating Algolia search instead.

@mitzimorris
Copy link
Member Author

investigating Algolia search instead. Lunr.js is too limited given the way that we're cross-linking to other stan-dev github repos.

@mitzimorris mitzimorris deleted the feature/lunr-search branch March 11, 2020 16:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants