cn-search

所属分类:搜索引擎
开发工具:JavaScript
文件大小:14KB
下载次数:0
上传日期:2015-07-31 03:08:27
上 传 者sh-1993
说明:  中文搜索引擎
(Chinese search engine)

文件列表:
.npmignore (29, 2015-07-31)
.travis.yml (122, 2015-07-31)
History.md (1322, 2015-07-31)
Makefile (689, 2015-07-31)
benchmarks (0, 2015-07-31)
benchmarks\index.js (679, 2015-07-31)
examples (0, 2015-07-31)
examples\form.html (1251, 2015-07-31)
examples\simple.js (939, 2015-07-31)
examples\urls (555, 2015-07-31)
examples\web-index.js (1094, 2015-07-31)
examples\web-realtime.js (1043, 2015-07-31)
examples\web-search.js (868, 2015-07-31)
index.js (40, 2015-07-31)
lib (0, 2015-07-31)
lib\cnstopWords.js (938, 2015-07-31)
lib\reds.js (9314, 2015-07-31)
package.json (739, 2015-07-31)
test (0, 2015-07-31)
test\Chinese.js (2301, 2015-07-31)
test\optionForTest.jsx (104, 2015-07-31)
test\pureEng.js (6536, 2015-07-31)

# cn-search - [![NPM version](https://badge.fury.io/js/cn-search.png)](http://badge.fury.io/js/cn-search) - [![Dependencies Status](https://david-dm.org/sxyizhiren/cn-search.png)](https://david-dm.org/sxyizhiren/cn-search) - [![Build Status](https://travis-ci.org/sxyizhiren/cn-search.png?branch=master)](https://travis-ci.org/sxyizhiren/cn-search) - [![Coverage Status](https://coveralls.io/repos/sxyizhiren/cn-search/badge.png?branch=master&service=github)](https://coveralls.io/github/sxyizhiren/cn-search?branch=master) - [![NPM Stats](https://nodei.co/npm/cn-search.png?downloads=true&stars=true)](https://npmjs.org/package/cn-search) - [![NPM Downloads](https://nodei.co/npm-dl/cn-search.png?months=9)](https://npmjs.org/package/cn-search) ch-search , a light-weight chinese search engine based on reds, english support also. https://github.com/tj/reds ## Installation $ npm install cn-search ## Example the same to reds ###usage ```js var searcher=require('cn-search'); var search = searcher.createSearch('pets'); var strs = []; strs.push('Tobi wants four dollars'); strs.push('Mustachio is a cat'); strs.push('这是一个支持中文的搜索引擎,hello man'); strs.forEach(function(str, i){ search.index(str, i); }); // search who have all words in it. search .query('支持 hello') .end(function(err, ids){ if (err) throw err; console.log('Search results for "%s":', query); ids.forEach(function(id){ console.log(' - %s', strs[id]); }); }); // search who have either word in it. search .query('中文 Mustachio') .type('or') .end(function(err, ids){ if (err) throw err; console.log('Search results for "%s":', query); ids.forEach(function(id){ console.log(' - %s', strs[id]); }); }); // basic usage is same to reds : https://github.com/tj/reds ```

近期下载者

相关文件


收藏者