Coder Social home page Coder Social logo

jsaribeirolopes / simple-dsl Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kikobeats/simple-dsl

0.0 0.0 0.0 25 KB

Simple DSL based on <key,value> designed to work together fulltext search engines.

License: MIT License

CoffeeScript 32.38% JavaScript 67.62%

simple-dsl's Introduction

Simple DSL

Last version Build Status Dependency status Dev Dependencies Status NPM Status Donate

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 --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>

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'
// }

Related

License

MIT ยฉ Kiko Beats

simple-dsl's People

Contributors

kikobeats avatar greenkeeper[bot] avatar dependabot-preview[bot] avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.