当前位置: 首页>>代码示例>>PHP>>正文


PHP SphinxClient::setArrayResult方法代码示例

本文整理汇总了PHP中SphinxClient::setArrayResult方法的典型用法代码示例。如果您正苦于以下问题:PHP SphinxClient::setArrayResult方法的具体用法?PHP SphinxClient::setArrayResult怎么用?PHP SphinxClient::setArrayResult使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SphinxClient的用法示例。


在下文中一共展示了SphinxClient::setArrayResult方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: resetClient

 /**
  * Reset settings sphinx
  */
 public function resetClient()
 {
     $this->_client->resetFilters();
     $this->_client->resetGroupBy();
     $this->_client->setArrayResult(false);
     //DEPRECATED: Do not call this method or, even better, use SphinxQL instead of an API
     //$this->_client->setMatchMode(SPH_MATCH_EXTENDED2);
     $this->_client->setLimits(0, 20, 1000, 0);
     $this->_client->setFieldWeights(array());
     $this->_client->setSortMode(SPH_SORT_RELEVANCE, '');
     $this->_client->_error = '';
     $this->_client->_warning = '';
 }
开发者ID:bleid3,项目名称:yii-component-sphinx,代码行数:16,代码来源:AdvSphinxConnection.php

示例2: search

 public function search(Request $request)
 {
     //$keyword = '服务器';
     //$keywords = $requests->get('keywords');
     //$requests = $request;
     //return $requests->get('keywords')->toString();
     $keyword = $request->get('keywords');
     //$keyword = $keywords ? addslashes($keywords) : addslashes($_REQUEST['keywords']);
     //header("content-type:text/html;charset=utf-8");
     // include('/home/tmp/tool/coreseek-3.2.14/csft-3.2.14/api/sphinxapi.php');
     $s = new \SphinxClient();
     $s->setServer("localhost", 9312);
     $s->setArrayResult(true);
     // $s->setSelect();
     $s->setMatchMode(SPH_MATCH_ALL);
     $result = $searchList = array();
     if ($keyword) {
         $result = $s->query($keyword, 'test1');
         // 获取检索到的文章id
         $idArr = array();
         $data = $titleArr = array();
         if (isset($result['matches']) && is_array($result['matches'])) {
             foreach ($result['matches'] as $k => $v) {
                 $idArr[] = $v['attrs']['article_id'];
             }
             $idStr = implode(',', $idArr);
             // 查找文章
             $data['articles'] = \DB::table('blog_articles')->whereRaw('id in (' . $idStr . ')')->get();
             $contentArr = \DB::table('blog_content')->whereRaw('article_id in (' . $idStr . ')')->get();
             if ($contentArr) {
                 $newContentArr = array();
                 foreach ($contentArr as $k => $v) {
                     $newContentArr[$v->article_id] = $v->content;
                 }
                 $contentArr = $newContentArr;
                 unset($newContentArr);
             }
             if ($data['articles']) {
                 foreach ($data['articles'] as $k => $v) {
                     $searchList[$k]['id'] = $v->id;
                     $searchList[$k]['title'] = $v->title;
                     $searchList[$k]['content'] = $contentArr[$v->id];
                 }
             }
             //var_dump($searchList);exit();
             return view('articles.search', compact('searchList'));
         }
     } else {
         $searchList[0]['message'] = '请输入要查询的关键词~';
         return;
     }
     return view('articles.search', compact('searchList'));
     //var_dump(rand(1000,9999));
     //return '';
 }
开发者ID:suhanyujie,项目名称:digitalOceanVps,代码行数:55,代码来源:ArticlesController.php

示例3: resetCriteria

 /**
  * @brief reset search criteria to default
  * @details reset conditions and set default search options
  */
 public function resetCriteria()
 {
     if (is_object($this->criteria)) {
         $this->lastCriteria = clone $this->criteria;
     } else {
         $this->lastCriteria = new stdClass();
     }
     $this->criteria = new stdClass();
     $this->criteria->query = '';
     $this->client->resetFilters();
     $this->client->resetGroupBy();
     $this->client->setArrayResult(false);
     $this->client->setMatchMode($this->matchMode);
     //        $this->client->setRankingMode($this->rankMode);
     $this->client->setSortMode(SPH_SORT_RELEVANCE, '@relevance DESC');
     $this->client->setLimits(0, 1000000, 10000);
     if (!empty($this->fieldWeights)) {
         $this->client->setFieldWeights($this->fieldWeights);
     }
 }
开发者ID:zwq,项目名称:unpei,代码行数:24,代码来源:DGSphinxSearch.php


注:本文中的SphinxClient::setArrayResult方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。