1.4.0 • Published 9 years ago

merlin.js v1.4.0

Weekly downloads
5
License
Apache-2.0
Repository
github
Last release
9 years ago

Merlin JavaScript Library

This is the JavaScript library for Merlin Search.

Installation

node (also browserify/webpack compatible)

npm install merlin.js
var Blackbird = require('merlin.js');

Browser

<script src="merlin.browser.min.js"></script>

Usage

For usage examples, see the Search API documentation.

var engine = Blackbird.engine({
    company: 'company_name',
    environment: 'environment_name', 
    instance: 'instance_name'
});

// promise style API
engine.search({ q: 'dress' })
.then(function (res) { 
    console.log(res.body.results.numfound);
})
.catch(function (err) {
    console.error('Oh no!');
});

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:

  1. Make a request (eg. https://search.blackbird.am/company_name.environment_name.instance_name?q=dress)
  2. 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.
  3. Set it so that the engine uses the proxy going forward (for that session).

Development

Clone the repo, then run the following:

cd merlin.js
npm install

Build

Building compiles the webpacked files into dist/

npm run build

Running the tests (mocha)

npm test

Documentation

1.4.0

9 years ago

1.3.0

9 years ago

1.2.0

9 years ago

1.1.2

9 years ago

1.1.1

9 years ago

1.0.7

9 years ago

1.0.6

9 years ago

1.0.6-beta

9 years ago

1.0.5

9 years ago

1.0.4

9 years ago

1.0.3

9 years ago

0.8.0

9 years ago

0.7.0

10 years ago

0.7.0-beta.2

10 years ago

0.7.0-beta

10 years ago

0.6.4

10 years ago

0.6.3

10 years ago

0.6.2

10 years ago

0.6.1

10 years ago

0.6.0

10 years ago

0.5.10

10 years ago

0.5.9

10 years ago

0.5.8

10 years ago

0.5.7

10 years ago

0.5.6

10 years ago

0.5.5

10 years ago

0.5.4

10 years ago

0.5.3

10 years ago

0.5.2

10 years ago

0.5.1

10 years ago

0.5.0

10 years ago

0.4.3

10 years ago

0.4.1

10 years ago

0.4.0

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago