首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > PHP >

施用 solr php 的输出

2012-09-21 
使用 solr php 的输出转载:使用 solr php 的输出发表于:2009年2月18日?| 分类:Solr?| 标签:?php,?solr?|?s

使用 solr php 的输出

转载:使用 solr php 的输出发表于:2009年2月18日?| 分类:Solr?| 标签:?php,?solr?|?

solr 1.3 增加了 php 的输出类型,这个 php 调用 solr 搜索的时候解析结果可能比较快。php 有两种:一是 php 结构(语法的,类似 json);另一各是,php 序列化的,可以用 php的反序列化来解析。下面示例下怎么用

Solr's PHP Output :

  1. $code?=?file_get_contents('http://localhost:8983/solr/select?q=iPod&wt=php');??
  2. eval("$result?=?"?.?$code?.?";");??
  3. print_r($result);??

Solr's PHP Serialized Output :

  1. $serializedResult?=?file_get_contents('http://localhost:8983/solr/select?q=iPod&wt=phps');??
  2. $result?=?unserialize($serializedResult);??
  3. print_r($result);??

提示:要使用这两种输出,要在服务器上打开它们,编辑solrconfig.xml,去注释(或加上这这些内容):

  1. <queryResponseWriter?name="php"?class="org.apache.solr.request.PHPResponseWriter"/>??
  2. <queryResponseWriter?name="phps"?class="org.apache.solr.request.PHPSerializedResponseWriter"/>??

其它:

热心的开发者还写了 php 的客户端:SolrPhpClient, 来源:https://issues.apache.org/jira/browse/SOLR-341

?

热点排行