0

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

Community
  • 1
  • 1
Amir Movahedi
  • 1,802
  • 3
  • 29
  • 52
  • What is the form of "Content"? Is it the single word? Or is it paragraphs? Or...? – Marc Gravell Sep 15 '13 at 16:47
  • the form is paragraphs and i want search that – Amir Movahedi Sep 15 '13 at 17:34
  • Frankly, that sounds more like a job for something like Lucene – Marc Gravell Sep 15 '13 at 19:55
  • you can show me Lucene in example for my question? – Amir Movahedi Sep 15 '13 at 20:42
  • http://lucene.apache.org/core/2_9_4/gettingstarted.html – Marc Gravell Sep 15 '13 at 20:53
  • I should note that while we used to use lucene directly, we now use "elastic search", which sites *on top of* lucene – Marc Gravell Sep 15 '13 at 20:56
  • Many thanks for your reply, this is very exciting, 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. – Amir Movahedi Sep 17 '13 at 10:07

1 Answers1

0

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.

peter
  • 14,348
  • 9
  • 62
  • 96