RejectedSoftware Forums

Sign up

Redis command ZRANGEBYLEX

Any chance to get this command implemented ?
I just can't figure out an easy workaround for an autocomplete without it.

Any ideas ?

Thx

Re: Redis command ZRANGEBYLEX

On Mon, 09 Feb 2015 14:14:15 GMT, David D. wrote:

Any chance to get this command implemented ?
I just can't figure out an easy workaround for an autocomplete without it.

Any ideas ?

Thx

Just taking a wild guess here, but maybe this could work (in vibe.db.redis.redis struct RedisDatabase):

	/// When all the elements in a sorted set are inserted with the same score, in order to force lexicographical ordering, 
	/// this command returns all the elements in the sorted set at key with a value between min and max.
	RedisReply!T zrangeByLex(T = string)(string key, string min = "-", string max = "+", long offset = 0, long count = -1)
		if(isValidRedisValueType!T)
	{
		if (offset > 0 || count != -1) return request!(RedisReply!T)("ZRANGEBYLEX", key, min, max, "LIMIT", offset, count);
		else return request!(RedisReply!T)("ZRANGEBYLEX", key, min, max);
	}

Re: Redis command ZRANGEBYLEX

On Tue, 10 Feb 2015 17:13:27 GMT, Etienne Cimon wrote:

On Mon, 09 Feb 2015 14:14:15 GMT, David D. wrote:

Any chance to get this command implemented ?
I just can't figure out an easy workaround for an autocomplete without it.

Any ideas ?

Thx

Just taking a wild guess here, but maybe this could work (in vibe.db.redis.redis struct RedisDatabase):

	/// When all the elements in a sorted set are inserted with the same score, in order to force lexicographical ordering, 
	/// this command returns all the elements in the sorted set at key with a value between min and max.
	RedisReply!T zrangeByLex(T = string)(string key, string min = "-", string max = "+", long offset = 0, long count = -1)
		if(isValidRedisValueType!T)
	{
		if (offset > 0 || count != -1) return request!(RedisReply!T)("ZRANGEBYLEX", key, min, max, "LIMIT", offset, count);
		else return request!(RedisReply!T)("ZRANGEBYLEX", key, min, max);
	}

Etienne has kindly provided a pull request that is now merged into GIT master: #993