infisearch
v0.10.1
该项目不再积极开发。
作为可扩展静态站点搜索的替代方案,请查看 https://pagefind.app/,它也实现了 InfiSearch 的核心思想 - 碎片静态索引。
如果需要,最新发行版本的文档将继续托管在本自述文件中的 URL 中。
如果您一直在尝试甚至向 InfiSearch 贡献想法和报告,感谢您投入大量时间。
简单灵活的客户端静态站点搜索。
InfiSearch 是针对静态站点的客户端搜索解决方案,依赖于 CLI 工具生成的预构建索引。
.json,csv,pdf,html
),满足更多自定义数据需求。 使用 InfiSearch 进行搜索功能的文档可以在此处找到。
此处还提供了针对更大的古腾堡集合的 InfiSearch 的一些演示。
使用 InfiSearch 支持静态站点搜索非常简单,只需要一个 HTML 文件文件夹 - 标题、标题和其他文本会自动提取。页面的链接会根据您的文件夹结构自动生成,但也可以手动指定。
有几个用于安装索引器的选项:
npm install -g @infisearch/cli
安装全局 npm 包。cargo install infisearch --vers 0.10.1
。照此运行可执行文件,将<source-folder-path>
替换为源 html 文件的相对或绝对文件夹路径,并将<output-folder-path>
替换为所需的索引输出文件夹。
infisearch <source-folder-path> <output-folder-path>
将以下资源添加到您的页面:
<!-- Search UI script -->
< script src =" https://cdn.jsdelivr.net/gh/ang-zeyu/[email protected]/packages/search-ui/dist/search-ui.ascii.bundle.js " > </ script >
<!-- Search UI css, this provides some basic styling for the search dropdown, and can be omitted if desired -->
< link rel =" stylesheet " href =" https://cdn.jsdelivr.net/gh/ang-zeyu/[email protected]/packages/search-ui/dist/search-ui-light.css " />
如果您希望托管这些文件,可以在索引器生成的<output-folder-path>/assets
目录或发布页面中找到它们。
为页面中的任何<input>
元素提供infi-search
id
,然后调用:
infisearch . init ( {
searcherOptions : {
// Output folder URL specified as the second parameter in the cli command
// URLs like '/output/' will work as well
url : 'http://<your-domain>/output/' ,
} ,
uiOptions : {
// Input folder URL specified as the first parameter in the cli command
// This is where the generated result preview links will point to,
// and where you host your site.
sourceFilesUrl : 'http://<your-domain>/source/' ,
}
} ) ;
该项目已获得麻省理工学院许可。