跳到主要內容

發表文章

目前顯示的是有「全文搜尋引擎」標籤的文章

Sphinx 3 設定

Sphinx是歷史悠久的php全文搜尋引擎,最近把舊的系統換成Sphinx,隨便記一點東西,以防忘記。 1.安裝及相關說明 參考 https://blog.csdn.net/XBODHX/article/details/107378182 mysql的設定方式,上面網站說得很詳細了。 改路徑及DB設定即可。 2.XML資料源 要在Sphinx使用XML當作資料,要先把XML按照下面格式整理 http://sphinxsearch.com/docs/current/xmlpipe2.html sphinx.conf設定如下 source (索引名稱) {     type  = xmlpipe2     xmlpipe_command = cat (xml檔案所在路徑)     xmlpipe_field = (subject)     xmlpipe_field = (content 預設是這兩個文字欄位,可以按XML內容修改)     xmlpipe_attr_uint = (要另外存的欄位,限數字)     xmlpipe_fixup_utf8 = 1 } index (自訂索引名稱,跟上面的不一樣) {     source = (索引名稱)     path = (索引檔路徑)     mlock = 0     morphology = none     min_word_len = 1     ngram_len = 1(是否分詞,1是,0否)     ngram_chars = (分詞的字碼,ngram_len = 0的話無用)     html_strip = 0(是否刪除html tags,0不刪,1刪除) } 其餘的跟mysql一樣,要注意windows底下可能沒有「cat」可以用(在xmlpipe_command 那邊),把cat改成type即可。 3.searchd 設定 如果設定的sphinx.conf有改名,或者indexer的參數不是sphinx.con...