zoukankan      html  css  js  c++  java
  • sphinx配置实时索引(转)

    实地测试非常有效转一下

    下载sphinx包之后进行编译, 
    需要标识使用bigint作为sphinx的id 

    Java代码  收藏代码
    1. ./configure --prefix=/path/you/want --enable-id64  
    Java代码  收藏代码
    1. make install  



    写好实时索引的配置文件 

    Java代码  收藏代码
    1. vim etc/sphinx.conf  
    2. index testrt  
    3. {  
    4.     type            = rt  
    5.     rt_mem_limit        = 32M   
    6.   
    7.     path            = /sphinxhome/var/data/testrt  
    8.   
    9.     docinfo                 = extern  
    10.     mlock                   = 0   
    11.     morphology              = none  
    12.     min_word_len            = 1   
    13.     charset_type            = utf-8  
    14.     charset_table           = 0..9, A..Z->a..z, _, &, a..z, U+410..U+42F->U+430..U+44F, U+430..U+44F  
    15.     ngram_len               = 1   
    16.     ngram_chars             = U+3000..U+2FA1F  
    17.     html_strip              = 0   
    18.   
    19.     rt_field        = content  
    20.     rt_field        = addr  
    21.     rt_attr_string      = province  
    22.     rt_attr_string      = city  
    23.     rt_attr_uint        = rank  
    24. }  
    25.   
    26. indexer  
    27. {  
    28.     mem_limit       = 32M   
    29. }  
    30.   
    31. searchd  
    32. {  
    33.     listen          = 9312  
    34.     listen          = 9306:mysql41  
    35.     log         = /sphinxhome/var/log/searchd.log  
    36.     query_log       = /sphinxhome/var/log/query.log  
    37.     read_timeout        = 5  
    38.     max_children        = 30  
    39.     pid_file        = /sphinxhome/var/log/searchd.pid  
    40.     max_matches     = 1000  
    41.     seamless_rotate     = 1  
    42.     preopen_indexes     = 1  
    43.     unlink_old      = 1  
    44.     workers         = threads # for RT to work  
    45.     binlog_path     = /sphinxhome/var/data  
    46.   
    47.     rt_flush_period     = 900  
    48.     compat_sphinxql_magics = 0  
    49. }  



    重启sphinx的小脚本 

    Java代码  收藏代码
    1. #!/bin/sh  
    2. bin/searchd --stop  
    3. rm -rf var/data/*  
    4. bin/searchd  



    进入sphinx的mysql,主要检查id是否为bigint 

    Java代码  收藏代码
      1. mysql -h 127.0.0.1 -P 9306  
      2. desc testrt;  
      3. select * from testrt where match('haha');  
      4. insert into testrt(id, content, addr, province, city) values(1234567890'content''addr''province', 'city);  
  • 相关阅读:
    驱动调试常见问题_Camera
    如何从零开始开发一款嵌入式产品(20年的嵌入式经验)
    git入门与实践
    ramfs, rootfs, initrd and initramfs
    Living a Fulfilling Life: A Guide to Following Your Heart
    有关 jffs2_scan_eraseblock 问题小结
    JS_imgload
    JS_闭包和内存.
    JS_textarea自适应高度
    Css_制作旋转字体
  • 原文地址:https://www.cnblogs.com/zhenzhong/p/3312670.html
Copyright © 2011-2022 走看看