RedisSearch C/C++ Client.

97 views
Skip to first unread message

bada...@gmail.com

unread,
Jan 27, 2022, 9:12:00 AM1/27/22
to Redis DB
Hi Redis Team,
    I was looking for client built using C/C++ for RedisSearch and integrate with my process built on C++.
I did go through : https://oss.redis.com/redisearch/Clients/ and github, could not find any. 

Would like to know if their are any projects for redissearch client using C/C++ which are in novice state , which I can use to try out ?

Thanks
      Badari

sewe...@gmail.com

unread,
Jan 30, 2022, 1:45:01 AM1/30/22
to Redis DB
Since RediSearch also uses RESP protocol, you can try redis-plus-plus' generic command interface. Take FT.SEARCH for an example:

```
auto r = Redis("tcp://127.0.0.1:6379");

// variant<size, doc id, attributes<key, value>>
using Item = variant<long long, string, unordered_map<string, string>>;

auto result = r.command<vector<Item>>("FT.SEARCH", "myIdx", "hello", "LIMIT", "0", "10");

auto size = std::get<long long>(result.front());

for (auto iter = result.begin() + 1; iter != result.end(); ) {
    auto &doc_id = std::get<string>(*iter++);
    auto &attrs = std::get<unordered_map<string, string>>(*iter++);
}
```

Disclaimer: I'm the author of redis-plus-plus. If you have any problem on it, feel free to let me know.

Also redis-plus-plus-modules has built-in support for some popular Redis modules, which is based on redis-plus-plus. However, it does not support RediSearch yet. You can open an issue for it. I think @wingunder will be happy to add it to a TODO list.

Regards

bada...@gmail.com

unread,
Mar 1, 2022, 9:31:51 PM3/1/22
to Redis DB
Ok thank you for the pointers will check this out.

regards,
 badari

Reply all
Reply to author
Forward
0 new messages