admin管理员组文章数量:1357620
I try to obtain FT.SEARCH results in Micronaut using Lettuce annotations like this:
import io.lettuce.core.dynamic.Commands;
import io.lettuce.core.dynamic.annotation.Command;
import java.util.List;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
public interface JsonCommands extends Commands {
@Command("FT.SEARCH ?0 ?1")
Flux<String> jsonFtSearch(final String index, final String query);
@Command("JSON.SET ?0 ?1 ?2")
Mono<String> jsonSet(final String key, final String path, final String json);
@Command("JSON.MGET ?0 $")
Flux<String> jsonMGet(final List<String> keys);
Do I need to write some special converters to retrieve results from jsonFtSearch
? I cannot find a another method but I can't believe there is no other way.
I use Micronaut 4.2.4
, io.lettuce:lettuce-core:6.2.6
.
I try to obtain FT.SEARCH results in Micronaut using Lettuce annotations like this:
import io.lettuce.core.dynamic.Commands;
import io.lettuce.core.dynamic.annotation.Command;
import java.util.List;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
public interface JsonCommands extends Commands {
@Command("FT.SEARCH ?0 ?1")
Flux<String> jsonFtSearch(final String index, final String query);
@Command("JSON.SET ?0 ?1 ?2")
Mono<String> jsonSet(final String key, final String path, final String json);
@Command("JSON.MGET ?0 $")
Flux<String> jsonMGet(final List<String> keys);
Do I need to write some special converters to retrieve results from jsonFtSearch
? I cannot find a another method but I can't believe there is no other way.
I use Micronaut 4.2.4
, io.lettuce:lettuce-core:6.2.6
.
1 Answer
Reset to default 1Important note
The Redis team is currently implementing native support for the search commands (FT.*) that would become a part of Lettuce. You can follow up this process if you track this issue.
Handling response type for custom commands
(as explained in the Lettuce guide)
Custom commands could either use any of the existing converters (CommandOutput class in Lettuce terminology), or you can define your own. In your case, and specifically for FT.SEARCH
you would have to write your own, because the data returned is rather complex and specific to this command.
Side note
I see that in your example there are also JSON.SET
and JSON.MGET
shown. since Lettuce 6.5.0 the JSON commands are all natively supported. If you have the option to use 6.5.0+ then you need not implement your own custom commands.
本文标签: How to easy obtain REDIS FTSEARCH in Micronaut using lettucecoreStack Overflow
版权声明:本文标题:How to easy obtain REDIS FT.SEARCH in Micronaut using lettuce-core? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744048748a2582027.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论