码迷,mamicode.com
首页 > 其他好文 > 详细

sphinx 增量索引测试

时间:2015-08-25 13:58:12      阅读:282      评论:0      收藏:0      [点我收藏+]

标签:

临时表:

CREATE TABLE `sph_counter` (
  `counter_id` int(11) NOT NULL,
  `max_doc_id` int(11) NOT NULL,
  PRIMARY KEY (`counter_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8

 

 

 

source src
{
        # data source type. mandatory, no default value
        # known types are mysql, pgsql, mssql, xmlpipe, xmlpipe2, odbc
        type                    = mysql
        sql_host                = localhost
        sql_user                = root
        sql_pass                = 201671zhuang
        sql_db                  = test
        sql_port                = 3306  # optional, default is 3306
        sql_query_pre          = SET NAMES utf8
        sql_query_pre          = SET SESSION query_cache_type=OFF
        sql_query_pre          = REPLACE INTO sph_counter SELECT 1, MAX(id) FROM cn
        sql_query               = SELECT id,title,content from cn where id<=(SELECT max_doc_id FROM sph_counter WHERE counter_id=1)
        sql_query_info          = SELECT * FROM cn WHERE id=$id
}
#表示增量数据源
source moresrc : src
{
        sql_query_pre          = SET NAMES utf8
        sql_query_pre          = SET SESSION query_cache_type=OFF
        sql_query              = SELECT id,title,content from cn where id>(SELECT max_doc_id FROM sph_counter WHERE counter_id=1)
        #sql_ranged_throttle    = 100
}
index src
{
        source                  = src
        path                    = /usr/local/coreseek/var/data/test1
        docinfo                 = extern
        mlock                   = 0
        morphology              = none
        # 启用中文分词功能source 数据源中需要 设置读取的数据编码字符集为UTF-8,否则无
法正确处理;如果是xml,则正确输出为UTF-8编码格式即可;如果是MySQL,则设置读取数据输出
字符集为UTF-8即可
        charset_type            = zh_cn.utf-8
        # 中文分词词库位置
        charset_dictpath        =/usr/local/mmseg/etc/
}
index moresrc : src
{
        source = moresrc
        path                    = /usr/local/coreseek/var/data/moresrc
        morphology              = stem_en
}
indexer
{
        # memory limit, in bytes, kiloytes (16384K) or megabytes (256M)
        # optional, default is 32M, max is 2047M, recommended is 256M to 1024M
        #现在还是不知道是什么意思
        mem_limit               = 32M
}

 

 

 

root@timeless-HP-Pavilion-g4-Notebook-PC:/usr/local/coreseek/bin# /usr/local/coreseek/bin/indexer -c /usr/local/coreseek/etc/csft.increment.conf  --all --rotate
Coreseek Fulltext 4.1 [ Sphinx 2.0.2-dev (r2922)]
Copyright (c) 2007-2011,
Beijing Choice Software Technologies Inc (http://www.coreseek.com)

 using config file /usr/local/coreseek/etc/csft.increment.conf...
indexing index src...
WARNING: Attribute count is 0: switching to none docinfo
collected 6 docs, 0.0 MB
sorted 0.0 Mhits, 100.0% done
total 6 docs, 293 bytes
total 0.011 sec, 25970 bytes/sec, 531.82 docs/sec
indexing index moresrc...
WARNING: Attribute count is 0: switching to none docinfo
collected 0 docs, 0.0 MB
total 0 docs, 0 bytes
total 0.001 sec, 0 bytes/sec, 0.00 docs/sec
total 3 reads, 0.000 sec, 0.1 kb/call avg, 0.0 msec/call avg
total 11 writes, 0.000 sec, 0.1 kb/call avg, 0.0 msec/call avg
rotating indices: succesfully sent SIGHUP to searchd (pid=13100).

 

 

 

 

root@timeless-HP-Pavilion-g4-Notebook-PC:/usr/local/coreseek/bin# /usr/local/coreseek/bin/indexer moresrc -c /usr/local/coreseek/etc/csft.increment.conf --rotate
Coreseek Fulltext 4.1 [ Sphinx 2.0.2-dev (r2922)]
Copyright (c) 2007-2011,
Beijing Choice Software Technologies Inc (http://www.coreseek.com)

 using config file /usr/local/coreseek/etc/csft.increment.conf...
indexing index moresrc...
WARNING: Attribute count is 0: switching to none docinfo
collected 1 docs, 0.0 MB
sorted 0.0 Mhits, 100.0% done
total 1 docs, 30 bytes
total 0.008 sec, 3457 bytes/sec, 115.24 docs/sec
total 2 reads, 0.000 sec, 0.0 kb/call avg, 0.0 msec/call avg
total 6 writes, 0.000 sec, 0.0 kb/call avg, 0.0 msec/call avg
rotating indices: succesfully sent SIGHUP to searchd (pid=13100).

 

 

 

root@timeless-HP-Pavilion-g4-Notebook-PC:/usr/local/coreseek/bin# /usr/local/coreseek/bin/indexer --merge src moresrc  -c /usr/local/coreseek/etc/csft.increment.conf --rotate
Coreseek Fulltext 4.1 [ Sphinx 2.0.2-dev (r2922)]
Copyright (c) 2007-2011,
Beijing Choice Software Technologies Inc (http://www.coreseek.com)

 using config file /usr/local/coreseek/etc/csft.increment.conf...
read 0.0 of 0.0 MB, 100.0% done
merged 0.0 Kwords
merged in 0.000 sec
total 40 reads, 0.000 sec, 6.4 kb/call avg, 0.0 msec/call avg
total 5 writes, 0.000 sec, 0.1 kb/call avg, 0.0 msec/call avg
rotating indices: succesfully sent SIGHUP to searchd (pid=13100).

 

 

 

root@timeless-HP-Pavilion-g4-Notebook-PC:/usr/local/coreseek/bin# ./search -c /usr/local/coreseek/etc/csft.increment.conf  测试
Coreseek Fulltext 4.1 [ Sphinx 2.0.2-dev (r2922)]
Copyright (c) 2007-2011,
Beijing Choice Software Technologies Inc (http://www.coreseek.com)

 using config file /usr/local/coreseek/etc/csft.increment.conf...
index src: query 测试 : returned 3 matches of 3 total in 0.000 sec

displaying matches:
1. document=2, weight=2637
    id=2
    title=?????
    content=?? ?????? ????  ??
    addtime=0
2. document=7, weight=2627
    id=7
    title=??
    content=????????
    addtime=0
3. document=1, weight=1571
    id=1
    title=???
    content=????????    ?????? ????
    addtime=1444444444

words:
1. 测试: 3 documents, 14 hits

index moresrc: query 测试 : returned 1 matches of 1 total in 0.000 sec

displaying matches:
1. document=7, weight=2500
    id=7
    title=??
    content=????????
    addtime=0

words:
1. 测试: 1 documents, 5 hits

 

sphinx 增量索引测试

标签:

原文地址:http://www.cnblogs.com/timelesszhuang/p/4757092.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!