Reds Redis加Node.js的全文搜索引擎

程序名称:Reds

授权协议: 未知

操作系统: Linux

开发语言: C/C++

Reds 介绍

Reds是由LearnBoost公司的TJ
Holowaychuk开发的一个基于RedisNode.js全文搜索引擎,其代码加上注释也只有300行。不得不说又是一个Redis的最佳实践,它的主要原理是通过Redis的sets数据结构将分词后的词语碎片进行存储。这里的分词仅仅是对英文按空格进行切分(中文分词就不要想了~)。

例子:
添加几个句子到搜索引擎中建立索引

var strs = [];
strs.push('Tobi wants four dollars');
strs.push('Tobi only wants $4');
strs.push('Loki is really fat');
strs.push('Loki, Jane, and Tobi are @R_1_5023@s');
strs.push('Manny is a cat');
strs.push('Luna is a cat');
strs.push('Mustachio is a cat');

strs.forEach(function(str, i){ search.index(str, i); });

然后在Tobi dollars这个组合进行搜索

search.query(query = 'Tobi dollars', function(err, ids){
  if (err) throw err;
  console.log('Search results for "%s":', query);
  ids.forEach(function(id){
    console.log('  - %s', strs[id]);
  });
  process.exit();
});

下面是其搜索结果

Search results for "Tobi dollars":
  - Tobi wants four dollars

介绍内容来自:http://blog.nosqlfan.com/html/2676.html

Reds 官网

https://github.com/visionmedia/reds

相关编程语言

BlazeDS 是一个基于服务器的Java 远程控制(remoting...
OVal 是一个可扩展的Java对象数据验证框架,验证的规...
Volta 是一套开发工具,专为开发分布式、实时系统应...
OpenDDS 是一个开源的 C++ 实现的 对象管理组织 OMG...
JADE (Java Agent DEvelopment Framework) 是一个完...
FastMM ,在D2006和2007中已代替了原来的内存管理器。