♂chen 发表于 2012-11-16 09:51:51

自己写的,在CI框架下生成Solr索引查询URL

最近的项目用了CI,所有的数据都是从各种不同的Solr 索引里查询而来,直接拼检索式异常麻烦,可读性太差,就自己写了一个简单的,基本能满足查询需求了。呵呵,希望对一样用CI和Solr的朋友有帮助,这两天把我的解析结果的helper再post到github上。

调用方法,详情https://github.com/jy00295005/codeIgniter-solr-helper-library ,求关注


class Contraller extends CI_Controller {      function Institute () {      parent::__construct();      $this->load->library('solr_url');    }public function myFunc(){    //varables    $solr_conf = array('host' => '10.0.15.xx' , 'port' => '8080' , 'DB' => 'myDatabase');    $inputArr = array('EnName_t' => 'Academy' , 'Country_t' => 'China' );    $facetArr = array('IBType_t','InstClassified_s');    //call methods      $this->solr_url->get_base_url($solr_conf);    $this->solr_url->getQuery($inputArr,'AND');    $this->solr_url->getSort('EnName_t','desc');    $this->solr_url->getFacet($facetArr,array('IBType_t'=>'index'),'3');    $this->solr_url->getFQ(array('ESI_Fields14_S'=>'Engineering'));    //create URL now!!    echo $this->solr_url->echo_solr_url('json',"0","20");}



yuvista 发表于 2012-11-16 12:28:34

楼主贴代码的可读性{:soso_e117:},感谢楼主

♂chen 发表于 2012-11-16 15:58:33

yuvista 发表于 2012-11-16 12:28 static/image/common/back.gif
楼主贴代码的可读性,感谢楼主

是从github上用.md 文件贴的,结果成这个样了。详情请看上面的连接

♂chen 发表于 2012-11-16 16:03:42

新更新了helper帮助ci解析solr返回结果,我是新手,写的粗糙。源码与调用请看上面github的链接
页: [1]
查看完整版本: 自己写的,在CI框架下生成Solr索引查询URL