Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/joeybaker/lucene-escape-query
Escape a string for a lucene query. Effectively removes all special characters.
https://github.com/joeybaker/lucene-escape-query
Last synced: 6 days ago
JSON representation
Escape a string for a lucene query. Effectively removes all special characters.
- Host: GitHub
- URL: https://github.com/joeybaker/lucene-escape-query
- Owner: joeybaker
- License: other
- Created: 2015-02-26T21:27:36.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2019-02-21T20:01:05.000Z (almost 6 years ago)
- Last Synced: 2025-01-05T13:22:59.056Z (10 days ago)
- Language: Shell
- Homepage:
- Size: 14.6 KB
- Stars: 5
- Watchers: 2
- Forks: 3
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# lucene-escape-query [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Dependency Status][daviddm-url]][daviddm-image]
Escape a string for a lucene query. Effectively removes all special characters.
**Table of Contents** *generated with [DocToc](http://doctoc.herokuapp.com/)*
- [Install](#install)
- [Usage](#usage)
- [Methods](#methods)
- [escape `( string)`](#escape-string-string)
- [Tests](#tests)
- [Developing](#developing)
- [Requirements](#requirements)
- [License](#license)## Install
```sh
npm i -S lucene-escape-query
```## Usage
```js
var luceneEscapeQuery = require('lucene-escape-query')luceneEscapeQuery.escape('+Rainbow') // \+Rainbow
```## Methods
### escape `( string)`
Returns the string passed to it, with [special characters](https://lucene.apache.org/core/2_9_4/queryparsersyntax.html#Escaping Special Characters) escaped.## Tests
Tests are in [tape](https://github.com/substack/tape) and code coverage is run though [covert](https://github.com/substack/covert).* `npm test` will run both server and browser tests
* `npm run test-browser` and `npm run test-server` run their respective tests
* `npm run tdd` will run the server tests on every file change.## Developing
To publish, run `npm run release -- [{patch,minor,major}]`_NOTE: you might need to `sudo ln -s /usr/local/bin/node /usr/bin/node` to ensure node is in your path for the git hooks to work_
### Requirements
* **npm > 2.0.0** So that passing args to a npm script will work. `npm i -g npm`
* **git > 1.8.3** So that `git push --follow-tags` will work. `brew install git`## License
Artistic 2.0 © [Joey Baker](https://byjoeybaker.com)
[npm-url]: https://npmjs.org/package/lucene-escape-query
[npm-image]: https://badge.fury.io/js/lucene-escape-query.svg
[travis-url]: https://travis-ci.org/joeybaker/lucene-escape-query
[travis-image]: https://travis-ci.org/joeybaker/lucene-escape-query.svg?branch=master
[daviddm-url]: https://david-dm.org/joeybaker/lucene-escape-query.svg?theme=shields.io
[daviddm-image]: https://david-dm.org/joeybaker/lucene-escape-query