sphinx增量索引使用

2022-07-05 10:30:14 字數 1119 閱讀 4270

sphinx在使用過程中如果表的資料量很大,新增加的內容在sphinx索引沒有重建之前都是搜尋不到的。

這時可以通過建立sphinx增量索引,通過定時更新增量索引,合併主索引的方式,來實現偽實時更新。(使用定時任務,定時更新增量索引,例如10分鐘一次)

在利用 sphinx 做搜尋引擎的時候,一般他的索引建立構成有如下幾個部分:

固定不變的主索引

增量索引重建

索引資料合併

1、建立增量索引記錄表   (記錄每次增量索引建立時最大的id,下次從此id往後繼續建立增量索引)

create table sphinx_counter(

counter_id int primary key not null ,

max_doc_id int not null )engine myisam charset utf8;

2、索引檔案設定

#

in mysql

create table sph_counter

(counter_id

integer primary key not null,max_doc_id

integer not null);#

in sphinx.conf

source main

source delta :main

index main

#note how all other settings are copied from main,

#but source and path are overridden (they must be)

index delta :main

3、建立更新所有索引

如果配置正確的話,現在輔助表sph_counter中已經新增了一條資料

4、更新增量索引

5、合併增量索引到主索引-c/usr/local/coreseek/dict/csft_mysql.conf --rotate

sphinx增量索引

在sphinx libmmseg搭建中文全文搜尋引擎 安裝配置中安裝試驗了sphinx的使用,但是還有幾方面的問題有待處理。用來建立索引的分詞資料 動態增量索引更新 索引在前端的介面的表現使用 本篇主要是對動態增量更新的一些研究。關於分詞資料的建立和前端介面的控制將在以後研究。在利用 sphinx ...

Sphinx增量索引

sphinx建立索引之後,如果我們的資料庫又增加了一條資料,需要重新建立索引。但是如果資料量十分龐大時,每次都重新建立索引顯然是不合適的。我們希望實現的效果是,每次都只建立新增的資料的索引。假設現在資料庫中有三條資料,id分別為1,2,3。使用indexer命令為這三條資料建立索引,並把max do...

sphinx主索引,增量索引建立

相關命令及步驟 建立主索引 usr local coreseek bin indexer c usr local coreseek etc csft.conf all 建立增量索引 1.建立測試資料表以及資料 2.修改配置檔案 主索引源 sql query pre 增量索引源 sql query p...