search-index

A persistent, network resilient, full text search library for the browser and Node.js

Github星跟蹤圖

search-index

A network resilient, persistent full-text search library for the browser and Node.js

Gitter
npm
npm
license
Build Status
JavaScript Style Guide

Documentation

Quick start

Initialise search-index

Default method

search-index can be invoked with ES6 import or commonjs require
using either lazy loading or a callback:

// Make a new index, or open an existing one with this name
import si from 'search-index'

// "lazy load"- db may not be immediately initialized
db = si({ name: 'mySearchIndex' })

// ... or callback to be sure you have it in time
si({ name: 'myDB' }, (err, db) => {
  // db is guaranteed to be open and available
})

Script tag method

In the /dist folder there is a file called
search-index.<version>.js that can be used as a standalone in a
<script> tag. The library is then available under a global variable
called searchIndex:

<script type='text/javascript' src='./search-index.1.0.2.js'></script>
<script type='text/javascript'>
  searchIndex({ name: 'myDB' }, (err, db) => {
    // db is now available
  })
</script>

Add documents to index

// db exists in a leveldb instance if run on a server
PUT([ /* my array of objects */ ]).then(doStuff)

Search the index

// search for terms without specifing any fields
SEARCH('SCOTLAND', 'GREEN').then(result)

More examples

See the tests for more examples.

主要指標

概覽
名稱與所有者fergiemcdowall/search-index
主編程語言JavaScript
編程語言JavaScript (語言數: 1)
平台
許可證MIT License
所有者活动
創建於2013-07-04 07:56:35
推送於2025-04-04 11:27:22
最后一次提交2025-04-04 10:54:24
發布數27
最新版本名稱v6.0.1 (發布於 2025-04-04 13:26:23)
第一版名稱v0.10.0 (發布於 )
用户参与
星數1.4k
關注者數34
派生數149
提交數1.6k
已啟用問題?
問題數447
打開的問題數3
拉請求數146
打開的拉請求數2
關閉的拉請求數24
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?