Redis client search ( returns certain special characters in encoded format


I use redis java module.
While searching, certain special characters (&,’) are returned in encoded format.
It does not happen with all the values.

I have two values in my table. “B\&lore” and “B\@lore”.
I use search function from

The output is different for both.
Former returns Bu0026lore. Later one is B@lore.

Can you please share code example in Java? Including example query?

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

Schema sc = new Schema();;
Client cl = new Client(idx,redisCluster,sentinels,conTimeOut,poolSize);;

sc = sc.addTextField(“type”,5.0)
.addTextField(“value”, 5.0)

Map <String,Object> fields = new HashMap<>();
status= cl.addDocument(“Sample”,1,fields,false,true,null);

Query q = new Query("*");
SearchResult res=,cl);

When I print, I face the above issue. Though it is saved as “B&lore” in the redis data base. Search result has the unicode format instead of user input.

It seems like a bug in the Document toString() function, it tries to encode the document as legal JSON and encode & as u0026.
But the results seem OK."value");

Returns "B&lore"