💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、豆包、星火、月之暗面及文生图、文生视频 广告
# Sphinx 该扩展提供了针对Sphinx搜索客户端开发库的绑定. Sphinx是一个独立的搜索引擎系统,其目的是为其他相关程序和应用提供快速的、规模可扩展的全文搜索功能. Sphinx有着良好的设计,可以很方便的与SQL数据库结合,并使用脚本语言调用. SPhinx 以及 其客户端库 可以从[» 官方站点](http://sphinxsearch.com/)获取,中文用户也可以从[» Coreseek](http://www.coreseek.cn/)获取支持中文的版本和服务。 <https://pecl.php.net/package/sphinx> 2015年停止维护维护 - [SphinxClient::addQuery](https://www.php.net/manual/zh/sphinxclient.addquery.php)— Add query to multi-query batch - [SphinxClient::buildExcerpts](https://www.php.net/manual/zh/sphinxclient.buildexcerpts.php)— Build text snippets - [SphinxClient::buildKeywords](https://www.php.net/manual/zh/sphinxclient.buildkeywords.php)— Extract keywords from query - [SphinxClient::close](https://www.php.net/manual/zh/sphinxclient.close.php)— 关闭先前打开的持久连接 - [SphinxClient::\_\_construct](https://www.php.net/manual/zh/sphinxclient.construct.php)— Create a new SphinxClient object - [SphinxClient::escapeString](https://www.php.net/manual/zh/sphinxclient.escapestring.php)— Escape special characters - [SphinxClient::getLastError](https://www.php.net/manual/zh/sphinxclient.getlasterror.php)— Get the last error message - [SphinxClient::getLastWarning](https://www.php.net/manual/zh/sphinxclient.getlastwarning.php)— Get the last warning - [SphinxClient::open](https://www.php.net/manual/zh/sphinxclient.open.php)— 建立到搜索服务端的持久连接 - [SphinxClient::query](https://www.php.net/manual/zh/sphinxclient.query.php)— 执行搜索查询 - [SphinxClient::resetFilters](https://www.php.net/manual/zh/sphinxclient.resetfilters.php)— Clear all filters - [SphinxClient::resetGroupBy](https://www.php.net/manual/zh/sphinxclient.resetgroupby.php)— Clear all group-by settings - [SphinxClient::runQueries](https://www.php.net/manual/zh/sphinxclient.runqueries.php)— Run a batch of search queries - [SphinxClient::setArrayResult](https://www.php.net/manual/zh/sphinxclient.setarrayresult.php)— 控制搜索结果集的返回格式 - [SphinxClient::setConnectTimeout](https://www.php.net/manual/zh/sphinxclient.setconnecttimeout.php)— Set connection timeout - [SphinxClient::setFieldWeights](https://www.php.net/manual/zh/sphinxclient.setfieldweights.php)— Set field weights - [SphinxClient::setFilter](https://www.php.net/manual/zh/sphinxclient.setfilter.php)— 增加整数值过滤器 - [SphinxClient::setFilterFloatRange](https://www.php.net/manual/zh/sphinxclient.setfilterfloatrange.php)— Add new float range filter - [SphinxClient::setFilterRange](https://www.php.net/manual/zh/sphinxclient.setfilterrange.php)— Add new integer range filter - [SphinxClient::setGeoAnchor](https://www.php.net/manual/zh/sphinxclient.setgeoanchor.php)— Set anchor point for a geosphere distance calculations - [SphinxClient::setGroupBy](https://www.php.net/manual/zh/sphinxclient.setgroupby.php)— Set grouping attribute - [SphinxClient::setGroupDistinct](https://www.php.net/manual/zh/sphinxclient.setgroupdistinct.php)— Set attribute name for per-group distinct values count calculations - [SphinxClient::setIDRange](https://www.php.net/manual/zh/sphinxclient.setidrange.php)— Set a range of accepted document IDs - [SphinxClient::setIndexWeights](https://www.php.net/manual/zh/sphinxclient.setindexweights.php)— Set per-index weights - [SphinxClient::setLimits](https://www.php.net/manual/zh/sphinxclient.setlimits.php)— 设置返回结果集偏移量和数目 - [SphinxClient::setMatchMode](https://www.php.net/manual/zh/sphinxclient.setmatchmode.php)— 设置全文查询的匹配模式 - [SphinxClient::setMaxQueryTime](https://www.php.net/manual/zh/sphinxclient.setmaxquerytime.php)— Set maximum query time - [SphinxClient::setOverride](https://www.php.net/manual/zh/sphinxclient.setoverride.php)— Sets temporary per-document attribute value overrides - [SphinxClient::setRankingMode](https://www.php.net/manual/zh/sphinxclient.setrankingmode.php)— Set ranking mode - [SphinxClient::setRetries](https://www.php.net/manual/zh/sphinxclient.setretries.php)— Set retry count and delay - [SphinxClient::setSelect](https://www.php.net/manual/zh/sphinxclient.setselect.php)— Set select clause - [SphinxClient::setServer](https://www.php.net/manual/zh/sphinxclient.setserver.php)— 设置searchd的主机名和TCP端口 - [SphinxClient::setSortMode](https://www.php.net/manual/zh/sphinxclient.setsortmode.php)— Set matches sorting mode - [SphinxClient::status](https://www.php.net/manual/zh/sphinxclient.status.php)— Queries searchd status - [SphinxClient::updateAttributes](https://www.php.net/manual/zh/sphinxclient.updateattributes.php)— Update document attributes 例子 ``` <pre class="calibre17">``` $s <span class="token1">=</span> <span class="token5">new</span> <span class="token4">SphinxClient</span><span class="token3">;</span> $s<span class="token1">-</span><span class="token1">></span><span class="token4">setServer</span><span class="token3">(</span><span class="token2">"localhost"</span><span class="token3">,</span> <span class="token6">6712</span><span class="token3">)</span><span class="token3">;</span> $s<span class="token1">-</span><span class="token1">></span><span class="token4">setMatchMode</span><span class="token3">(</span>SPH_MATCH_ANY<span class="token3">)</span><span class="token3">;</span> $s<span class="token1">-</span><span class="token1">></span><span class="token4">setMaxQueryTime</span><span class="token3">(</span><span class="token6">3</span><span class="token3">)</span><span class="token3">;</span> $result <span class="token1">=</span> $s<span class="token1">-</span><span class="token1">></span><span class="token4">query</span><span class="token3">(</span><span class="token2">"test"</span><span class="token3">)</span><span class="token3">;</span> <span class="token4">var_dump</span><span class="token3">(</span>$result<span class="token3">)</span><span class="token3">;</span> ``` ```