Skip to content

stork-max/SphinxSearch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

源自sphinx的衍生版

SFC简介

http://sphinxsearchcn.github.io/ ,SFC基于2.2.1-dev版,提供mkdict(与indexer同目录)能“编译”中文词库(xdict格式),作者2013年停更

本仓库简介

提取sfc的代码制作补丁,升级到官方最新开源版 2.2.10 和 sphinx2.3.2-beta 的beta版本(见分支v2.3.2-beta)

官版调整的配置项

DEPRECATED

REMOVED

分词词库

  • 本地解压 xdict_1.1.tar.bz2

  • 编译词库

    $ mkdict xdict_1.1.txt xdict #从xdict_1.1.txt生成xdict文件
    $ cp xdict /usr/local/sphinx/etc/
    
  • 修改配置文件,在 index {...} 域 增加:

    • charset_type = utf-8
    • chinese_dictionary = /usr/local/sphinx/etc/xdict

sphinx2.2.1官版原生支持的“特性”

MVA(multi-valued attributes)

  • 存储逗号分隔整型值(可实现tags)
  • 介绍 http://sphinxsearch.com/docs/latest/mva.html
  • sql_attr_multi 可支持:
    • field 逗号分隔的int
    • query 能取到id,tag列表的SQL
    • ranged-query 区别query,增加了范围查询

同义词 wordforms

  • 单独配置的同义词,会影响分词和检索。
  • 如配置:
     kfc => 肯德基
     觉味鸭脖 => 肯德基
    
  • 在检索时使用 kfc/肯德基/觉味鸭脖 都视为"肯德基"。
  • 这点比coreseek完整,它只能影响分词阶段
  • 官版详尽文档 http://sphinxsearch.com/docs/latest/conf-wordforms.html

索引文件

  • index {path } 指定索引前缀(含存文件名)
  • 生成索引文件的扩展名含义:
    • .spa stores document attributes (used in extern docinfo storage mode only);
    • .spd stores matching document ID lists for each word ID;
    • .sph stores index header information;
    • .spi stores word lists (word IDs and pointers to .spd file);
    • .spk stores kill-lists;
    • .spm stores MVA data;
    • .spp stores hit (aka posting, aka word occurrence) lists for each word ID;
    • .sps stores string attribute data.
    • .spe stores skip-lists to speed up doc-list filtering

影响性能的配置

  • docinfo attr与documentid的存储

    • none无attr/extern独立存储(且kept in RAM)
    • inline(嵌索引)
  • ondisk_attrs 选择各种indexes存放位置(内存/磁盘) 0/1/pool (启用会禁止实时update属性)

  • seamless_rotate 无缝更新索引(0/1),启用时以“空间(内存)换时间”

  • workers MPM工具集,支持fork,prefork,threads

  • rt_mem_limit 单切片文件的最大上限

    • RT索引可实现自动切片
    • (show index xx status; -> disk_chunks)。
    • 实验证明RT索引只保留attr在内存,fields等可随chunks写入磁盘,同理只能UPDATE attr

Distributed Searching

Facets

HTTP protocal

sphinx2.2.1 实现“实时建索引”的几种方式

外部中文分词

概念

  • 提前对文本分为空格间隔的词组,由sphinx默认的分词(英文空格)分词
  • 优点是外部分词可提前写到mysql表,sphinx索引速度飞快,可使用最新版本的sphinx
  • 需要sphinx增加中文识别的码表(见下)

中文(CJK)UTF-8码表:

中文CJK范围:U+3000..U+2FA1F
index charset_table = 0..9, A..Z->a..z, _, a..z, U+A8->U+B8, U+B8, U+C0..U+DF->U+E0..U+FF, U+E0..U+FF, U+3000..U+2FA1F, U+410..U+42F->U+430..U+44F, U+430..U+44F

外部中文分词-结巴分词

客户端

SphinxClient API

PHP扩展 http://pecl.php.net/package/sphinx ,对PHP7支持不友好,dev版发现bug:改了字段重建索引后client无结果

官方写了PHP版的“扩展”,可以跨php版本 https://github.com/gigablah/sphinxphp

SphinxQL

About

No description, website, or topics provided.

Resources

License

MIT, GPL-2.0 licenses found

Licenses found

MIT
LICENSE
GPL-2.0
COPYING

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published