doofinder
v7.0.3
Published
Javascript Library for Doofinder Search API
Downloads
759
Readme
Doofinder Library
A.K.A. js-doofinder, or just doofinder, this library makes easy to perform requests to Doofinder's search service and customize the way you present results.
Installation
The library can be installed via package managers or directly pointing to a file in jsDelivr's CDN.
Yarnpkg (Recommended)
$ yarn add doofinderNPM
$ npm install doofinderESM
import { Client } from 'doofinder';CommonJS
const { Client } = require('doofinder/commonjs');CDN
You can include the library directly in your website:
<!-- Javascript -->
<script src="//cdn.jsdelivr.net/npm/doofinder@latest/dist/doofinder.min.js"></script>TL;DR
If you only want to know how this is structured, without the details, here we go.
The library provides:
- A
Clientclass to perform requests to the Doofinder service. - A
Queryclass which provides an easy-to-use object to prepare the queries to the DoofinderClientbefore sending anything. - A
Resultclass to wrap the response from the server and access to the data through easy to use methods. - A
ClientReposingleton that holds a pool of DoofinderClientin each zone and helps instantiating them.
Quick Start
The project includes a demo you can use as inspiration. To take a look and see things you can do with it:
- Download the entire project from Github.
- Make sure you've got Node 10.x running in your system.
- From the root of the project:
- install dependencies with
$ yarn installor$ npm install.
- install dependencies with
- To run the tests, execute:
$ yarn test.
The demo markup is inside index.html and the related Javascript code can be found at playground/demo.js.
NOTICE: The demo uses a test search engine but you can use a different one, just change the value of the HASHID variable you will find inside index.html.
IMPORTANT: Doofinder protects API calls with CORS. If you change the HASHID variable defined in index.html you will have to allow localhost for your search engine in Doofinder Admin.
How to Use the Library
To familiarize yourself with using this project, you can follow the examples provided in the playground.
The key component is the demo.js file, but in order to effectively utilize it, you'll need to understand the following parameters:
- server: https://docs.doofinder.com/api/search/v6/#section/Basics/Endpoint
- secret: https://docs.doofinder.com/api/search/v6/#section/Basics/Authentication
- hashid: https://docs.doofinder.com/api/search/v6/#section/Basics/Conventions
- sessionId: https://docs.doofinder.com/api/search/v6/#section/Basics/Conventions
Documentation
IMPORTANT: This is a work in progress.
https://doofinder.github.io/js-doofinder/
Browser Support
| Browser | Standalone | ES Module | |------------------------|------------|-----------| | Edge | 15+ | 16+ | | Firefox | 32+ | 60+ | | Chrome | 55+ | 61+ | | Safari | 11+ | 11+ | | Opera | 42+ | 48+ | | Chrome for Android | 76+ | 76+ | | Firefox for Android | 68+ | 68+ | | UC Browser for Android | 12.12+ | 12.12+ | | Safari for iOS | 11+ | 11+ |
