All Projects → RediSearch → JRediSearch

RediSearch / JRediSearch

Licence: BSD-2-Clause license
Java Client for RediSearch

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to JRediSearch

redis-modules-java
Java client libraries for redis-modules https://redis.io/modules, based on Redisson. https://github.com/redisson/redisson
Stars: ✭ 57 (-57.14%)
Mutual labels:  java-client, redis-client, redis-search
racompass
An advanced GUI for Redis. Modern. Efficient. Fast. A faster and robust Redis management tool. For developers that need to manage data with confidence.It supports Redis modules now!
Stars: ✭ 26 (-80.45%)
Mutual labels:  redis-client, redis-search
racket-redis
Fast, idiomatic Redis bidings for Racket.
Stars: ✭ 30 (-77.44%)
Mutual labels:  redis-client
redimo.go
Use the power of DynamoDB with the ease of the Redis API
Stars: ✭ 29 (-78.2%)
Mutual labels:  redis-client
jetty-load-generator
jetty-project.github.io/jetty-load-generator/
Stars: ✭ 62 (-53.38%)
Mutual labels:  java-client
redis-patterns-console
An interactive (and reactive) console to try and go into the deep of Redis and its patterns!
Stars: ✭ 22 (-83.46%)
Mutual labels:  redis-client
TRedisWire
Delphi Redis connector
Stars: ✭ 17 (-87.22%)
Mutual labels:  redis-client
aedis
An async redis client designed for performance and scalability
Stars: ✭ 118 (-11.28%)
Mutual labels:  redis-client
redis-cpp
redis-cpp is a header-only library in C++17 for Redis (and C++11 backport)
Stars: ✭ 73 (-45.11%)
Mutual labels:  redis-client
The-Overly-Complicated-Random-Number-Generator
An Overly Complex Random Number Generator, created to demystify how containers work.
Stars: ✭ 25 (-81.2%)
Mutual labels:  redis-client
retcl
Tcl client library for Redis
Stars: ✭ 20 (-84.96%)
Mutual labels:  redis-client
node-redis
A high-performance Node.js Redis client.
Stars: ✭ 15,783 (+11766.92%)
Mutual labels:  redis-client
JRedisTimeSeries
Java Client for RedisTimeSeries
Stars: ✭ 29 (-78.2%)
Mutual labels:  java-client
zig-okredis
Zero-allocation Client for Redis 6+
Stars: ✭ 137 (+3.01%)
Mutual labels:  redis-client
redis-rs
Redis client for Rust.
Stars: ✭ 25 (-81.2%)
Mutual labels:  redis-client
vscode-redis
Redis Client in VSCode!
Stars: ✭ 63 (-52.63%)
Mutual labels:  redis-client
redisbloom-go
Go Client for RedisBloom probabilistic module
Stars: ✭ 74 (-44.36%)
Mutual labels:  redis-client
scala-redis
A scala library for connecting to a redis server, or a cluster of redis nodes using consistent hashing on the client side.
Stars: ✭ 1,016 (+663.91%)
Mutual labels:  redis-client
node-cache-manager-redis-store
Redis store for node-cache-manager using node_redis.
Stars: ✭ 117 (-12.03%)
Mutual labels:  redis-client
swift-nio-redis
A high performance Redis protocol (RESP) implementation for SwiftNIO
Stars: ✭ 27 (-79.7%)
Mutual labels:  redis-client

license CircleCI GitHub issues Maven Central Javadocs Codecov Language grade: Java Known Vulnerabilities

JRediSearch

Forum Discord

A Java Client Library for RediSearch

Deprecation notice

As of jedis 4.0.0 this library is deprecated. It's features have been merged into jedis. Please either install it from maven or the repo.

Overview

This project contains a Java library abstracting the API of the RediSearch Redis module, that implements a powerful in-memory Secondary Index, Query Engine and Full-Text Search engine inside Redis.

Installing

JRediSearch is available using the maven central snapshot repository and via official releases.

Official Releases

  <dependencies>
    <dependency>
      <groupId>com.redislabs</groupId>
      <artifactId>jredisearch</artifactId>
      <version>2.0.0</version>
    </dependency>
  </dependencies>

Snapshots

  <repositories>
    <repository>
      <id>snapshots-repo</id>
      <url>https://oss.sonatype.org/content/repositories/snapshots</url>
    </repository>
  </repositories>

and

  <dependencies>
    <dependency>
      <groupId>com.redislabs</groupId>
      <artifactId>jredisearch</artifactId>
      <version>2.1.0-SNAPSHOT</version>
    </dependency>
  </dependencies>

Usage example

Initializing the client with JedisPool:

import io.redisearch.client.Client;
import io.redisearch.Document;
import io.redisearch.SearchResult;
import io.redisearch.Query;
import io.redisearch.Schema;

...

Client client = new Client("testung", "localhost", 6379);

Initializing the client with JedisSentinelPool:

import io.redisearch.client.Client;
import io.redisearch.Document;
import io.redisearch.SearchResult;
import io.redisearch.Query;
import io.redisearch.Schema;

...

private static final String MASTER_NAME = "mymaster";
private static final Set<String> sentinels;
static {
    sentinels = new HashSet();
    sentinels.add("localhost:7000");
    sentinels.add("localhost:7001");
    sentinels.add("localhost:7002");
}

...

Client client = new Client("testung", MASTER_NAME, sentinels);

Defining a schema for an index and creating it:

Schema sc = new Schema()
                .addTextField("title", 5.0)
                .addTextField("body", 1.0)
                .addNumericField("price");

// IndexDefinition requires RediSearch 2.0+
IndexDefinition def = new IndexDefinition()
						.setPrefixes(new String[] {"item:", "product:"})
						.setFilter("@price>100");

client.createIndex(sc, Client.IndexOptions.defaultOptions().setDefinition(def));

Adding documents to the index:

Map<String, Object> fields = new HashMap<>();
fields.put("title", "hello world");
fields.put("state", "NY");
fields.put("body", "lorem ipsum");
fields.put("price", 1337);

// RediSearch 2.0+ supports working with Redis Hash commands
try(Jedis conn = client.connection()){
	conn.hset("item", fields);
}
// Prior to RediSearch 2.0+ the addDocument has to be called
client.addDocument("item", fields);

Searching the index:

// Creating a complex query
Query q = new Query("hello world")
                    .addFilter(new Query.NumericFilter("price", 0, 1000))
                    .limit(0,5);

// actual search
SearchResult res = client.search(q);

// aggregation query
AggregationBuilder r = new AggregationBuilder("hello")
  .apply("@price/1000", "k")
  .groupBy("@state", Reducers.avg("@k").as("avgprice"))
  .filter("@avgprice>=2")
  .sortBy(10, SortedField.asc("@state"));
  
AggregationResult res = client.aggregate(r);

Also supported:

  • Geo filtering
  • Exact matching
  • Union matching
  • Stemming in 17 languages
  • Deleting and updating documents on the fly
  • And much more... See https://oss.redislabs.com/redisearch/ for more details.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].