Skip to content

Commit cfe6e70

Browse files
committed
Fix NoContent option not working
1 parent 430d75a commit cfe6e70

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

redisbloom/src/main/java/io/github/dengliming/redismodule/redisbloom/protocol/decoder/TDigestDecoder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@ public class TDigestDecoder implements MultiDecoder<TDigestInfo> {
2828
public TDigestInfo decode(List<Object> parts, State state) {
2929
return new TDigestInfo((Long) parts.get(1), (Long) parts.get(3), (Long) parts.get(5), (Long) parts.get(7),
3030
Double.parseDouble(String.valueOf(parts.get(9))), Double.parseDouble(String.valueOf(parts.get(11))),
31-
Long.valueOf(String.valueOf(parts.get(13))));
31+
Long.parseLong(String.valueOf(parts.get(13))));
3232
}
3333
}

redisearch/src/main/java/io/github/dengliming/redismodule/redisearch/protocol/decoder/SearchResultDecoder.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2020 dengliming.
2+
* Copyright 2020-2022 dengliming.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -43,7 +43,7 @@ public SearchResultDecoder(boolean withScores) {
4343
public SearchResult decode(List<Object> parts, State state) {
4444
Long total = (Long) parts.get(0);
4545
int documentSize = withScores ? 3 : 2;
46-
boolean noContent = total == parts.size() + 1;
46+
boolean noContent = total.longValue() == parts.size() - 1;
4747

4848
List<Document> documents = new ArrayList<>(total.intValue());
4949
// Checks the document size. DocumentSize equals to 2 means only key and parts. DocumentSize equals to 3 means

redisearch/src/test/java/io/github/dengliming/redismodule/redisearch/RediSearchTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ public void testSearch() {
160160
fields2.put("content", "hello world");
161161
assertThat(rediSearch.addDocument(new Document(String.format("doc2"), 0.2d, fields2), new DocumentOptions())).isTrue();
162162

163-
SearchResult searchResult = rediSearch.search("Hi", new SearchOptions());
163+
SearchResult searchResult = rediSearch.search("Hi", new SearchOptions().noContent());
164164
assertThat(searchResult.getTotal()).isEqualTo(2);
165165

166166
searchResult = rediSearch.search("OOOO", new SearchOptions().noStopwords().language(RSLanguage.ENGLISH));

0 commit comments

Comments
 (0)