Coder Social home page Coder Social logo

dengliming / redis-modules-java Goto Github PK

View Code? Open in Web Editor NEW
79.0 8.0 26.0 27.86 MB

Java client libraries for redis-modules https://redis.io/modules, based on Redisson. https://github.com/redisson/redisson

License: Apache License 2.0

Java 99.37% Python 0.63%
redisson redis-client redis java-client redisbloom redis-search redis-modules timeseries redisai redis-ai

redis-modules-java's Introduction

build java-version Maven Central license codecov

Java Client libraries for redis-modules, based on Redisson.

Support

TODO

Installing

Build from source

Execute ./mvnw clean install -DskipTests=true -Dgpg.skip. The build process requires JDK8+.

Maven repository

Include all

<!-- release -->
<dependency>
    <groupId>io.github.dengliming.redismodule</groupId>
    <artifactId>all</artifactId>
    <version>2.0.3</version>
</dependency>

Include single module like:

<!-- release -->
<dependency>
    <groupId>io.github.dengliming.redismodule</groupId>
    <artifactId>redistimeseries</artifactId>
    <version>2.0.3</version>
</dependency>

Usage example

RedisBloom

Config config = new Config();
config.useSingleServer().setAddress("redis://127.0.0.1:6379");
RedisBloomClient redisBloomClient = new RedisBloomClient(config);

BloomFilter bloomFilter = redisBloomClient.getRBloomFilter("bf");
bloomFilter.create(0.1d, 100);
bloomFilter.madd(new String[] {"a", "b", "c"});

TopKFilter topKFilter = redisBloomClient.getTopKFilter("topk_add");
topKFilter.reserve(1, 2000, 7, 0.925d);
topKFilter.add("test");
List<Boolean> itemExits = topKFilter.query("test");
Map<String, Integer> itemIncrement = new HashMap<>();
itemIncrement.put("test", 3);
topKFilter.incrby(itemIncrement);
List<String> allItems = topKFilter.list();

CountMinSketch countMinSketch = redisBloomClient.getCountMinSketch("cms_add");
countMinSketch.create(10, 10);
CountMinSketchInfo countMinSketchInfo = countMinSketch.getInfo();

CuckooFilter cuckooFilter = redisBloomClient.getCuckooFilter("cf_insert");
List<Boolean> result = cuckooFilter.insert(-1L, false, "a");

redisBloomClient.shutdown();

RediSearch

Config config = new Config();
config.useSingleServer().setAddress("redis://" + DEFAULT_HOST + ":" + DEFAULT_PORT);
RediSearchClient rediSearchClient = new RediSearchClient(config);

RediSearch rediSearch = rediSearchClient.getRediSearch("testSearch");
rediSearch.createIndex(new Schema()
    .addField(new TextField("title"))
    .addField(new TextField("content"))
    .addField(new Field("age", FieldType.NUMERIC))
    .addField(new Field("location", FieldType.GEO)));

Map<String, Object> fields = new HashMap<>();
fields.put("title", "Hi");
fields.put("content", "OOOO");
rediSearch.addDocument(new Document(String.format("doc1"), 1.0d, fields), new DocumentOptions());

// Search with NumericFilter
SearchResult searchResult = rediSearch.search("number", new SearchOptions()
                .noStopwords()
                .language(RSLanguage.ENGLISH)
                .filter(new NumericFilter("age", 1, 4)));

// Search with GeoFilter
searchResult = rediSearch.search("number", new SearchOptions()
                .noStopwords()
                .language(RSLanguage.ENGLISH)
                .filter(new GeoFilter("location", 15, 37, 200, GeoFilter.Unit.KILOMETERS)));

RedisTimeSeries

Config config = new Config();
config.useSingleServer().setAddress("redis://192.168.50.16:6383");
RedisTimeSeriesClient redisTimeSeriesClient = new RedisTimeSeriesClient(config);

RedisTimeSeries redisTimeSeries = redisTimeSeriesClient.getRedisTimeSeries();
long timestamp = System.currentTimeMillis();
redisTimeSeries.add(new Sample("temperature:2:32", Sample.Value.of(timestamp, 26)), new TimeSeriesOptions()
                .retentionTime(6000L)
                .unCompressed()
                .labels(new Label("sensor_id", "2"), new Label("area_id", "32")));
redisTimeSeriesClient.shutdown();

RedisAI

Config config = new Config();
config.useSingleServer().setAddress("redis://127.0.0.1:6379");
RedisAIClient redisAIClient = new RedisAIClient(config);

RedisAI redisAI = redisAIClient.getRedisAI();
redisAI.setTensor("tensor1", DataType.FLOAT, new int[]{2, 2}, null, new String[]{"1", "2", "3", "4"});
redisAIClient.shutdown();

RedisGears

Config config = new Config();
config.useSingleServer().setAddress("redis://127.0.0.1:6379");
RedisGearsClient redisGearsClient = new RedisGearsClient(config);

RedisGears redisGears = redisGearsClient.getRedisGears();
redisGears.pyExecute("GB().run()", false);
redisGearsClient.shutdown();

RedisJSON

Config config = new Config();
config.useSingleServer().setAddress("redis://127.0.0.1:6379");
RedisJSONClient redisJSONClient = new RedisJSONClient(config);

RedisJSON redisJSON = redisJSONClient.getRedisJSON();
String key = "foo";
Map<String, Object> m = new HashMap<>();
m.put("id", 1);
m.put("name", "lisi");
redisJSON.set(key, SetArgs.Builder.create(".", GsonUtils.toJson(m)));
Map<String, Object> actual = redisJSON.get(key, Map.class, new GetArgs().path(".").indent("\t").newLine("\n").space(" "));
redisJSONClient.shutdown();

SpringBoot Starter

see spring-boot-starter

License

Apache License 2.0

redis-modules-java's People

Contributors

dengliming avatar dependabot[bot] avatar gmhe avatar lgtm-com[bot] avatar pariskeras avatar raingoal avatar regisoliveira avatar snyk-bot avatar xdev-developer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

redis-modules-java's Issues

Building a ReactNative/Android client on redis-modules-java

We are working on creating a Redis client for ReactNative/Android environment, by building wrapper around redis-modules-java (RedisJSON module usage)

We seek some consulting from a redis-mudules-java expert for this effort

Anyone our there wanna make some consulting $ by helping us out on this Redis client for ReactNative project?

Thank you!

Support for FT.CREATE PREFIX Parameter

  FT.CREATE {index}
    [ON {structure}]
       [PREFIX {count} {prefix} [{prefix} ..]
       [FILTER {filter}]
       [LANGUAGE {default_lang}]
       [LANGUAGE_FIELD {lang_field}]
       [SCORE {default_score}]
       [SCORE_FIELD {score_field}]
       [PAYLOAD_FIELD {payload_field}]
    [MAXTEXTFIELDS] [TEMPORARY {seconds}] [NOOFFSETS] [NOHL] [NOFIELDS] [NOFREQS] [SKIPINITIALSCAN]
    [STOPWORDS {num} {stopword} ...]
    SCHEMA {field} [TEXT [NOSTEM] [WEIGHT {weight}] [PHONETIC {matcher}] | NUMERIC | GEO | TAG [SEPARATOR {sep}] ] [SORTABLE][NOINDEX] ...

PREFIX {count} {prefix} tells the index which keys it should index. You can add several prefixes to index. Since the argument is optional, the default is * (all keys)

redis search client failed with message of "NOAUTH Authentication required"

Enviroment:
redis-module-java version 2.0.2, redis-6.2.6 cluster with password enabled

Description:
my code is as below:

Config config = new Config();
config.useClusterServers().addNodeAddress("redis://10.200.5.119:7001", "redis://10.200.5.119:7002", "redis://10.200.5.119:7003",
"redis://10.200.5.119:7004", "redis://10.200.5.119:7005", "redis://10.200.5.119:7006").setPassword("mypass");
RediSearchClient rediSearchClient = new RediSearchClient(config);
RediSearch rediSearch = rediSearchClient.getRediSearch("userIdx");
rediSearch.dropIndex();

when running dropIndex command, it failed as:
org.redisson.client.RedisAuthRequiredException: NOAUTH Authentication required.. channel: [id: 0x03aaa652, L:/10.53.2.3:53298 - R:10.200.5.119/10.200.5.119:7002] data: CommandData [promise=RedissonPromise [promise=ImmediateEventExecutor$ImmediatePromise@4af4571(incomplete)], command=(FT.DROP), params=[userIdx], codec=org.redisson.codec.MarshallingCodec]

it seems the password is not effective.
please check if it is a bug or not?

lizhao

About the use of tools

image
Now there is a JSON in this address. I want to increase the ID by 1. The path and configuration are written as follows
image
However, an error is reported, saying that the address configuration is incorrect. How to write this address? Can you give an example? Thank you
image

Does not work with MsgPackJacksonCodec

Question

  I found that RedisJSON does not support msgpack, even though I have specified MsgPackJacksonCodec. When executing JSON.SET or JSON.GET, io.github.dengliming.redismodule.redisjson.RedisJSON has been hard-coded to use StringCodec. Could you tell me why msgpack is not supported? Because our json object is very large, we hope to use msgpack to compress. Is there any way to support msgpack?

code

    @Test
    public void test01() throws Exception {
    final Config config = new Config();
    // using msgpack
    config.setCodec(new MsgPackJacksonCodec())
            // single redisjson
            .useSingleServer().setAddress("redis://" + host + ":" + port);

    RedisJSONClient client = new RedisJSONClient(config);
    final String key = "user:redisjson";
    final RedisJSON redisJSON = client.getRedisJSON();
    final ReUser user = ReUser.random();
    redisJSON.set(key, SetArgs.Builder.create(".", JsonUtil.toJson(user)));
    }

Try with Redission

  I tried to execute the JSON.SET command directly through Redission, but the following error was reported. I did not find any related questions in stackoverflow or google. I would appreciate it if you can provide any suggestions.

code

    @Test
    public void test02() throws Exception {
        String jsonSetScriptCode = "local key = KEYS[1];"
                + "local value = ARGV[1];"
                + "return redis.call('JSON.SET', key, '.', value);";
        final RedissonUser user = RedissonUser.random(1);
        final Object ret = redisson.getScript(codec)
                .eval(
                        RScript.Mode.READ_WRITE,
                        jsonSetScriptCode,
                        RScript.ReturnType.VALUE,
                        Lists.newArrayList("redisson:user" + user.getId()),
                        // new Object[]{objectMapper.writeValueAsBytes(user)}
                        user
                );
        System.out.println(ret);
    }

exception


org.redisson.client.RedisException: ERR Error running script (call to f_fb235438204ece97ce6c81a04f6f210eb59e47f0): @user_script:1: Couldn't parse as UTF-8 string. channel: [id: 0x3aa51975, L:/172.18.53.208:5755 - R:10.3.12.131/10.3.12.131:8080] command: (EVAL), promise: RedissonPromise [promise=ImmediateEventExecutor$ImmediatePromise@5808a1c9(incomplete)], params: [local key = KEYS[1];local value = ARGV[1];return redis.call('JSON.SET', key, '.', value);, 1, redisson:user1, PooledUnsafeDirectByteBuf(ridx: 0, widx: 258, cap: 512)]

	at org.redisson.client.handler.CommandDecoder.decode(CommandDecoder.java:370)
	at org.redisson.client.handler.CommandDecoder.decodeCommand(CommandDecoder.java:198)
	at org.redisson.client.handler.CommandDecoder.decode(CommandDecoder.java:137)
	at org.redisson.client.handler.CommandDecoder.decode(CommandDecoder.java:113)

Get multiple properties of object

How does Java get multiple attributes?

127.0.0.1:6379> json.set b . '{"name":"abcd","age":1,"type":1}'
ok
127.0.0.1:6379> json.get a
"{"name":"abcd","age":1,"type":1}"
//Get multiple properties
127.0.0.1:6379> json.get a name age
"{"age":1,"name":"abcd"}"

How to obtain multiple attributes? I don't see a corresponding method in the source code

截屏2022-01-21 18 15 00

RedisTimeSeries: Support TS.MRANGE/MREVRANGE GROUPBY <label> REDUCE <reducer>

The following PR RedisTimeSeries/RedisTimeSeries#617 added support for multi-series aggregations to RedisTimeSeries.

It adds GROUPBY <label> REDUCE <reducer> to TS.MRANGE/TS.MREVRANGE. It accepts SUM, MIN, MAX reducers and works with unaligned series.

Sample request:

TS.MRANGE 1451679382646 1451682982646 WITHLABELS 
AGGREGATION MAX 60000 
FILTER measurement=cpu 
      fieldname=usage_user 
      hostname=(host_9,host_3,host_5,host_1,host_7,host_2,host_8,host_4)
GROUPBY hostname REDUCE MAX

Reply labels array structure

Labels:

  • <label>=<groupbyvalue>
  • __reducer__=<reducer>
  • __source__=key1,key2,key3

Sample output:

127.0.0.1:6379> ts.add ts1 1 90 labels metric cpu name system
(integer) 1
127.0.0.1:6379> ts.add ts1 2 45 labels metric cpu name system
(integer) 2
127.0.0.1:6379> ts.add ts2 2 99 labels metric cpu name user
(integer) 2
127.0.0.1:6379> ts.add ts3 2 02 labels metric cpu name system
(integer) 2

MAX reducer sample output

127.0.0.1:6379> ts.mrange - + withlabels filter metric=cpu groupby name reduce max
1) 1) "name=system"
   2) 1) 1) "name"
         2) "system"
      2) 1) "__reducer__"
         2) "max"
      3) 1) "__source__"
         2) "ts1,ts3"
   3) 1) 1) (integer) 1
         2) 90
      2) 1) (integer) 2
         2) 45
2) 1) "name=user"
   2) 1) 1) "name"
         2) "user"
      2) 1) "__reducer__"
         2) "max"
      3) 1) "__source__"
         2) "ts2"
   3) 1) 1) (integer) 2
         2) 99

MIN reducer sample output

127.0.0.1:6379> ts.mrange - + withlabels filter metric=cpu groupby name reduce min
1) 1) "name=system"
   2) 1) 1) "name"
         2) "system"
      2) 1) "__reducer__"
         2) "min"
      3) 1) "__source__"
         2) "ts1,ts3"
   3) 1) 1) (integer) 1
         2) 90
      2) 1) (integer) 2
         2) 2
2) 1) "name=user"
   2) 1) 1) "name"
         2) "user"
      2) 1) "__reducer__"
         2) "min"
      3) 1) "__source__"
         2) "ts2"
   3) 1) 1) (integer) 2
         2) 99

help: JSON text field changed after set

I use below code to set props into redis,

this.redisJSON.set(key, SetArgs.Builder.create(".", GsonUtils.toJson(props)));

the props is as below: {"id":179508,"source":2,"sourceId":25639,"customerId":"1002387371","phone":"+85265249758","registrationTime":1689661912,"appId":59,"appName":"xxx","appType":2,"channelName":"xxx","primaryChannelId":"10006","registryEntry":"xxx","status":0,"openId":"oeh6j5MxdPxbHP-BHYLvIbvaELcw"},
but after it is set, the phone field is change to "85265249758" sometimes, and the "+" is lost, is there any bug for above code?

RediSearch - NoContent option not working

Hi there,

first, thanks for creating & maintaining this library.

I am using the redisearch module and tried to search for documents with NOCONTENT option set.
The following would be a sample request (in Kotlin):

myIndex.searchAsync("@foo:{bar}", SearchOptions().noContent())

However, for a result set of 1 document I get the following exception:

java.lang.IndexOutOfBoundsException: Index 2 out of bounds for length 2
	at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64)
	at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70)
	at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:248)
	at java.base/java.util.Objects.checkIndex(Objects.java:372)
	at java.base/java.util.ArrayList.get(ArrayList.java:459)
	at io.github.dengliming.redismodule.redisearch.protocol.decoder.SearchResultDecoder.decode(SearchResultDecoder.java:58)
	at io.github.dengliming.redismodule.redisearch.protocol.decoder.SearchResultDecoder.decode(SearchResultDecoder.java:31)
	at org.redisson.client.protocol.decoder.ListMultiDecoder2.decode(ListMultiDecoder2.java:47)
	at org.redisson.client.handler.CommandDecoder.decodeList(CommandDecoder.java:436)
	at org.redisson.client.handler.CommandDecoder.decode(CommandDecoder.java:392)
	at org.redisson.client.handler.CommandDecoder.decodeCommand(CommandDecoder.java:198)
	at org.redisson.client.handler.CommandDecoder.decode(CommandDecoder.java:137)
	at org.redisson.client.handler.CommandDecoder.decode(CommandDecoder.java:113)
	at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:510)
	at io.netty.handler.codec.ReplayingDecoder.callDecode(ReplayingDecoder.java:366)
	at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:279)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
	at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
	at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
	at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166)
	at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:722)
	at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:658)
	at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:584)
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:496)
	at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	at java.base/java.lang.Thread.run(Thread.java:834)

It seems that the logic at SearchResultDecoder for whether noContent was set or not is incorrect. At least, for the case where total == parts.get(0) == 1, parts.size() + 1 would equal 3, as parts.get(1) is the id of the document.

@Override
    public SearchResult decode(List<Object> parts, State state) {
        Long total = (Long) parts.get(0);
        int documentSize = withScores ? 3 : 2;
        boolean noContent = total == parts.size() + 1;

        List<Document> documents = new ArrayList<>(total.intValue());
        // Checks the document size. DocumentSize equals to 2 means only key and parts. DocumentSize equals to 3 means
        // key, score and parts. Created separated IFs to avoid checking this logic each  document. Also  changed  the
        // step size to reduce numbers of interactions
        if (documentSize == 2) {
            //Only key and parts
            for (int i = 1; i < parts.size(); i += documentSize) {
                if (noContent) {
                    documents.add(new Document((String) parts.get(i), 1.0d, null));
                } else {
                    documents.add(new Document((String) parts.get(i), 1.0d, (Map<String, Object>) parts.get(i + 1)));
                }
            }
        } else {
        // ...

I'm not sure though how to fix this, any ideas? Just removing the + 1 part would surely do the trick, but does is still work with other result / document sizes?

Best regards,
Alex

Revrange function not found

Hi dengliming!

I'm using your redis modul. It's fantastic, it works very well!
I tried to run revrange command, but it is not implemented yet. Are you planning to add this feature to the libs?

Thanks!

search failed with cluster

centos7.9, redis-6.2.5, I create a cluster with 6 nodes, and json set one document as:

RediSearchClient rediSearchClient = new RediSearchClient(config);
RediSearch rediSearch = rediSearchClient.getRediSearch("testSearch");
rediSearch.dropIndex();
rediSearch.createIndex(new io.github.dengliming.redismodule.redisearch.index.schema.Schema()
.addField(new io.github.dengliming.redismodule.redisearch.index.schema.TextField("title"))
.addField(new io.github.dengliming.redismodule.redisearch.index.schema.TextField("content"))
.addField(new Field("age", FieldType.NUMERIC))
.addField(new Field("location", FieldType.GEO)));
Map<String, Object> fields = new HashMap<>();
fields.put("title", "Hi");
fields.put("content", "OOOO");
RedisJSONClient redisJSONClient = new RedisJSONClient(config);
RedisJSON redisJSON = redisJSONClient.getRedisJSON();
redisJSON.set("user1", SetArgs.Builder.create(".", GsonUtils.toJson(fields)));

and search without filter as:
SearchResult searchResult = rediSearch.search("*", new SearchOptions()
.noStopwords()
.language(RSLanguage.ENGLISH));

but the result is:
{
total: 0,
documents: [ ]
}

what's wrong with my search?

update example

modify individual attribute values

json.set user $.name '"HuFei"'

RediSearch - NoContent option not working with JSON doc

I use JSON document with redis search, it looks like:
key: user:10003:1000821:1024445:1
value: {"source":1,"sourceId":1024445,"id":1000821,"customerId":"1001906161","phone":"0","primaryChannelId":"10003","channelName":"","appId":13,"appName":"","appType":2,"nickName":"OK?","isBind":0,"status":0,"openId":"oyhUG5rn_FwPwGKIZk8BqX4ZSvlo","birthday":"","sex":1,"idCardType":10,"passportNo":"","registrationTime":1588252808,"registry_entry":""}

but when I search with NoContent option as:
io.github.dengliming.redismodule.redisearch.search.SearchResult searchResult = rediSearch.search("*", new SearchOptions()
.noContent());
if failed with below message:
2022-11-14 15:19:15.818 ERROR 232 --- [sson-netty-2-15] o.r.client.handler.ErrorsLoggingHandler : Exception occured. Channel: [id: 0x72ba1f99, L:/10.53.2.3:55239 - R:10.200.5.120/10.200.5.120:7004]
io.netty.handler.codec.DecoderException: java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Map
at io.netty.handler.codec.ReplayingDecoder.callDecode(ReplayingDecoder.java:421) ~[netty-codec-4.1.72.Final.jar:4.1.72.Final]
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:276) ~[netty-codec-4.1.72.Final.jar:4.1.72.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) [netty-transport-4.1.72.Final.jar:4.1.72.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) [netty-transport-4.1.72.Final.jar:4.1.72.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) [netty-transport-4.1.72.Final.jar:4.1.72.Final]
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410) [netty-transport-4.1.72.Final.jar:4.1.72.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) [netty-transport-4.1.72.Final.jar:4.1.72.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) [netty-transport-4.1.72.Final.jar:4.1.72.Final]
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919) [netty-transport-4.1.72.Final.jar:4.1.72.Final]
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166) [netty-transport-4.1.72.Final.jar:4.1.72.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:722) [netty-transport-4.1.72.Final.jar:4.1.72.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:658) [netty-transport-4.1.72.Final.jar:4.1.72.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:584) [netty-transport-4.1.72.Final.jar:4.1.72.Final]
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:496) [netty-transport-4.1.72.Final.jar:4.1.72.Final]
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:986) [netty-common-4.1.72.Final.jar:4.1.72.Final]
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) [netty-common-4.1.72.Final.jar:4.1.72.Final]
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) [netty-common-4.1.72.Final.jar:4.1.72.Final]
at java.lang.Thread.run(Thread.java:748) [na:1.8.0_181]
Caused by: java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Map
at io.github.dengliming.redismodule.redisearch.protocol.decoder.SearchResultDecoder.decode(SearchResultDecoder.java:58) ~[redisearch-1.0.5.jar:na]
at io.github.dengliming.redismodule.redisearch.protocol.decoder.SearchResultDecoder.decode(SearchResultDecoder.java:31) ~[redisearch-1.0.5.jar:na]
at org.redisson.client.protocol.decoder.ListMultiDecoder2.decode(ListMultiDecoder2.java:47) ~[redisson-3.16.6.jar:3.16.6]
at org.redisson.client.handler.CommandDecoder.decodeList(CommandDecoder.java:436) ~[redisson-3.16.6.jar:3.16.6]
at org.redisson.client.handler.CommandDecoder.decode(CommandDecoder.java:392) ~[redisson-3.16.6.jar:3.16.6]
at org.redisson.client.handler.CommandDecoder.decodeCommand(CommandDecoder.java:198) ~[redisson-3.16.6.jar:3.16.6]
at org.redisson.client.handler.CommandDecoder.decode(CommandDecoder.java:137) ~[redisson-3.16.6.jar:3.16.6]
at org.redisson.client.handler.CommandDecoder.decode(CommandDecoder.java:113) ~[redisson-3.16.6.jar:3.16.6]
at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:507) ~[netty-codec-4.1.72.Final.jar:4.1.72.Final]
at io.netty.handler.codec.ReplayingDecoder.callDecode(ReplayingDecoder.java:366) ~[netty-codec-4.1.72.Final.jar:4.1.72.Final]
... 17 common frames omitted

but with page(0,0) option as:
io.github.dengliming.redismodule.redisearch.search.SearchResult searchResult = rediSearch.search("*", new SearchOptions()
.page(new Page(0,0)));

it was ok then, is it a bug or not?

lizhao

multBy method use the incr?

public String multBy(String key, String path, long num) {
    return commandExecutor.get(incrByAsync(key, path, num));
}

RedisBloom: Support for T-Digest data structure

Given RedisBloom/RedisBloom#285 there is the following set of commands we should enable:

  • TDIGEST.CREATE: Allocate a new histogram
  • TDIGEST.RESET: Empty out a histogram and re-initialize it
  • TDIGEST.ADD: Add a value to the t-Digest with the specified count
  • TDIGEST.MERGE: Merge one t-Digest into another
  • TDIGEST.CDF: Returns the fraction of all points added which are ≤ x.
  • TDIGEST.QUANTILE: Returns an estimate of the cutoff such that a specified fraction of the data added to the t-Digest would be less than or equal to the cutoff.
  • TDIGEST.MIN: Get the minimum value from the histogram. Will return DBL_MAX if the histogram is empty
  • TDIGEST.MAX: Get the maximum value from the histogram. Will return DBL_MIN if the histogram is empty
  • TDIGEST.INFO : Returns compression, capacity, total merged and unmerged nodes, the total compressions
    made up to date on that key, and merged and unmerged weight.

With the in-depth params in https://oss.redislabs.com/redisbloom/master/TDigest_Commands/

Highlighting command required a number of fields

Highlighting command required a number of fields,but after I look up the source code,I don't found the number of fields.
My code is wrong
image
and
image
The following is the official command documentation
image

TS.MRANGE IndexOutOfBoundsException: Index 0 out of bounds for length 0

Empty data throws IndexOutOfBoundsException

[ERROR] org.redisson.client.handler.CommandDecoder - Unable to decode data. channel: [id: 0x4770854e, L:/127.0.0.1:36330 - R:localhost/127.0.0.1:32933], reply: ReplayingDecoderByteBuf(ridx=444, widx=444), command: (TS.MRANGE), params: [1637778053218, 1637864453218, AGGREGATION, sum, 3600000, WITHLABELS, FILTER, index=test]
java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0
	at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64)
	at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70)
	at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:248)
	at java.base/java.util.Objects.checkIndex(Objects.java:372)
	at java.base/java.util.ArrayList.get(ArrayList.java:459)
	at io.github.dengliming.redismodule.redistimeseries.protocol.decoder.TimeSeriesDecoder.decode(TimeSeriesDecoder.java:61)
	at io.github.dengliming.redismodule.redistimeseries.protocol.decoder.TimeSeriesDecoder.decode(TimeSeriesDecoder.java:30)
	at org.redisson.client.protocol.decoder.ListMultiDecoder2.decode(ListMultiDecoder2.java:46)
	at org.redisson.client.handler.CommandDecoder.decodeList(CommandDecoder.java:431)
	at org.redisson.client.handler.CommandDecoder.decode(CommandDecoder.java:387)
	at org.redisson.client.handler.CommandDecoder.decodeCommand(CommandDecoder.java:196)
	at org.redisson.client.handler.CommandDecoder.decode(CommandDecoder.java:134)
	at org.redisson.client.handler.CommandDecoder.decode(CommandDecoder.java:104)
	at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:501)
	at io.netty.handler.codec.ReplayingDecoder.callDecode(ReplayingDecoder.java:366)
	at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:276)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
	at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
	at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
	at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163)
	at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:714)
	at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:650)
	at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:576)
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493)
	at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.