Merlin JavaScript Library
This is the JavaScript library for Merlin Search.
Installation
node (also browserify/webpack compatible)
npm install merlin.js
var Blackbird = ;
Browser
Usage
For usage examples, see the Search API documentation.
var engine = Blackbird; // promise style APIengine;
Fallback
Fallback handles requests that fail for a given reason, such as CORS being disabled by a firewall. Currently the only supported fallback mode is proxy
.
Pass the following in as a fallback in the Blackbird.engine
call to enable falling back to a proxy. Note that fallback is only enabled when using merlin.js in a client environment (browser).
fallback: mode: 'proxy' url: 'http://your_proxy.com' // will fallback to this URL if requests fail
Enabling falling back to a proxy will make it so the engine does the following:
- Make a request (eg.
https://search.blackbird.am/company_name.environment_name.instance_name?q=dress
) - If request or response is rejected, prepend proxy url to request URL (
http://your_proxy.com/https://search.blackbird.am/company_name.environment_name.instance_name?q=dress
) and make a request. - Set it so that the engine uses the proxy going forward (for that session).
Development
Clone the repo, then run the following:
cd merlin.jsnpm install
Build
Building compiles the webpacked files into dist/
npm run build
Running the tests (mocha)
npm test