Socket
Socket
Sign inDemoInstall

amalgamatic

Package Overview
Dependencies
16
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    amalgamatic

Search all the things! Pluggable metasearch. Uses APIs when it can, scrapes otherwise, write your own plugins for things that don't already have them.


Version published
Weekly downloads
7
decreased by-79.41%
Maintainers
1
Install size
2.20 MB
Created
Weekly downloads
 

Readme

Source

Build Status

Amalgamatic

Amalgamatic is a pluggable metasearch/federated search tool. It let's you choose a series of sources to search and then search them.

Search all the things!

Installation

Install Amalgamatic and plugins with npm. For example:

# npm install --save amalgamatic amalgamatic-sfx amalgamatic-pubmed

Quickstart

// Load Amalgamatic
var amalgamatic = require('amalgamatic');

// Load some plugins to search SFX and PubMed.
var sfx = require('amalgamatic-sfx');
var pubmed = require('amalgamatic-pubmed');

// Add the plugins to Amalgamatic.
amalgamatic.add('sfx', sfx);
amalgamatic.add('pubmed', pubmed);

var callback = function (err, results) {
	if (err) {
		console.dir(err);
	} else {
		results.forEach( function (result) {
			console.log('\nCollection name: ' + result.name);
			console.dir(result.data);
		});
	}
};

// Do a search!
amalgamatic.search({searchTerm: 'medicine'}, callback);

API

amalgamatic.add(name, plugin)

Add (register) a plugin for a collection.

  • name: A string that will be used to identify the collection.
  • plugin: A plugin object.

amalgamatic.search(query, callback)

Execute a search query.

  • query: An object optionally containing the following properties
    • searchTerm: String containing the search term(s). Default is empty string which returns no results.
    • collections: Array of strings representing the plugins you wish to search. Default is to use all registered plugins.
    • maxResults: Integer representing the maximum number of results to return from each plugin. Use 0 or a negative number (or omit the property altogether) to return the default number of results from each plugin.
    • pluginCallback: A function to execute after each plugin returns a result. It is called with two parameters. * error: An Error object or null if no error occurred.
      • results: An object containing the results from the plugin.
  • callback: A function to execute after all plugins have returned results. It is called with two parameters. * error: An Error object or null if no error occurred.
    • results: An object containing all the results from all the plugins.

Plugins

Browserify

If you want to use Amalgamatic in the browser, most plugins will work fine with Browserify but they may need to be run through a CORS proxy. Fortunately, we've set up a demo.

FAQs

Last updated on 01 Feb 2016

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc