コード例 #1
0
    public function search($request, $response)
    {/*{{{*/
        $timeStart = XUtility::getStartTime();
        $type = $request->getRequest('type','all');
        $p = $request->getRequest('p',1);
        $kw = $this->getRequestKeyWord($request, $response);
        $this->addSearchLog($kw);
        $trimedKeyWord = $this->processKeyWord($kw);
        $result = SphinxSearchdBase::getNullResult();

        $allSearchd = new AllSearchd($trimedKeyWord);
        $keyWord = '';

        if($trimedKeyWord)
        {
            $allSearchd->setIndexType($type);
            $allSearchd->setPage($p);
            $allSearchd->query($trimedKeyWord);
            $result = $allSearchd->getSearchResult($type);
            if($type == 'all' || ($type == 'allarticle' && $p == 1))
            {
                $response->paperRes = $allSearchd->getDiseasePaperResult4Article();
            }
        }

        $response->trimedKeyWord = $kw;
        $response->keyWord = $keyWord;
        $response->allSearchd = $allSearchd;
        $response->result = $result;
        $response->type = $type;
        $response->p = $p;
        $response->timeSpan = XUtility::getCostTime($timeStart);
    }/*}}}*/
コード例 #2
0
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="navbarb2">
<tr>
<td>
      <?php foreach(AllSearchd::getNavTabs() as $tabType => $tabName) {
      ?>

        <table class="navbar2" border="0" cellspacing="0" cellpadding="0">
        <tbody>
          <tr>
            <td class="navbar_<?php echo $type==$tabType?'focus':'blur';?>_left"></td>
            <td class="navbar_<?php echo $type==$tabType?'focus':'blur';?>_middle"><a href="/index/search?type=<?php echo $tabType?>&kw=<?php echo urlencode($trimedKeyWord);?>"><?php echo $tabName;?><?php echo ($trimedKeyWord && $tabType!='all')?'('.$allSearchd->getTotalCntByType($tabType).')':'';?></a></td>
            <td class="navbar_<?php echo $type==$tabType?'focus':'blur';?>_right"></td>
          </tr>
          </tbody>
        </table>
        <?php } ?>
 </td>
 </tr>
 </table>