# simple-search-language

> Complex search string parser.

Latest version **0.1.0** (published 2019-11-18) · BSD-3-Clause license · 0 weekly downloads

## Install

```sh
npm install simple-search-language
pnpm add simple-search-language
yarn add simple-search-language
bun add simple-search-language
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2019-11-18 |
| First published | 2019-11-18 |
| Weekly downloads | 0 |
| License | BSD-3-Clause |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 15.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Alex J Burke @alexjeffburke |
| Maintainers | alexjeffburke |

## Links

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

## Dependencies (1)

- [unicoderegexp](https://npm.io/package/unicoderegexp.md) 0.3.0

## Recent versions

- 0.1.0 (latest) — 2019-11-18

## README

# Simple Search Language

The module is a parser for complex search strings.

It allows deriving a structured representation from a serach string
that can contain complex operators. It is intended for sitations
where a complex query against a text field is inut as a string.

## Usage

When imported the module exports a function that allows the caller
to supply a list of labels that are supported when parsing. Doing
so will return a function that will parse a given query with the
supplied search query:

```js
const simpleSearchLanguage = require('simple-search-language');

const processSearch = simpleSearchLanguage({
  labels: ['somelabel', 'otherlabel']
});
```

The function that is returned can then be called to with a given
search term and the output requested in a given format:

```js
const parsedResult = processSearch('foo bar somelabel:baz', { format: 'json' });
```

## Search Language representations

A query in this language has roughly this grammer:

    token = list | "-" token | text | Label text
    list  = "(" expr ")"
    expr  = token | token OR expr | token (AND) expr
    Label = (from: | to: | cc: | bcc: | subject:) text
    text  = "a-z"+ | '"' [^"]+ '"'

- The (AND) is implicit (but should maybe be explicit?)

## License

simple-search-language is licensed under a standard
3-clause BSD license -- see the `LICENSE`-file for details.

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