https://github.com/kikobeats/simple-dsl
Simple DSL based on <key,value> designed to work together fulltext search engines.
https://github.com/kikobeats/simple-dsl
Last synced: 4 months ago
JSON representation
Simple DSL based on <key,value> designed to work together fulltext search engines.
- Host: GitHub
- URL: https://github.com/kikobeats/simple-dsl
- Owner: Kikobeats
- License: mit
- Created: 2016-05-29T21:46:57.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2022-08-27T18:20:30.000Z (over 2 years ago)
- Last Synced: 2024-12-15T06:00:37.664Z (4 months ago)
- Language: JavaScript
- Homepage:
- Size: 24.4 KB
- Stars: 5
- Watchers: 3
- Forks: 7
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Simple DSL

[](https://travis-ci.org/Kikobeats/simple-dsl)
[](https://david-dm.org/Kikobeats/simple-dsl)
[](https://david-dm.org/Kikobeats/simple-dsl#info=devDependencies)
[](https://www.npmjs.org/package/simple-dsl)
[](https://paypal.me/Kikobeats)> Simple DSL based on designed to work together fulltext search engines.
## Why
- Converts a unstructured input into a structued output.
- Makes easy connect with fulltext search engines such as Solr, ElasticSearch, MongoDB, etc.
- Less than 2KB.I designed this solution for create a rapid and quickly DSL for fulltext search.
It is inspired in other solutions, such as [Github](https://github.com/search) [Search](https://help.github.com/articles/searching-issues/) Engine but **out of the box**.
## Install
```bash
$ npm install simple-dsl --save
```If you want to use in the browser (powered by [Browserify](http://browserify.org/)):
```bash
$ bower install simple-dsl --save
```and later link in your HTML:
```html
```
## Usage
Basically the DSL works detecting `` patterns:
```js
const dsl = require('simple-dsl')
dsl('is:issue status:closed bug fixed')
// {
// is: 'issue',
// status: 'closed',
// text: 'bug fixed'
// }
```When you don't provide a `` pattern (in this example `bug fixed` don't follow the format) you are creating a `text` value.
You can declare multiple values with the same key:
```js
const dsl = require('simple-dsl')
dsl('user:kiko user:javier status:closed bug fixed')
// {
// is: 'issue',
// status: 'closed',
// user: ['kiko', 'javier']
// text: 'bug fixed'
// }
```If you want to use spaces, use inside quotes:
```js
const dsl = require('simple-dsl')
dsl('user:"kiko beats" user:"javier baena" status:closed bug fixed')
// {
// is: 'issue',
// status: 'closed',
// user: ['kiko beats', 'javier baena']
// text: 'bug fixed'
// }
```## Related
- [Ghost Query Language (GQL)](https://github.com/TryGhost/GQL) – Filter query language for working with Ghost's API.
## License
MIT © [Kiko Beats](http://kikobeats.com)