Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/marcbachmann/simple-text-search
https://github.com/marcbachmann/simple-text-search
diacritics filter search sifter simple text umlaut
Last synced: 16 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/marcbachmann/simple-text-search
- Owner: marcbachmann
- Created: 2016-04-27T11:05:52.000Z (over 8 years ago)
- Default Branch: main
- Last Pushed: 2024-09-14T01:34:53.000Z (about 2 months ago)
- Last Synced: 2024-10-24T15:55:10.954Z (19 days ago)
- Topics: diacritics, filter, search, sifter, simple, text, umlaut
- Language: JavaScript
- Size: 167 KB
- Stars: 4
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# simple-text-search
[![Greenkeeper badge](https://badges.greenkeeper.io/marcbachmann/simple-text-search.svg)](https://greenkeeper.io/)
## Usage
```
var filter = require('simple-text-search')
var get = filter(['foo', 'bar', 'foobar'])
var results = get('foo')
// -> returns ['foo', 'foobar']
```Objects in a collection get stringified. So all properties get filtered.
You can also define a property to filter in:
```
var cities = [{id: 1, name: 'Zürich'}, {id: 2, name: 'Reykjavík'}]
var get = filter(cities, 'name')
var results = get('zurich')
// -> returns [{id: 1, name: 'Zürich'}]
```This module doesn't do any stemming except replacing umlauts.
## Alternatives
Please use [sifter](https://github.com/brianreavis/sifter.js) if you need sorting or scoring.