Sajari Javascript SDK
The Sajari Javascript SDK provides web integration for browsers.
Sajari Search is a hosted search and recommendation service supporting instant search, faceted search, recommendations and custom matching algorithms
This module is for querying the search service. If you want automated indexing, profiling and convenience functions for rendering HTML, please check out sajari-website instead.
Table of Contents
Setup
sajari
is 11KB gzipped.
NPM, Browserify, webpack
npm install sajari --save
Getting Started
A quick example showing how to run a search using the website
search pipeline.
import { Client, Tracking } from "sajari";
const client = new Client("<project>", "<collection>");
const tracking = new Tracking();
tracking.clickTokens("url");
client.searchPipeline(
"website",
{ q: "Foo Bar", resultsPerPage: "10" },
tracking,
(err, res) => {
console.log(err || res);
}
);
The Client
object handles the requesting and callbacks.
Documentation
Documentation can be found at https://doc.esdoc.org/github.com/sajari/sajari-sdk-js/.
License
We use the MIT license
Browser Support
This library uses the Fetch API. Fetch is available on all evergreen browsers (Chrome, Firefox, Edge), see here for a more complete overview. We recommend using isomorphic-fetch to increase compatibility across other browsers and Node.js.