- 授权协议: 未知
- 开发语言: C/C++ JavaScript
- 操作系统: Linux
- 软件首页: https://github.com/visionmedia/reds
软件介绍
Reds是由LearnBoost公司的TJ Holowaychuk开发的一个基于Redis的Node.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 ferrets');
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
Python Cookbook 中文版,第 3 版
David M. Beazley、Brian K. Jones / 陈舸 / 人民邮电出版社 / 2015-5-1 / 108.00元
《Python Cookbook(第3版)中文版》介绍了Python应用在各个领域中的一些使用技巧和方法,其主题涵盖了数据结构和算法,字符串和文本,数字、日期和时间,迭代器和生成器,文件和I/O,数据编码与处理,函数,类与对象,元编程,模块和包,网络和Web编程,并发,实用脚本和系统管理,测试、调试以及异常,C语言扩展等。 本书覆盖了Python应用中的很多常见问题,并提出了通用的解决方案。......一起来看看 《Python Cookbook 中文版,第 3 版》 这本书的介绍吧!
