redisearch
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -32,6 +32,14 @@ 'use strict'; | ||
} | ||
if (!Object.keys(data).length) { | ||
throw new Error('no data to index'); | ||
} | ||
await indexData(namespace, data, id); | ||
await redisClient.zadd(namespace + ':indexed:ids' , id); | ||
}; | ||
Search.prototype.getIndexedCount = async function () { | ||
return await redisClient.zcard(this.namespace + ':indexed:ids'); | ||
}; | ||
Search.prototype.query = async function (data, start, stop) { | ||
@@ -135,2 +143,3 @@ var namespace = this.namespace; | ||
await redisClient.del(namespace + ':id:' + id + ':indices'); | ||
await redisClient.zrem(namespace + ':indexed:ids' , id); | ||
return this; | ||
@@ -137,0 +146,0 @@ }; |
@@ -5,3 +5,3 @@ { | ||
"description": "A plugin to search data with redis", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"repository": { | ||
@@ -8,0 +8,0 @@ "type": "git", |
18152
314