Home  >  Article  >  Backend Development  >  施用 solr php 的输出

施用 solr php 的输出

WBOY
WBOYOriginal
2016-06-13 13:13:531055browse

使用 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 :

  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

?

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn