使用 solr php 的输出
转载:使用 solr php 的输出发表于:2009年2月18日?| 分类:solr?| 标签:?php,?solr?|?views(1,054)版权信息: 可以任意转载, 转载时请务必以超链接形式标明文章原文出处, 即下面的声明.
?
原文出处:http://blog.chenlb.com/2009/02/use-solr-php-writer.html
solr 1.3 增加了 php 的输出类型,这个 php 调用 solr 搜索的时候解析结果可能比较快。php 有两种:一是 php 结构(语法的,类似 json);另一各是,php 序列化的,可以用 php的反序列化来解析。下面示例下怎么用
solr's php output :
$code?=?file_get_contents('http://localhost:8983/solr/select?q=ipod&wt=php');eval($result?=??.?$code?.?;);print_r($result);solr's php serialized output :
$serializedresult?=?file_get_contents('http://localhost:8983/solr/select?q=ipod&wt=phps');$result?=?unserialize($serializedresult);print_r($result);提示:要使用这两种输出,要在服务器上打开它们,编辑solrconfig.xml,去注释(或加上这这些内容):
queryresponsewriter?name=php?class=org.apache.solr.request.phpresponsewriter/>queryresponsewriter?name=phps?class=org.apache.solr.request.phpserializedresponsewriter/>其它:
热心的开发者还写了 php 的客户端:solrphpclient, 来源:https://issues.apache.org/jira/browse/solr-341
?