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


PHP SearchEngine::search方法代码示例

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


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

示例1: validate

 /**
  * @see Form::validate()
  */
 public function validate()
 {
     parent::validate();
     // get search conditions
     $conditions = $this->getConditions();
     // check query and author
     if (empty($this->query) && empty($this->username) && !$this->userID) {
         throw new UserInputException('q');
     }
     // build search hash
     $this->searchHash = StringUtil::getHash(serialize(array($this->query, $this->types, !$this->subjectOnly, $conditions, $this->sortField . ' ' . $this->sortOrder, PACKAGE_ID)));
     // check search hash
     if (!empty($this->query)) {
         $sql = "SELECT\tsearchID\n\t\t\t\tFROM\twcf" . WCF_N . "_search\n\t\t\t\tWHERE\tsearchHash = '" . $this->searchHash . "'\n\t\t\t\t\tAND userID = " . WCF::getUser()->userID . "\n\t\t\t\t\tAND searchType = 'messages'\n\t\t\t\t\tAND searchDate > " . (TIME_NOW - 1800);
         $row = WCF::getDB()->getFirstRow($sql);
         if (isset($row['searchID'])) {
             HeaderUtil::redirect('index.php?form=Search&searchID=' . $row['searchID'] . '&highlight=' . urlencode($this->query) . SID_ARG_2ND_NOT_ENCODED);
             exit;
         }
     }
     // do search
     $this->result = $this->engine->search($this->query, $this->types, $conditions, $this->sortField . ' ' . $this->sortOrder);
     // result is empty
     if (count($this->result) == 0) {
         $this->throwNoMatchesException();
     }
 }
开发者ID:joaocustodio,项目名称:EmuDevstore-1,代码行数:30,代码来源:SearchForm.class.php

示例2: perform

 function perform()
 {
     // get the search terms that have already been validated...
     $this->_searchTerms = $this->_request->getValue("searchTerms");
     // check if the search feature is disabled in this site...
     $config =& Config::getConfig();
     if (!$config->getValue("search_engine_enabled")) {
         $this->_view = new ErrorView($this->_blogInfo, "error_search_engine_disabled");
         $this->setCommonData();
         return false;
     }
     // create the view and make sure that it hasn't been cached
     $this->_view = new BlogTemplatedView($this->_blogInfo, VIEW_SEARCH_TEMPLATE, array("searchTerms" => $this->_searchTerms));
     if ($this->_view->isCached()) {
         return true;
     }
     $searchEngine = new SearchEngine();
     $searchResults = $searchEngine->search($this->_blogInfo->getId(), $this->_searchTerms);
     // MARKWU: I add the searchterms variable for smarty/plog template
     $searchTerms = $searchEngine->getAdaptSearchTerms($this->_searchTerms);
     // if no search results, return an error message
     if (count($searchResults) == 0) {
         $this->_view = new ErrorView($this->_blogInfo, "error_no_search_results");
         $this->setCommonData();
         return true;
     }
     // if only one search result, we can see it straight away
     if (count($searchResults) == 1) {
         // we have to refill the $_REQUEST array, since the next action
         // is going to need some of the parameters
         $request =& HttpVars::getRequest();
         $searchResult = array_pop($searchResults);
         $article = $searchResult->getArticle();
         $request["articleId"] = $article->getId();
         $request["blogId"] = $this->_blogInfo->getId();
         HttpVars::setRequest($request);
         // since there is only one article, we can use the ViewArticleAction action
         // to display that article, instead of copy-pasting the code and doing it here.
         // You just have to love MVC and OOP :)
         return Controller::setForwardAction("ViewArticle");
     }
     // or else, show a list with all the posts that match the requested
     // search terms
     $this->_view->setValue("searchresults", $searchResults);
     // MARKWU: Now, I can use the searchterms to get the keyword
     $this->_view->setValue("searchterms", $searchTerms);
     // MARKWU:
     $config =& Config::getConfig();
     $urlmode = $config->getValue("request_format_mode");
     $this->_view->setValue("urlmode", $urlmode);
     $this->setCommonData();
     return true;
 }
开发者ID:BackupTheBerlios,项目名称:plogfr-svn,代码行数:53,代码来源:searchaction.class.php

示例3: ArrayObject

<?php

error_reporting(E_ALL);
ini_set('display_errors', '1');
require_once '../core/generics/State.php';
$toSearch = $_REQUEST['toSearch'];
require_once "../core/SearchEngine/SearchEngine.php";
$paramsSetted = $_GET['paramsSetted'];
$paramsValue = $_GET['paramsValues'];
$i = 0;
$arrayParams = new ArrayObject();
foreach ($paramsSetted as $param) {
    $arrayParams->offsetSet($param, $paramsValue[$i++]);
}
$search = new SearchEngine(Connection::connect());
$resultSearch = $search->search($toSearch, $arrayParams->getIterator());
if ($resultSearch->count()) {
    header('Content-type: application/json');
    $proccessSearch = null;
    if ($toSearch == "video") {
        requireVideo();
        $proccessSearch = new ProccessVideoSearch($resultSearch);
    } elseif ($toSearch == "paper") {
        requirePaper();
        $proccessSearch = new ProccessPublicationSearch($resultSearch);
    } elseif ($toSearch == 'analysis') {
        requireAnalysis();
        $proccessSearch = new ProccessAnalysisSearch($resultSearch);
    }
    $json = new JsonResponse();
    $json->response(true, $proccessSearch->getResultsFound(), TRUE);
开发者ID:raigons,项目名称:bureauinteligencia,代码行数:31,代码来源:proccess_search.php

示例4: array

    $smarty->assign('name', $usr['login']);
} else {
    $smarty->assign('name', "");
}
$perms;
//tableau qui stockera si l'utilisateur a certaines permissions
$perms[0] = $sys->permissions_test('admin.user.create');
$perms[1] = $sys->permissions_test('admin.user.read');
$perms[2] = $sys->permissions_test('admin.user.update');
$perms[3] = $sys->permissions_test('admin.user.delete');
$perms[4] = $sys->permissions_test('admin.picture.read');
$perms[5] = $sys->permissions_test('application.picture.upload');
$smarty->assign('perms', $perms);
if (!isset($_GET['do'])) {
    //affichage initial de toutes les photos accessibles
    $listPics = $search->search();
    $smarty->assign('tabPics', $listPics);
} else {
    $listParams = array();
    $req = array();
    $i = 0;
    if (isset($_POST['size']) && isset($_POST['paramSize']) && $_POST['size'] != "") {
        $listParams[$i] = array('size' => array($_POST['paramSize'], $_POST['size']));
        $req[$i] = $search->filter_size($_POST['paramSize'], $_POST['size']);
        echo 'requete = ' . $req[$i];
        $i++;
    }
    if (isset($_POST['listPersonnes']) && $_POST['listPersonnes'] != "") {
        $listPersonnes = explode(', ', $_POST['listPersonnes']);
        $listParams[$i] = array();
        foreach ($listPersonnes as $personne) {
开发者ID:rasler,项目名称:CRETPictures,代码行数:31,代码来源:filtrePhotos.php

示例5: realpath

<?php

require_once "include/skin.inc.php";
require_once 'include/skinlet.inc.php';
require_once "include/beContent.inc.php";
require_once "include/entities.inc.php";
require_once "include/content.inc.php";
require_once "include/control/search/searchEngine.php";
require_once realpath(dirname(__FILE__)) . '/include/view/template/InitGraphic.php';
$main = new Skin();
InitGraphic::getInstance()->createGraphic($main);
$homeTemplate = new Skinlet("search");
$engine = new SearchEngine();
if (isset($_POST["search"]) && $_POST["search"] != "") {
    $sintax = explode(":", $_POST["search"]);
    if (isset($sintax[1])) {
        $entityName = $sintax[0];
        $search = explode(" ", $sintax[1]);
    } else {
        $entityName = null;
        $search = explode(" ", $_POST["search"]);
    }
}
$homeTemplate->setContent("results", $engine->search($entityName, $search));
$homeTemplate->setContent("search_keywords", $_POST["search"]);
$homeTemplate->setContent("results_number", $engine->resultsNumber);
$main->setContent("body", $homeTemplate->get());
$main->close();
开发者ID:patriziopezzilli,项目名称:Fusion,代码行数:28,代码来源:search.php


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