Пример #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);
    }/*}}}*/