afox123 发表于 2016-12-14 10:36:45

使用 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
页: [1]
查看完整版本: 使用 solr php 的输出