Simple DSL based on <key,value> designed to work together fulltext search engines.
- 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 Search Engine but out of the box.
$ npm install simple-dsl --save
If you want to use in the browser (powered by Browserify):
$ bower install simple-dsl --save
and later link in your HTML:
<script src="bower_components/simple-dsl/dist/simple-dsl.js"></script>
Basically the DSL works detecting <key, value>
patterns:
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 <key, value>
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:
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:
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'
// }
- Ghost Query Language (GQL) – Filter query language for working with Ghost's API.
MIT © Kiko Beats