# alchemy-search

> The search plugin for Alchemy

Latest version **0.3.0** (published 2026-06-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install alchemy-search
pnpm add alchemy-search
yarn add alchemy-search
bun add alchemy-search
```

## Health

**Score 50/100 (C)** — status: active.

Positive: no vulnerabilities; recently updated.

Warnings: low downloads; no types; no esm support; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.3.0 |
| Published | 2026-06-24 |
| First published | 2018-08-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=8.9.0 |
| Dependencies | 1 |
| Unpacked size | 22.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | skerit |

## Links

- npm: https://www.npmjs.com/package/alchemy-search
- Repository: https://github.com/skerit/alchemy-search
- Homepage: https://github.com/skerit/alchemy-search#readme
- Issues: https://github.com/skerit/alchemy-search/issues
- npm.io page: https://npm.io/package/alchemy-search

## Dependencies (1)

- [double-metaphone](https://npm.io/package/double-metaphone.md) ~1.0.5

## Recent versions

- 0.3.0 (latest) — 2026-06-24
- 0.2.0-alpha.1 — 2024-02-17
- 0.1.0 — 2018-08-26

## README

# Alchemy Search

The search plugin for the Alchemy MVC

## Installation

Just installing the npm package can be done like this:

    $ npm install alchemy-search

## Activate

You can activate the plugin by adding this to the main `bootstrap.js` file:

```javascript
alchemy.usePlugin('search', {});
```

## Use

This plugin gives you a new behaviour `search` to add to your models,
you can do this after constituting your model.

You have to supply an options object when adding the behaviour.
Here you need to add the fields you want to make searchable and the importance of those fields.

```javascript
MyModel.constitute(function addFields() {

    // Add your fields like you normally would
    this.addField('name', 'String');
    this.addField('title', 'String', {translatable: true});
    this.addField('description', 'String', {translatable: true});

    // And finally add the search behaviour
    this.addBehaviour('search', {
        fields: {
            title       : 50,
            name        : 30,
            description : 10
        }
    });
});
```

Now, after a record of (in this example) `MyModel` has been saved, the search behaviour will create the required data in the database.

A new method has been added to the `Model` class: `touchAll(callback)`. It basically re-saves all the records in a model (without setting the `updated` date) and triggering the before- and after-save events.

Finally, you can search through the model like so:

---
_Source: https://npm.io/package/alchemy-search · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
