Merge branch 'master' of github.com:redisson/redisson

pull/4498/merge
mrniko 1 week ago
commit 4d5d1c6beb

@ -40,10 +40,14 @@ public class SearchResultDecoder implements MultiDecoder<Object> {
Long total = (Long) parts.get(0);
List<Document> docs = new ArrayList<>();
if (total > 0) {
for (int i = 1; i < parts.size(); i += 2) {
for (int i = 1; i < parts.size(); i++) {
String id = (String) parts.get(i);
Map<String, Object> attrs = (Map<String, Object>) parts.get(i + 1);
if ((i + 1) < parts.size() && parts.get(i + 1) instanceof Map) {
Map<String, Object> attrs = (Map<String, Object>) parts.get(++i);
docs.add(new Document(id, attrs));
} else {
docs.add(new Document(id));
}
}
}

@ -49,6 +49,28 @@ public class RedissonSearchTest extends DockerRedisStackTest {
}
}
@Test
public void testSearchNoContent() {
RMap<String, SimpleObject> m = redisson.getMap("doc:1", new CompositeCodec(StringCodec.INSTANCE, redisson.getConfig().getCodec()));
m.put("t1", new SimpleObject("name1"));
m.put("t2", new SimpleObject("name2"));
RMap<String, SimpleObject> m2 = redisson.getMap("doc:2", new CompositeCodec(StringCodec.INSTANCE, redisson.getConfig().getCodec()));
m2.put("t1", new SimpleObject("name3"));
m2.put("t2", new SimpleObject("name4"));
RSearch s = redisson.getSearch();
assertThat(s.getIndexes()).isEmpty();
s.createIndex("idx:1", IndexOptions.defaults()
.on(IndexType.HASH)
.prefix(Arrays.asList("doc:")),
FieldIndex.text("t1"),
FieldIndex.text("t2"));
s.search("idx:1", "*", QueryOptions.defaults().noContent(true));
}
@Test
public void testMapAggregateWithCursor() {
RMap<String, Object> m = redisson.getMap("doc:1", new CompositeCodec(StringCodec.INSTANCE, redisson.getConfig().getCodec()));

Loading…
Cancel
Save