indexedfts

0.3.6 • Public • Published

IndexedFTS

Full-Text Search engine for web browser.

NPM

Build Status Coverage Status license document

install

HTML

<script src="https://unpkg.com/indexedfts"></script>

Node

$ npm install indexedfts

ES6

import IndexedFTS from 'indexedfts';

common js

const IndexedFTS = require('indexedfts').IndexedFTS;

example

// make database
const db = IndexedFTS('database-name', 1, {
    userid: 'primary',                     // primary key will indexed but can not full-text search
    name: {unique: true, fulltext: true},  // unique index and can full-text search
    description: 'fulltext',               // full-text search
});
 
 
db.open()
    .then(() => {
        db.put({
            userid: 1,
            name: 'hello',
            description: 'this is test\n',
        }, {
            userid: 20,
            name: 'world',
            description: 'check check\nhello hello world!',
        });
    })
 
    .then(() => db.search(['name', 'description'], 'hel').lower('userid', 5))
    .then(result => {
        console.log(result.length);   // output: 1
        console.log(result[0].name);  // output: hello
    })

Package Sidebar

Install

npm i indexedfts

Weekly Downloads

1

Version

0.3.6

License

MIT

Unpacked Size

485 kB

Total Files

11

Last publish

Collaborators

  • macrat