【发布时间】:2010-09-29 20:28:13
【问题描述】:
我整天都在处理这个问题。但不要让它工作。
我可以通过 CMD 搜索并在我的索引表上获取结果,但我在尝试理解 php 的 sphinxapi 时遇到问题,我什至现在还不完全了解如何编写查询并获得结果有人可以帮我看看是否这东西行得通。
我们如何为 SPHINX 编写 PHP 查询
数据库 = 搜索测试
表 = 文件
忽略我的 sphinx.conf 文件
type = mysql
sql_host = localhost
sql_user = root
sql_pass = sqlpass
sql_db = searchtest
sql_port = 3306 # optional, default is 3306
sql_query = \
SELECT * \
FROM documents
}
index searchtest
{
source = src1
path = C:/xampp/htdocs/sphinx/data/searchtest
docinfo = extern
charset_type = sbcs
}
indexer
{
mem_limit = 32M
}
searchd
{
port = 9312
log = C:/xampp/htdocs/sphinx/log/searchd.log
query_log = C:/xampp/htdocs/sphinx/log/query.log
read_timeout = 5
max_children = 30
pid_file = C:/xampp/htdocs/sphinx/log/searchd.pid.pid
max_matches = 1000
seamless_rotate = 0
preopen_indexes = 0
unlink_old = 1
}
运行索引器后--所有文件都出现在/data目录下,但是/log目录是空的
现在我如何为 php 编写查询?
有人可以帮我写一个在所有表中搜索“mimmi”并显示结果的查询吗?
<?php
include('sphinxapi.php');
$cl = new SphinxClient();
//what to write here, please help stackoverflow?
?>
【问题讨论】:
标签: php api search-engine sphinx