1
0
Fork 0
📘 The easiest way to add search to your documentation.
Find a file
Pixelastic 7b6c219a7e test(getAutocompleteSource): Add tests for source
I had to change some methods to static to be able to tests them
without instantiating a new DocSearch. I also used better `restore`
methods of sinon.js.

I did not manage to correctly test the promise returned by the method
returned by getAutocompleteSource. I would have like to test that when
resolved it correctly call reformatHits on the data as well as call
the callback on the reformated hits but got confused in
spying/stubbing/mocking the promise.
2015-12-18 16:44:43 +01:00
dev feat(styling): Set grayscale as default, add styling as external file 2015-12-15 12:32:57 +01:00
docs Docs: add a "Join the beta" form. 2015-12-16 18:40:08 +01:00
scripts test(DocSearch): Add tests for constructor 2015-12-18 13:17:25 +01:00
src test(getAutocompleteSource): Add tests for source 2015-12-18 16:44:43 +01:00
test test(getAutocompleteSource): Add tests for source 2015-12-18 16:44:43 +01:00
.babelrc test(DocSearch): Add tests for constructor 2015-12-18 13:17:25 +01:00
.eslintignore chore(release): remove old references to es5-module 2015-12-16 11:42:36 +01:00
.eslintrc chore(skeleton): Provide basic library skeleton 2015-11-26 12:03:01 +01:00
.gitignore Ignore dist files 2015-12-16 19:09:13 +01:00
.npmignore chore(skeleton): Provide basic library skeleton 2015-11-26 12:03:01 +01:00
.travis.yml chore(release): add release process similar to instantsearch.js 2015-12-15 16:15:13 +01:00
CHANGELOG.md v0.0.6 2015-12-16 12:13:30 +01:00
CONTRIBUTING.md chore(release): git add CONTRIBUTING too 2015-12-16 11:53:29 +01:00
index.js feat(main): Add main wrapper 2015-11-26 16:10:06 +01:00
npm-shrinkwrap.json v0.0.6 2015-12-16 12:13:30 +01:00
package.json test(DocSearch): Add tests for constructor 2015-12-18 13:17:25 +01:00
README.md v0.0.2 2015-12-16 11:51:09 +01:00
webpack.config.jsdelivr.babel.js chore(build): allow npm link and inject NODE_ENV 2015-12-16 12:04:01 +01:00
webpack.dev.config.babel.js test(DocSearch): Add tests for constructor 2015-12-18 13:17:25 +01:00

Table of Contents generated with DocToc

docsearch

Add a search autocomplete to any documentation.

Currently on-demand, send an email to docsearch@algolia.com if you want documentation search on your website.

Usage

<link rel="stylesheet" href="//cdn.jsdelivr.net/docsearch.js/0/docsearch.min.css" />
<script src="//cdn.jsdelivr.net/docsearch.js/0/docsearch.min.js"></script>
documentationSearch({
  apiKey: apiKey, // Mandatory
  indexName: indexName, // Mandatory
  inputSelector: '#search-input' // Mandatory
});

Examples

How do I get an apiKey and indexName?

Send us an email with the url of the documentation website you would like to add search to.

How does it work?

The JavaScript library is a wrapper on top of our autocomplete.js library, along with default CSS styling of the dropdown.

The indexing of the website data itself is currently done by an internal tool (to be released).

Indexing of websites using docsearch takes places every day.

Development workflow

Local example

We use a simple documentation example website as a way to develop the docsearch.js library.

Requirements:

npm run dev
# open http://localhost:8080

Documentation website

This is the Jekyll instance running at https://community.algolia.com/docsearch.

Requirements:

npm run dev:docs
# open http://localhost:4000/docsearch/

MacOS

If you are using brew and you had brew install openssl, you may need to configure the build path of eventmachine with

bundle config build.eventmachine --with-cppflags=-I$(brew --prefix openssl)/include