Forgot password
 Register account
View 147|Reply 0

lunr搜索

[Copy link]

3226

Threads

7843

Posts

52

Reputation

Show all posts

hbghlyj posted 2023-7-29 11:23 |Read mode
lunrDemo页面有很多列表项目,输入关键词,就可以筛选出包含关键词的项目。
  1. <script src="https://unpkg.com/lunr/lunr.js"></script>
Copy the Code
首先建立索引,用JS执行搜索。
多关键词:
  1. idx.search('foo bar')
Copy the Code
正则:
  1. idx.search('foo*')
Copy the Code
字段:
  1. idx.search('title:foo')
Copy the Code
权重:
  1. idx.search('foo^10 bar^5 baz')
Copy the Code
模糊:
  1. idx.search('foo~1')
Copy the Code
布尔代数:
  1. idx.search("+foo bar -baz")
Copy the Code

Quick Reply

Advanced Mode
B Color Image Link Quote Code Smilies
You have to log in before you can reply Login | Register account

$\LaTeX$ formula tutorial

Mobile version

2025-7-23 17:01 GMT+8

Powered by Discuz!

Processed in 0.010953 seconds, 22 queries