Closed chaitradalawai closed 2 years ago
JRediSearch is deprecated in favor of Jedis. There's a quick start guide. More example can be found in search tests and aggregation tests.
PS: @chaitradalawai Where have you found the information for deprecation? Asking because same doc should also contain the reference to Jedis.
I got to know in this forum itself #185, when asking about some other question.
Thanks for links. It would be really helpful to know the below things:
Thanks for the clarification.
Hi, I was using the below code to create client object with host port and index names, I think the Client object has to be replaced with JedisPooled in Jedis approach, could you please tell which syntax to use to pass password arg ?
io.redisearch.client.Client.Client(String indexName, String host, int port, int timeout, int poolSize, String password)
And also please tell about the corresponding jedis methods for the below JRedisearch code
is there any similar method for the Client object creation to access Redis( above question) ----- io.redisearch.client.Client.Client(String indexName, String host, int port, int timeout, int poolSize, String password) ?
I am dropping the index and recreating it on scheduled basis using the method (client.dropIndex(true) - missingOk If the index does not exist, don't throw an exception instead return false), where it doesn't throw exception even if the index doesn't exist, if I use the "redis.clients.jedis.UnifiedJedis.ftDropIndexDD(String indexName)" it gives the following exception when loading data for the first time (redis.clients.jedis.exceptions.JedisDataException: Unknown Index name )----------- I am doing this operation since there is no functionality to remove all the docs from the index. Is there any method which deletes all the records from an index or check if an index is existing already for supporting removing and reloading all the data on scheduled basis?
I am using the following code to load all the documents by replacing the old ones with new io.redisearch.client.Client.addDocument(String docId, double score, Map<String, Object> fields, boolean noSave, boolean replace, byte[] payload) ----------- is there any similar method in Jedis to replace existing docs with new ones ?
@chaitradalawai
GenericObjectPoolConfig<Connection>
for the poolSize
.GenericObjectPoolConfig<Connection> config = new ConnectionPoolConfig();
config.setMaxTotal(poolSize);
UnifiedJedis client = new JedisPooled(config, host, port, timeout, password);
You may consider following:
public static boolean safeFtDropIndexDD(UnifiedJedis jedis, String indexName) throws JedisException {
try {
return "OK".equals(jedis.ftDropIndexDD(indexName));
} catch (JedisDataException jde) {
if (jde.getMessage().toLowerCase().contains("unknown")) {
return false;
}
throw jde;
}
}
Hi,
About 3rd question, I am using the following code to load all the documents by replacing the old ones with new io.redisearch.client.Client.addDocument(String docId, double score, Map<String, Object> fields, boolean noSave, boolean replace, byte[] payload) ----------- is there any similar method in Jedis to replace existing docs with new ones ?
Will the "redis.clients.jedis.search.Document" be deprecated as well? I see in the SearchResult class the only result returning data structure is Document, will this be changed later or am I missing something here ?
List
At this moment, there is no such plan.
thanks for all the answers :)
I have been using Redisearch through JRedisearch API in my project. I recently got to know this API is deprecated. It would be really helpful if you could provide the alternative API and links for examples if published any.