4.1.0 • Published 4 years ago
redis-index v4.1.0
redis-index
Index and query arbitrary objects with Redis.
example
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 values
more examples
compression
var RedisIndex = require('redis-index');
var index = RedisIndex.createIndex({
key : 'item'
, index : 'item_id'
, compress : RedisIndex.compression.gzip
});
TODO
- proper tests
- comparisons
- deep lookups
- arrays of values
- arrays of objects
- automatic full deep indexing
- wildcards for schema definitions
- add comparisons - exists - empty/notExists - contains - begins with - ends with - x in array (of values)
- full text
- string comparisons
- sorting
- intersect with other indexes
- store key
- add array of objects
- custom string tokenizing
- paging
- make Promise compatible
- compression
license
MIT
4.1.0
4 years ago
4.0.0
4 years ago
3.10.0
5 years ago
3.9.1
6 years ago
3.9.0
6 years ago
3.8.2
6 years ago
3.8.1
6 years ago
3.8.0
6 years ago
3.7.0
6 years ago
3.6.1
6 years ago
3.6.0
6 years ago
3.5.0
6 years ago
3.4.2
6 years ago
3.4.1
6 years ago
3.4.0
6 years ago
3.3.0
6 years ago
3.2.0
6 years ago
3.1.1
6 years ago
2.1.0
6 years ago
2.0.0
6 years ago
1.1.0
8 years ago
1.0.0
8 years ago