JavaScript 搜索引擎 lunr.js

码农软件 · 软件分类 · 搜索引擎 · 2019-08-26 21:29:14

软件介绍

lunr.js 实现了在网页上的搜索引擎,类似 Solr。

示例代码:

//定义索引
var idx = lunr(function () {
    this.field('title', { boost: 10 })
    this.field('body')
})

//添加索引
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)

//搜索
idx.search("love")

//返回结果
[{
    "ref": 1,
    "score": 0.87533
}]

本文地址:https://codercto.com/soft/d/13242.html

Masterminds of Programming

Masterminds of Programming

Federico Biancuzzi、Chromatic / O'Reilly Media / 2009-03-27 / USD 39.99

Description Masterminds of Programming features exclusive interviews with the creators of several historic and highly influential programming languages. Think along with Adin D. Falkoff (APL), Jame......一起来看看 《Masterminds of Programming》 这本书的介绍吧!

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具

HSV CMYK 转换工具
HSV CMYK 转换工具

HSV CMYK互换工具