3 ms·
Yes, it's a nice little demonstration of what you could perhaps call (not unkindly) naive full text search. It misses quite a few functions which a more mature
by kolektiv 16y ago
Yes, it's a nice little demonstration of what you could perhaps call (not unkindly) naive full text search. It misses quite a few functions which a more mature solution would give which you might want quite badly. Relevance is an obvious example - this doesn't allow you to order results by how commonly words occur, which is almost certainly the users wish.
You could probably extend this to include that kind of thing with some clever hacking, but as it stands this is still a long way from competing with something like Sphinx. Still - it's a nice little demo of using Redis for something and taking advantage of the specific strengths of Redis such as first class set support.
- adamcharnock 16y agoYep, this solution is certainly quite a way off being something with the capabilities of Sphinx. In our case we didn't need any scoring of results, but this could be partly achieved by performing a Levenshtein Distance between the search term and the matched word. However, counting the number of occurrences (or other weightings) would require a bit more thought. A larger, Redis-backed search engine would certainly be an interesting project though...
- kolektiv 16y agoYes it certainly would. I have to admit that it's crossed my mind more than once. The set capabilities could lend itself very well to some high performance faceting functionality, so you might end up with something between Lucene and Solr. There is definitely a use case for something like that - Sphinx does excel on large data sets, but there are a lot of people who know that they'll only ever need to be searching a few hundred megabytes of text anyway. You wouldn't want to use that for a scaling startup perhaps, but the world is larger than that...
- tlb_ 16y agoYou can use sorted sets to find out how commonly words occur. redis.zincrby(metaphone_key, item.item_id, 1) This will allow you to sort items by highest number of occurrences