Java client for RediSearch based on Lettuce
LettuSearch implements RediSearch commands using the Command abstraction provided by Lettuce.
Add LettuSearch to your application dependencies, e.g. with Maven:
<dependency>
<groupId>com.redislabs</groupId>
<artifactId>lettusearch</artifactId>
<version>1.5.3</version>
</dependency>
Java example
RediSearchClient client = RediSearchClient.create("redis://localhost");
StatefulRediSearchConnection<String, String> conn = client.connect(); //(1)
RediSearchCommands<String, String> ft = conn.sync(); //(2)
ft.create("beers", Schema.builder().field(TextField.builder().name("name").build())....build()); //(3)
beers().forEach(b -> ft.add("beers", b.get("id"), 1, b)); //(4)
SearchResults<String, String> results = ft.search("beers", "sculpin"); //(5)
-
Establish a connection to RediSearch
-
Use sync, async, or reactive API
-
Create a RediSearch index
-
Add documents to the previously created index
-
Search the index