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/' ,
}
} ) ;
該計畫已獲得麻省理工學院許可。