SPHINX SEARCH:searchd 是否必须作为服务运行才能与 PHP 配合使用? [英] SPHINX SEARCH: Does searchd has to run as a service to make it work with PHP?

查看:16
本文介绍了SPHINX SEARCH:searchd 是否必须作为服务运行才能与 PHP 配合使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一整天都在处理这个问题.但不要让它工作.

I've been working with this all day. But don't get it to work.

我可以通过 CMD 搜索并在我的索引表上获得结果,但是我在尝试理解 php 的 sphinxapi 时遇到了问题,我什至不完全了解如何编写查询并获得结果有人可以帮我看看这东西管用.

I can search through CMD and get results on my indexed tables but I have problems trying to understand the sphinxapi for php, i don't even now fully how to write a query and get the results can someone help me to see if this things work.

我们如何为 SPHINX 编写 PHP 查询
数据库 = 搜索测试
表格 = 文件

HOW DO WE WRITE A PHP QUERY FOR SPHINX
DATABASE = searchtest
TABLE = documents

忽略我的 sphinx.conf 文件

overlook of my sphinx.conf file

    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
}

运行indexer后--所有文件都出现在/data目录下,但/log目录为空

after running the indexer --all the files appear in the /data directory, but the /log directory is empty

现在如何编写 php 查询?
有人可以帮我写一个查询,在所有表中搜索mimmi"并显示结果吗?

now how do i write a query for php?
Can someone help me write a query that searches for "mimmi" in all tables and displays the results?

   <?php
  include('sphinxapi.php');

  $cl = new SphinxClient();

 //what to write here, please help stackoverflow?
?>

推荐答案

试试这个

   include('sphinxapi.php');
   $cl = new SphinxClient();
   $result = $cl->Query("mimmi");
   print_r($result);

http://www.sphinxsearch.com/docs/current.html#api-funcgroup-querying

是的,searchd 必须正在运行才能工作.首先,尝试使用--console"选项,当你让它工作时,--install"服务.

Yes, searchd must be running for this to work. First, try it with "--console" option, and when you get it to work, "--install" the service.

http://www.sphinxsearch.com/docs/current.html#参考搜索

这篇关于SPHINX SEARCH:searchd 是否必须作为服务运行才能与 PHP 配合使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆