Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wankdanker/node-redis-index
Index and query arbitrary objects with Redis.
https://github.com/wankdanker/node-redis-index
Last synced: 2 months ago
JSON representation
Index and query arbitrary objects with Redis.
- Host: GitHub
- URL: https://github.com/wankdanker/node-redis-index
- Owner: wankdanker
- Created: 2015-12-04T20:10:33.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2020-10-06T17:22:04.000Z (over 4 years ago)
- Last Synced: 2024-04-25T06:01:57.919Z (9 months ago)
- Language: JavaScript
- Size: 80.1 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
redis-index
-----------[![Build Status](https://travis-ci.org/wankdanker/node-redis-index.svg?branch=master)](https://travis-ci.org/wankdanker/node-redis-index)
Index and query arbitrary objects with Redis.
example
-------```js
var index = require('redis-index').createIndex('item', 'item_id');index.add({ item_id : 1, name : "thing a", type : 100 });
index.add({ item_id : 2, name : "thing b", type : 100 });
index.add({ item_id : 3, name : "thing c", type : 200 });setTimeout(function () {
index.search({ name : 'b' }).or({ item_id : 1 }).exec(function (err, result) {
/*
[ { item_id : 1, name : "thing a", type : 100 },
{ item_id : 2, name : "thing b", type : 100 } ]
*/
});
}, 1000);
```api
---### RedisIndex
* RedisIndex.createIndex(options)
Create a new index to which objects may be added.
* **options** : options objects
* **key** : *string* - the namespace key to use when storing keys in redis
* **index** : *string* - the attribute which exists on an object being indexed which should be used to uniquely identify that object.
* **schemaOnly** : *boolean* - when true, only index fields identified in the schema
* **fullText** : *function* - when exists, this function will be called with each object being added to the index. The function should return a string to be indexed for full text search. This option must be present in order to enable full text search.
* **schema** : *object* - an object which identifies information about attributes encountered when indexing.
* **compress** : *object* - and object with synchronous encode and decode functions for compressing and decompressing valuesmore examples
-------------### compression
```js
var RedisIndex = require('redis-index');var index = RedisIndex.createIndex({
key : 'item'
, index : 'item_id'
, compress : RedisIndex.compression.gzip
});```
TODO
----- [x] proper tests
- [x] comparisons
- [x] deep lookups
- [ ] arrays of values
- [x] arrays of objects
- [x] automatic full deep indexing
- [x] wildcards for schema definitions
- [ ] add comparisons
- [ ] exists
- [ ] empty/notExists
- [ ] contains
- [ ] begins with
- [ ] ends with
- [x] in array (of values)
- [x] full text
- [ ] string comparisons
- [x] sorting
- [x] intersect with other indexes
- [x] store key
- [ ] add array of objects
- [x] custom string tokenizing
- [x] paging
- [x] make Promise compatible
- [x] compressionlicense
-------MIT