Sunday
Dec022018

Testing conductivity in JRedisSearch to Redis without a previous created Index

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:

 

  • dropIndex(boolean) will return false but really the api is suppressing the thrown exception that the index was not found.
  • getInfo() which will throw an “JedisDataException: Unknown Index name”.

 

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

 

PrintView Printer Friendly Version

EmailEmail Article to Friend

« Product I Designed and Developed | Main | Microstack Developer »