Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/iinitd/racci
ποΈ A lightweight search engine for Node.js, Chinese supported.
https://github.com/iinitd/racci
chinese node search
Last synced: 3 months ago
JSON representation
ποΈ A lightweight search engine for Node.js, Chinese supported.
- Host: GitHub
- URL: https://github.com/iinitd/racci
- Owner: iinitd
- Created: 2017-06-22T19:34:43.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-06-27T02:18:36.000Z (over 7 years ago)
- Last Synced: 2024-05-23T05:29:31.991Z (6 months ago)
- Topics: chinese, node, search
- Language: JavaScript
- Homepage:
- Size: 504 KB
- Stars: 18
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Racci
[![npm version](https://badge.fury.io/js/racci.svg)](https://badge.fury.io/js/racci) [![Build Status](https://travis-ci.org/cogons/racci.svg?branch=master)](https://travis-ci.org/cogons/racci)
A lightweight search engine for Node.js, Chinese supported.
# Feature
- Support two search mode: full-text search and field search
- Support Chinese query
- Customize field weight in full-text search
# Usage
It is extremly simple.
### Step 1: require racci
```js
npm i racci --savevar racci = require('racci')
```### Step 2: import corpus
```js
var docs = {
"1":{"singer":"Jay Chou",
"composer":"Jay Chou"},
"2":{"singer":"Jay Chou",
"composer":"Jay Chou"}}// format: {identifier:[Object]}
racci.Parser.import(docs)
```### Step 3: Build models once and for all
```js
// full-text search model
racci.Parser.init("corpus", ["lyrics", "singer", "composer", 'songwritter', 'album'], [1, 20, 3, 2, 1])// name, search from these fields, field weight for ranking.
// field search model
racci.Parser.init("singer", ["singer","composer"], "commit_count")// name, search from these fields, sort by this field.
```
### Step 4: Search!```js
racci.Search.search("corpus", "ζ΅ζι¨",0,0)// [ { doc: '1',},
// { doc: '2'} ]// first flag: show doc details or not
// second flag: show score or notracci.Search.search("singer", "ε¨ζ°δΌ¦",0,1)
// [ { doc: '1', score: '57' },
// { doc: '2', score: '22' }]racci.Search.search("corpus", "ζ΅ζι¨",1,0)
// [ { doc: [Object] },
// { doc: [Object] } ]racci.Search.search("singer", "ε¨ζ°δΌ¦",1,1)
// [ { doc: [Object], score: '57' },
// { doc: [Object], score: '22' }]```
[Examples](https://github.com/cogons/racci/tree/master/examples)
# Implementation
A music search engine based on Express
[HERE](https://github.com/cogons/music-racci)