How to search content value in redis by BookSleeve

风格不统一 提交于 2019-12-11 15:39:16

问题


I want to search in content use redis ,Is such a thing possible؟

for example :

class Post          
{
    public string Id { get; set; }

    public string Content { get; set; }

    public bool Deleted { get; set; }
}

I use c# and BookSleeve ,I want to search a word in "Content" property of post if the "Deleted" property of post is false, i can use HSET and serialize this object to store in redis or SADD or ...

1- What is the best way to store this object? 2- What is the best way to search and filter object for return?

[Update]

I can search in redis using SISMEMBER just for the exact word or phrase but i want to search value like KEYS pattern

[Update]

How do stackexchange whit redis?

[Update]

thanks a lot Marc Gravell , I found NEST for ElasticSearch. But I did not realize how the relation between Redis and ElasticSearch. I'll build a social network and would like to know whether you have some parts Redis and some parts of ElasticSearch should be used or a combination of them.what part of the project i use Redis and which parts ElasticSearch use and which parts should be combined use.

Thanks


回答1:


SCAN could be maybe used to do this, but I wouldn't suggest it. Redis is a key/value store and you should use it for that. If you want to search for text, than you should use another DB which is made for it, like ElasticSearch for long texts or MongoDB or classical RDBMS for shorter texts.

The idea behind NoSQL is to use the right tool for the job, so use redis as a key/value store mostly for caching data and search texts in another DB.



来源:https://stackoverflow.com/questions/18814716/how-to-search-content-value-in-redis-by-booksleeve

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!