Package Exports
- simple-dsl
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (simple-dsl) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Simple DSL
Simple DSL based on <key,value> 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 Search Engine but out of the box.
Install
$ npm install simple-dsl --saveIf you want to use in the browser (powered by Browserify):
$ bower install simple-dsl --saveand later link in your HTML:
<script src="bower_components/simple-dsl/dist/simple-dsl.js"></script>Usage
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'
// }License
MIT © Kiko Beats