Testing conductivity in JRedisSearch to Redis without a previous created Index
Sunday, December 2, 2018 at 10:46PM
David Parry

The Client Class, which wraps all connection and command calls to the RediSearch module, requires an index when creating an instance.

Any Client method invocation that cannot be connected to Redis with the connection information provided when calling the constructor you will get the following exception JedisConnectionException from Jedis this exposes the jedis api to all users of the JRediseach api.

If the connection information works and there is a successfull connection but the index used is not present then any valid call to the methods in the Client class will result in various exceptions depending on the call accept the one to createIndex which will create the index.

Examples:

 

 

None of these approaches are ideal but for now my vote would be to call getInfo since no harm can happen, dropIndex and others can actually alter the index if it did all ready exsist.

Reference to the API docs http://davidparry.com/storage/jrediseach-javadoc-v0-19-0/docs/io/redisearch/client/Client.html

 

Article originally appeared on David Parry (http://davidparry.com/).
See website for complete article licensing information.