Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

universal-search

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

universal-search

Unified front-end client for various 3rd-party search services.

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

This is a unified front-end client to integrate various 3rd-party search services. It is made to enable searching on platforms like Hexo, Ghost, and any general websites that don't already have searching.

Please keep in mind that this plugin is only a front-end client. You still need to register and configure the services, including create and upload site indexes. For detailed instruction on registration and configuration of these search services, please refer to my series of tutorials:

Please also be aware that this front-end client requires jQuery.

Production

  • Copy files under /dist directory into your project. For .js file, only copy the files with a suffix of the search service you are going to use.
  • Make sure you have jQuery loaded on your page.
  • Load the contents in style.css and universal-search.js on your page.
  • Enable a search service like the following examples:

Use universal-search-google.js or universal-search-google.min.js.

var customSearch;
(function() {
  customSearch = new GoogleCustomSearch({
    apiKey: "YOUR_GOOGLE_CUSTOM_SEARCH_API_KEY",
    engineId: "YOUR_GOOGLE_CUSTOM_SEARCH_ENGINE_ID"
  });
})();

Use universal-search-algolia.js or universal-search-algolia.min.js.

var customSearch;
(function() {
  customSearch = new AlgoliaSearch({
    apiKey: "YOUR_ALGOLIA_API_KEY",
    appId: "YOUR_ALGOLIA_APPLICATION_ID",
    indexName: "YOUR_ALGOLIA_INDEX_NAME"
  });
})();

Use universal-search-hexo.js or universal-search-hexo.min.js.

var customSearch;
(function() {
  customSearch = new HexoSearch();
})();

Use universal-search-azure.js or universal-search-azure.min.js.

var customSearch;
(function() {
  customSearch = new AzureSearch({
    serviceName: "YOUR_AZURE_SERVICE_NAME",
    indexName: "YOUR_AZURE_INDEX_NAME",
    queryKey: "YOUR_AZURE_QUERY_KEY"
  });
});

Baidu Search (dev in progress)

Use universal-search-baidu.js or universal-search-baidu.min.js.

var customSearch;
(function() {
  customSearch = new BaiduSearch({
    apiId: "YOUR_BAIDU_API_ID"
  });
})();

You must keep the relative path of style.css and /fonts, otherwise your need to change the paths in style.less to make sure it finds the font files.

Demo

This repository contains a demo folder. Please replace your credentials in demo/config.js to preview.

Development

Clone this project and install.

git clone https://github.com/artchen/universal-search.git
npm install
gulp

To change the HTML template, please modify src/template.html and replace the corresponding variable in src/universal-search.js.

Keywords

FAQs

Package last updated on 03 Oct 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc