导航:首页 > 编程语言 > sphinxphpmysql

sphinxphpmysql

发布时间:2023-01-19 00:48:18

‘壹’ sphinxapi.php的SetSortMode()怎么用啊

如果你是用sphinx查询出id数组,

再到mysql中

select*fromtable1whereidin(id1,id2,...)

这样查询出结果,

需要注意在mysql中加上order语法:

select*fromtable1whereidin(id1,id2,...)whereidin(id1,id2,...)
orderbyfield(id,id1,id2,...)

order by field(id, id1,id2, ...)

ps: 抱歉,我来晚了~

‘贰’ sphinx和solr哪个更适合php站点

建议使用Elasticsearch和solr一样,使用lucene
这个和php无关,因为无论哪个工具,都是通过网络接口查询,所以不回答有关是否适合php的情况~~

## ES 缺点
基于java,会有一些java的常见问题需要注意,比如gc
单纯执行速度上比C写的sphinx慢

## sphinx 优点
纯粹,没有什么花哨的其他功能
C写的,速度快
新版本加了分布式、动态更新索引等功能

## 下面列举Es比sphinx优秀的部分
1、部署简单,虽然sphinx部署也挺简单,但是在书写配置的时候,你会发现,sphinx的配置是要写好后,重启sphinx,而Elasticsearch针对某个索引的配置,是可以动态写入的。
2、调试简单,sphinx有命令行工具可以调试,而Elasticsearch使用的是http接口进行调试,不需要专门的API类,几行php代码就可以写一个Elasticsearch的API。
3、可视化工具比较多,有收费的,也有免费的,比如kibana head marvel。
4、提供结构化的JSON查询语句,易读性强
5、Es可以保留源数据(可选),也就是说,你可以不需要mysql的支持,就可以完成整个搜索过程,即使你不需要这个功能,在调试的时候,还是让人感到非常便利,不用将查询结果到数据库匹配一下。
6、Es可以动态更新全文索引,动态更新单个记录,而不像sphinx一样需要重建全部
7、对UTF8的支持是不需要单独配置的

## 从中文分词上来说
首先分词最重要的基本都是词库,分词算法两个工具基本都可以使用。
lucene 支持很多分词工具,比如
word https://github.com/ysc/word
比如ik https://github.com/medcl/elasticsearch-analysis-ik
这两个工具最近都很活跃,因为Es更新2.0 和 2.1

比较分词区别(sphinx可能有误):
sphinx分词 不太熟悉它的机制,多数情况下使用scws分词,发送给sphinx,然后设置匹配规则,比如最大匹配(我基本都是基于模糊匹配在用sphinx)

Es的全文索引是基于分词的,也就是事先分好词,每个词对应某些记录,自动进行TF/IDF的运算,得到一个评分后返回,当然这个评分可以改(sphinx同样支持修改评分),这种检索方式肯定更快,但是受到分词限制,所以我每个字也分词,然而这样可能影响分数判断。

另一方面ES也支持类似sphinx的匹配方式,叫做fuzzy,模糊匹配,一般会一起使用,一个词不在分词库中的时候,就用fuzzy,所以Es在功能上,应该和sphinx不会有太多差别,而且应该要更多。

## 个人方面
在使用shpinx的时候,会查3次,一次完全按照用户输入的查(如果用户没有输入空格),一次按照空格分开查或者分词系统分词结果查,一次按照单个字来查(前提是前面两个结果太少)。

在用Es的时候,如果没有办法正确分词,会按照fuzzy + 单字查(可以同时进行),如果有办法分词,按照分词结果 + 单字查(可以同时)

## 后期维护上:
sphinx的配置文件在mysql分表之后,维护起来是比较麻烦的,你可以用php脚本当做配置文件,这样会好很多。
Es的索引是可以主动发给它去建立的(通过http接口),分表之后,它不关心数据库状态和结构。新增字段可以热更新。

## 扩展性上:
Es和sphinx都支持分布式索引,扩展性都没有问题
两者都支持别名,Es的别名加上动态建立索引,使得更换索引结构或者重建索引后,支持0宕机时间。而sphinx的rotate选项可以动态更新索引(不知道能不能动态创建索引,因为sphinx我在使用的时候,索引都要求写在配置文件里。
性能方面没有测试数据。从直观感受上sphinx要快一些。

‘叁’ 电脑-Sphinx在windows下安装使用[支持中文全文检索]

前一阵子尝试使用了一下Sphinx,一个能够被各种语言(PHP/python/Ruby/etc)方便调用的全文检索系统。网上的资料大多是在linux环境下的安装使用,当然,作为生产环境很有必要部署在*nix环境下,作为学习测试,还是windows环境比较方便些。

本文旨在提供一种便捷的方式让Sphinx在windows下安装配置以支持中文全文检索,配置部分在linux下通用。

一、关于Sphinx

Sphinx 是一个在GPLv2 下发布的一个全文检索引擎,商业授权(例如, 嵌入到其他程序中)需要联系作者(Sphinxsearch.com)以获得商业授权。

一般而言,Sphinx是一个独立的搜索引擎,意图为其他应用提供高速、低空间占用、高结果相关度的全文搜索功能。Sphinx可以非常容易的与SQL数据库和脚本语言集成。

当前系统内置MySQL和PostgreSQL 数据库数据源的支持,也支持从标准输入读取特定格式的XML数据。通过修改源代码,用户可以自行增加新的数据源(例如:其他类型的DBMS的原生支持)。

搜索API支持PHP、Python、Perl、Rudy和Java,并且也可以用作MySQL存储引擎。搜索API非常简单,可以在若干个小时之内移植到新的语言上。

Sphinx特性:

高速的建立索引(在当代CPU上,峰值性能可达到10MB/秒); 高性能的搜索(在2–4GB的文本数据上,平均每次检索响应时间小于0.1秒); 可处理海量数据(目前已知可以处理超过100GB的文本数据,在单一CPU的系统上可处理100M文档); 提供了优秀的相关度算法,基于短语相似度和统计(BM25)的复合Ranking方法; 支持分布式搜索; 提供文件的摘录生成; 可作为MySQL的存储引擎提供搜索服务; 支持布尔、短语、词语相似度等多种检索模式; 文档支持多个全文检索字段(最大不超过32个); 文档支持多个额外的`属性信息(例如:分组信息,时间戳等); 停止词查询; 支持单一字节编码和UTF-8编码; 原生的MySQL支持(同时支持MyISAM和InnoDB); 原生的PostgreSQL支持.

中文手册可以在这里获得(酷勤网备用下载地址:sphinx_doc_zhcn_0.9.pdf)。

二、Sphinx在windows上的安装

1.直接在http://www.sphinxsearch.com/downloads.html找到最新的windows版本,我这里下的是Win32 release binaries with MySQL support,下载后解压在D:sphinx目录下;

2.在D:sphinx下新建一个data目录用来存放索引文件,一个log目录方日志文件,复制D:sphinxsphinx.conf.in到D:sphinxbinsphinx.conf(注意修改文件名);

3.修改D:sphinxbinsphinx.conf,我这里列出需要修改的几个:

type= mysql # 数据源,我这里是mysqlsql_host;= localhost # 数据库服务器sql_user;= root # 数据库用户名sql_pass;=;'' # 数据库密码sql_db;;;= test # 数据库sql_port;= 3306 # 数据库端口

sql_query_pre;;;= SET NAMES utf8 # 去掉此行前面的注释,如果你的数据库是uft8编码的

index test1{#;放索引的目录;path;;;= D:/sphinx/data/# 编码;charset_type;;= utf-8;#; 指定utf-8的编码表;charset_table=0..9, A..Z->a..z, _, a..z, U+410..U+42F->U+430..U+44F, U+430..U+44F;# 简单分词,只支持0和1,如果要搜索中文,请指定为1;ngram_len;;;;= 1# 需要分词的字符,如果要搜索中文,去掉前面的注释;ngram_chars;;;= U+3000..U+2FA1F}

# index test1stemmed : test1# {;# path;;;= @CONFDIR@/data/test1stemmed;# morphology;;= stem_en# }# 如果没有分布式索引,注释掉下面的内容# index dist1# {;# 'distributed' index type MUST be specified;# type;;;;= distributed

;# local index to be searched;# there can be many local indexes configured;# local;;;;= test1;# local;;;;= test1stemmed

;# remote agent;# multiple remote agents may be specified;# syntax is 'hostname:port:index1,[index2[,...]];# agent;;;;= localhost:3313:remote1;# agent;;;;= localhost:3314:remote2,remote3

;# remote agent connection timeout, milliseconds;# optional, default is 1000 ms, ie. 1 sec;# agent_connect_timeout;= 1000

;# remote agent query timeout, milliseconds;# optional, default is 3000 ms, ie. 3 sec;# agent_query_timeout;;= 3000# }

# 搜索服务需要修改的部分searchd{;# 日志;log;;;;;= D:/sphinx/log/searchd.log

;# PID file, searchd process ID file name;pid_file;;;= D:/sphinx/log/searchd.pid

# windows下启动searchd服务一定要注释掉这个 # seamless_rotate;;= 1}

4.导入测试数据

C:Program FilesMySQLMySQL Server 5.0bin>mysql -uroot test<d:/sphinx/example.sql

5.建立索引

D:sphinxbin>indexer.exe test1

Sphinx 0.9.8-release (r1533)

Copyright (c) 2001-2008, Andrew Aksyonoff

using config file ‘./sphinx.conf’…

indexing index ‘test1′…

collected 4 docs, 0.0 MB

sorted 0.0 Mhits, 100.0% done

total 4 docs, 193 bytes

total 0.101 sec, 1916.30 bytes/sec, 39.72 docs/sec

D:sphinxbin>

6.搜索’test’试试

D:sphinxbin>search.exe test

Sphinx 0.9.8-release (r1533)

Copyright (c) 2001-2008, Andrew Aksyonoff

using config file ‘./sphinx.conf’…

index ‘test1′: query ‘test ‘: returned 3 matches of 3 total in 0.000 sec

displaying matches:

1. document=1, weight=2, group_id=1, date_added=Wed Nov 26 14:58:59 2008

;;;;;id=1

;;;;;group_id=1

;;;;;group_id2=5

;;;;;date_added=2008-11-26 14:58:59

;;;;;title=test one

;;;;;content=this is my test document number one. also checking search within

;phrases.

2. document=2, weight=2, group_id=1, date_added=Wed Nov 26 14:58:59 2008

;;;;;id=2

;;;;;group_id=1

;;;;;group_id2=6

;;;;;date_added=2008-11-26 14:58:59

;;;;;title=test two

;;;;;content=this is my test document number two

3. document=4, weight=1, group_id=2, date_added=Wed Nov 26 14:58:59 2008

;;;;;id=4

;;;;;group_id=2

;;;;;group_id2=8

;;;;;date_added=2008-11-26 14:58:59

;;;;;title=doc number four

;;;;;content=this is to test groups

words:

1. ‘test’: 3 documents, 5 hits

D:sphinxbin>

都所出来了吧。

6.测试中文搜索

修改test数据库中documents数据表,

UPDATE `test`.`documents` SET `title` = ‘测试中文’, `content` = ‘this is my test document number two,应该搜的到吧’ WHERE `documents`.`id` = 2;

重建索引:

D:sphinxbin>indexer.exe –all

搜索’中文’试试:

D:sphinxbin>search.exe 中文

Sphinx 0.9.8-release (r1533)

Copyright (c) 2001-2008, Andrew Aksyonoff

using config file ‘./sphinx.conf’…

index ‘test1′: query ‘中文 ‘: returned 0 matches of 0 total in 0.000 sec

words:

D:sphinxbin>

貌似没有搜到,这是因为windows命令行中的编码是gbk,当然搜不出来。我们可以用程序试试,在D:sphinxapi下新建一个foo.php的文件,注意utf-8编码

<?php

require ’sphinxapi.php’;

$s = new SphinxClient();

$s->SetServer(’localhost’,3312);

$result = $s->Query(’中文’);

var_mp($result);

?>

启动Sphinx searchd服务

D:sphinxbin>searchd.exe

Sphinx 0.9.8-release (r1533)

Copyright (c) 2001-2008, Andrew Aksyonoff

WARNING: forcing –console mode on Windows

using config file ‘./sphinx.conf’…

creating server socket on 0.0.0.0:3312

accepting connections

执行PHP查询:

php d:/sphinx/api/foo.php

结果是不是出来?剩下的工作就是去看手册,慢慢摸索高阶的配置。

‘肆’ mysql怎么与sphinx建立索引

安装sphinx
yum
install
sphinx
libsphinxclient-devel
配置sphinx代替mysql全文索引(/etc/sphinx/sphinx.conf)
source
account_src
{
type
=
mysql
sql_host
=
localhost
sql_user
=
root
sql_pass
=
sql_db
=
test
sql_port
=
3306
sql_query_pre
=
SET
NAMES
utf8
sql_query
=
\
SELECT
*
\
FROM
tb_account
#sql_attr_uint
=
idx_id
sql_field_string
=
name
sql_attr_uint
=
age
}
index
account_idx
{
source
=
account_src
path
=
/var/lib/sphinx/account_src
docinfo
=
extern
charset_type
=
utf-8
}
indexer
{
mem_limit
=
32M
}
searchd
{
listen
=
127.0.0.1:9312
listen
=
9306:mysql41
log
=
/var/log/sphinx/searchd.log
query_log
=
/var/log/sphinx/query.log
read_timeout
=
5
max_children
=
30
pid_file
=
/var/run/sphinx/searchd.pid
max_matches
=
1000
seamless_rotate
=
1
preopen_indexes
=
1
unlink_old
=
1
workers
=
threads
#
for
RT
to
work
binlog_path
=
/var/lib/sphinx
}
创建全量索引
indexer
--config
/etc/sphinx/sphinx.conf
--all
启动后台搜索服务
searchd
--config
/etc/sphinx/sphinx.conf
可设置crontab定期构建索引
indexer
--config
/etc/sphinx/sphinx.conf
--rotate
account_idx
测试(自带search工具已不可用,可参照这里),所以需要源码安装sphinx的php扩展

‘伍’ php windows下怎么安装sphinx,安装后又怎么使用

1、下载,我这里下的是“Win64 binaries w/MySQL+PgSQL+libstemmer+id64 support”,下载后文件名:sphinx-2.0.6-release-win64-id64-full.zip;
2、将其解压到D: \ sphinx,并在D:\sphinx下新建目录data(用来存放索引文件)与log(用来存放日志文件);
3、将D:\sphinx\sphinx.conf.in复制到D:\sphinx\bin\sphinx.conf.in,并重命名为sphinx.conf;
4、修改 D:\sphinx\bin\sphinx.conf 如下:
4.1、搜索source src1修改{...}中的内容
# 使用的数据库类型
type = mysql
# 服务器
sql_host = localhost
# 数据库登录名
sql_user = root
# 数据库登录密码
sql_pass = root
# 操作的数据库名称
sql_db = test
# 数据库服务器端口
sql_port = 3306
# 设置编码,如果用的是utf-8编码
sql_query_pre = SET NAMES utf-8
(以上7条前如有#将其删除)
4.2、搜索index test1修改{...}中的内容
# 放索引的目录
path = D:/sphinx/data/
# 编码
charset_type = utf-8
# 指定utf-8编码表
charset_table = 0..9, A..Z->a..z, _, a..z, U+410..U+42F->U+430..U+44F, U+430..U+44F
# 简单分词,只有0和1,需要搜索中文必须置1
ngram_len = 1
# 需要分词的字符,搜索中文时必须
ngram_chars = U+3000..U+2FA1F
(以上5条前如有#将其删除)
5、导入测试数据将D:\sphinx\example.sql中语句执行到test数据库中,注意:test数据库创建时需要指定为utf-8格式;
6、打开cmd窗口,进入目录D:\sphinx\bin;
7、建立索引,执行indexer.exe test1,test1即为sphinx.conf中index test1
Sphinx 2.0.6-id64-release (r3473)
Copyright (c) 2001-2012, Andrew Aksyonoff
Copyright (c) 2008-2012, Sphinx Technologies Inc (http://sphin

using config file './sphinx.conf'...
indexing index 'test1'...
collected 4 docs, 0.0 MB
sorted 0.0 Mhits, 100.0% done
total 4 docs, 222 bytes
total 0.019 sec, 11252 bytes/sec, 202.74 docs/sec
total 2 reads, 0.000 sec, 0.2 kb/call avg, 0.0 msec/call avg
total 9 writes, 0.000 sec, 0.1 kb/call avg, 0.0 msec/call avg
成功...
8、搜索'test',执行search.exe test
Sphinx 2.0.6-id64-release (r3473)
Copyright (c) 2001-2012, Andrew Aksyonoff
Copyright (c) 2008-2012, Sphinx Technologies Inc (http://sphinxsearch.com)

using config file './sphinx.conf'...
index 'test1': query 'test ': returned 3 matches of 3 total in 0.000 sec

displaying matches:
1. document=1, weight=2421, group_id=1, date_added=Tue Feb 26 10:25:31 2013
id=1
group_id=1
group_id2=5
date_added=2013-02-26 10:25:31
title=test one
content=this is my test document number one. also checking search within
phrases.
2. document=2, weight=1442, group_id=3, date_added=Tue Feb 26 10:25:31 2013
id=2
group_id=3
group_id2=6
date_added=2013-02-26 10:25:31
title= ????
content=this is my test document number two ???????
3. document=4, weight=1442, group_id=2, date_added=Tue Feb 26 10:25:31 2013
id=4
group_id=2
group_id2=8
date_added=2013-02-26 10:25:31
title=doc number four
content=this is to test groups

words:
1. 'test': 3 documents, 4 hits

index 'test1stemmed': search error: failed to open D:/sphinx/data/test1stemmed.s
ph: No such file or directory.
最后面的一句error可忽略;
9、搜索中文,首先将数据库中的内容update含有中文,执行sql语句:
UPDATE documents SET title='中文', content='this is my test document number one. also checking search within phrases.含有中文。' WHERE id=1;
UPDATE documents SET title='中文标题', content='this is my test document number one. also checking search within phrases.含有中文内容。' WHERE id=2;
UPDATE documents SET title='中文标题测试', content='this is my test document number one. also checking search within phrases.含有中文内容。' WHERE id=3;
重新建立索引(执行第7步);
然后执行search.exe 中文
Sphinx 2.0.6-id64-release (r3473)
Copyright (c) 2001-2012, Andrew Aksyonoff
Copyright (c) 2008-2012, Sphinx Technologies Inc (http://sphinxsearch.com)

using config file './sphinx.conf'...
indexing index 'test1'...
collected 4 docs, 0.0 MB
sorted 0.0 Mhits, 100.0% done
total 4 docs, 349 bytes
total 0.025 sec, 13808 bytes/sec, 158.26 docs/sec
total 2 reads, 0.000 sec, 0.3 kb/call avg, 0.0 msec/call avg
total 9 writes, 0.000 sec, 0.2 kb/call avg, 0.0 msec/call avg

D:\sphinx\bin>search.exe 中文
Sphinx 2.0.6-id64-release (r3473)
Copyright (c) 2001-2012, Andrew Aksyonoff
Copyright (c) 2008-2012, Sphinx Technologies Inc (http://sphinxsearch.com)

using config file './sphinx.conf'...
index 'test1': query '中文 ': returned 0 matches of 0 total in 0.000 sec

words:

index 'test1stemmed': search error: failed to open D:/sphinx/data/test1stemmed.s
ph: No such file or directory.
没有搜索到,因为windows命令行中的中文时GBK编码格式,所以没有匹配内容。我们可以使用PHP程序来试试;
10、进入D:\sphinx\api\目录,可以发现sphinx支持php、java、ruby调用,并提供对应的test例子,这里我们使用php来操作,首先将api复制到D:\www\下并重命名为sphinxapi,因为我本机上apache的web目录为D:\www,在D:\www\sphinxapi\下新建search.php,内容为:
<?php
require 'sphinxapi.php';
$s = new SphinxClient();
$s->SetServer('localhost', 9312);
$result = $s->Query('中国');
print_r($result);
echo '<br /><br />';
$result = $s->Query('中文');
print_r($result);
?>
然后回到cmd命令行中,开启sphinx服务,执行searchd.exe(这个必须要执行的)
Sphinx 2.0.6-id64-release (r3473)
Copyright (c) 2001-2012, Andrew Aksyonoff
Copyright (c) 2008-2012, Sphinx Technologies Inc (http://sphinxsearch.com)

using config file './sphinx.conf'...
WARNING: compat_sphinxql_magics=1 is deprecated; please update your application
and config
WARNING: preopen_indexes=1 has no effect with seamless_rotate=0
listening on all interfaces, port=9312
listening on all interfaces, port=9306
precaching index 'test1'
precaching index 'test1stemmed'
WARNING: index 'test1stemmed': preload: failed to open D:/sphinx/data/test1stemm
ed.sph: No such file or directory; NOT SERVING
precaching index 'rt'
WARNING: index 'rt': preload: failed to open @CONFDIR@/data/rt.lock: No such fil
e or directory; NOT SERVING
precached 3 indexes in 0.018 sec
成功...
然后在浏览器中执行http://localhost/sphinxapi/search.php,打印出来的数组结果可以很清晰的看见搜索的结果比对。。。
11、至此sphinx在windows下的简单安装与使用就完成了。

‘陆’ php,sphinx 搜索结果分组问题

setFilter 将城市信息 做为码表存起来。

‘柒’ 怎么用php+sphinx+mongodb来打造千万级搜索

sphinx不能直接支持mongodb的。我们之前是用python来建立sphinx和mongodb之间的数据接口。sphinx索引完成之后,搜索动作时在sphinx自身的索引文件上完成的,不涉及的对数据库的搜索了。然后php再根据sphinx给出的id去读mongodb就可以了,怎么会出现断开什么的?
不过python去读mongodb的速度肯定要比sphinx自己直接读mysql要慢,有实力的话可以自己用c写个接口。

‘捌’ php中spinx怎么安装使用

1. 从http://sphinxsearch.com 下载Sphinx 2.0.1-beta

2. 解压缩到合适目录(这里以d:\shpinx为例)

3. 建立配置文件
Sphinx包默认附带sphinx.conf.in,sphinx-min.conf.in,example.sql例子,我们完全可以从
sphinx-min.conf.in复制出一个sphinx.conf用来测试。

修改sphinx.conf必要项(数据库作为数据源):mysql数据库连接项(参照example.sql建立测试数据到数据库);@CONFDIR@替换成实际目录,然后手动建立好该目录及子目录,这里为

d:\sphinx\data # 索引数据目录
d:\sphinx\log # 进程文件目录

4. 安装Sphinx到Windows服务
searchd.exe --install -c d:\sphinx\sphinx.conf --servicename SphinxSearch
启动该服务

5. PHP客户端测试
进入d:\sphinx\api目录,sphinx提供了php, python , ruby , c等客户端代码,如果Php程序员想访问Sphinx,包含sphinxapi.php就可以了 ,test.php是Sphinx提供的访问例子。

在测试之前,需要生成索引文件到d:\shpinx\data目录,进入d:\sphinx\bin执行
indexer.exe -c d:\sphinx\sphinx.conf --all
运行成功后必须重新启动Sphinx才能生效。重启后执行test.php
php test.php test

‘玖’ php php for循环查询数据库效率低,该如何优化mysql mysql

那就用sphinx 技术,目前这个是最好的,没有之一。
下面是我网络弄过来的,怎么使用还得你自己看白皮书了。
Sphinx的主要特性包括:
高速索引 (在新款CPU上,近10 MB/秒);
高速搜索 (2-4G的文本量中平均查询速度不到0.1秒);
高可用性 (单CPU上最大可支持100 GB的文本,100M文档);
提供良好的相关性排名
支持分布式搜索;
提供文档摘要生成;
提供从MySQL内部的插件式存储引擎上搜索
支持布尔,短语, 和近义词查询;
支持每个文档多个全文检索域(默认最大32个);
支持每个文档多属性;
支持断词;
支持单字节编码与UTF-8编码。[1]

‘拾’ mysql怎么与sphinx建立索引

安装sphinx
yum install sphinx libsphinxclient-devel

配置sphinx代替mysql全文索引(/etc/sphinx/sphinx.conf)

source account_src
{
type = mysql

sql_host = localhost
sql_user = root
sql_pass =
sql_db = test
sql_port = 3306
sql_query_pre = SET NAMES utf8

sql_query = \
SELECT * \
FROM tb_account

#sql_attr_uint = idx_id
sql_field_string = name
sql_attr_uint = age
}

index account_idx
{
source = account_src
path = /var/lib/sphinx/account_src
docinfo = extern
charset_type = utf-8
}

indexer
{
mem_limit = 32M
}

searchd
{
listen = 127.0.0.1:9312
listen = 9306:mysql41
log = /var/log/sphinx/searchd.log
query_log = /var/log/sphinx/query.log
read_timeout = 5
max_children = 30
pid_file = /var/run/sphinx/searchd.pid
max_matches = 1000
seamless_rotate = 1
preopen_indexes = 1
unlink_old = 1
workers = threads # for RT to work
binlog_path = /var/lib/sphinx
}

创建全量索引
indexer --config /etc/sphinx/sphinx.conf --all

启动后台搜索服务
searchd --config /etc/sphinx/sphinx.conf

可设置crontab定期构建索引
indexer --config /etc/sphinx/sphinx.conf --rotate account_idx

测试(自带search工具已不可用,可参照这里),所以需要源码安装sphinx的php扩展

阅读全文

与sphinxphpmysql相关的资料

热点内容
at89c51编程器 浏览:341
项目经理叫醒程序员 浏览:342
autocad旋转命令 浏览:660
手机版wpsoffice怎么打包文件夹 浏览:579
在成都学车用什么app 浏览:818
grep命令管道 浏览:426
java修改重启 浏览:567
单片机供电方案 浏览:770
airpodspro一代怎么连接安卓 浏览:218
豌豆荚app上有什么游戏 浏览:283
公路商店app标签选什么 浏览:339
linuxoracle命令行登录 浏览:227
android深度休眠 浏览:173
php微信开发例子 浏览:846
医得app登录密码是什么 浏览:142
spring开发服务器地址 浏览:412
服务器上如何查看服务器的端口 浏览:678
单片机服务器编译 浏览:770
单口usb打印机服务器是什么 浏览:859
战地五开服务器要什么条件 浏览:956