warrior 66f00d63c9 created page před 5 měsíci
..
build 66f00d63c9 created page před 5 měsíci
docs 66f00d63c9 created page před 5 měsíci
example 66f00d63c9 created page před 5 měsíci
lib 66f00d63c9 created page před 5 měsíci
perf 66f00d63c9 created page před 5 měsíci
test 66f00d63c9 created page před 5 měsíci
.npmignore 66f00d63c9 created page před 5 měsíci
.travis.yml 66f00d63c9 created page před 5 měsíci
CHANGELOG.mdown 66f00d63c9 created page před 5 měsíci
CNAME 66f00d63c9 created page před 5 měsíci
CONTRIBUTING.mdown 66f00d63c9 created page před 5 měsíci
LICENSE 66f00d63c9 created page před 5 měsíci
Makefile 66f00d63c9 created page před 5 měsíci
README.mdown 66f00d63c9 created page před 5 měsíci
VERSION 66f00d63c9 created page před 5 měsíci
app.js 66f00d63c9 created page před 5 měsíci
bower.json 66f00d63c9 created page před 5 měsíci
bug.html 66f00d63c9 created page před 5 měsíci
bug.js 66f00d63c9 created page před 5 měsíci
component.json 66f00d63c9 created page před 5 měsíci
docs.html 66f00d63c9 created page před 5 měsíci
index.html 66f00d63c9 created page před 5 měsíci
lunr.js 66f00d63c9 created page před 5 měsíci
lunr.min.js 66f00d63c9 created page před 5 měsíci
notes 66f00d63c9 created page před 5 měsíci
package.json 66f00d63c9 created page před 5 měsíci
server.js 66f00d63c9 created page před 5 měsíci
styles.css 66f00d63c9 created page před 5 měsíci

README.mdown

Lunr.js

Build Status

A bit like Solr, but much smaller and not as bright.

Example

A very simple search index can be created using the following:

var idx = lunr(function () {
    this.field('title', { boost: 10 })
    this.field('body')
})

Adding documents to be indexed is as simple as:

var doc = {
    "title": "Twelfth-Night",
    "body": "If music be the food of love, play on: Give me excess of it…",
    "author": "William Shakespeare",
    "id": 1
}
idx.add(doc)

Then searching is as simple:

idx.search("love")

This returns a list of matching documents with a score of how closely they match the search query:

[{
    "ref": 1,
    "score": 0.87533
}]

API documentation is available, as well as a full working example.

Description

Lunr.js is a small, full-text search library for use in the browser. It indexes JSON documents and provides a simple search interface for retrieving documents that best match text queries.

Why

For web applications with all their data already sitting in the client, it makes sense to be able to search that data on the client too. It saves adding extra, compacted services on the server. A local search index will be quicker, there is no network overhead, and will remain available and useable even without a network connection.

Installation

Simply include the lunr.js source file in the page that you want to use it. Lunr.js is supported in all modern browsers.

Alternatively an npm package is also available npm install lunr.

Browsers that do not support ES5 will require a JavaScript shim for Lunr to work. You can either use Augment.js, ES5-Shim or any library that patches old browsers to provide an ES5 compatible JavaScript environment.

Contributing

See the CONTRIBUTING.mdown file.