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


PHP eZSearch::search方法代码示例

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


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

示例1: array

    $keyArray = array(array('section', $searchSectionID), array('section_identifier', $section->attribute('identifier')));
    $res->setKeys($keyArray);
}
$viewParameters = array('offset' => $Offset);
$searchData = false;
$tpl->setVariable("search_data", $searchData);
$tpl->setVariable("search_section_id", $searchSectionID);
$tpl->setVariable("search_subtree_array", $subTreeArray);
$tpl->setVariable('search_timestamp', $searchTimestamp);
$tpl->setVariable("search_text", $searchText);
$tpl->setVariable('search_page_limit', $searchPageLimit);
$tpl->setVariable("view_parameters", $viewParameters);
$tpl->setVariable('use_template_search', !$useSearchCode);
if ($http->hasVariable('Mode') && $http->variable('Mode') == 'browse') {
    if (!isset($searchResult)) {
        $searchResult = eZSearch::search($searchText, array("SearchType" => $searchType, "SearchSectionID" => $searchSectionID, "SearchSubTreeArray" => $subTreeArray, 'SearchTimestamp' => $searchTimestamp, "SearchLimit" => $pageLimit, "SearchOffset" => $Offset));
    }
    $sys = eZSys::instance();
    $searchResult['RequestedURI'] = "content/search";
    //    $searchResult['RequestedURISuffix'] = $sys->serverVariable( "QUERY_STRING" );
    $searchResult['RequestedURISuffix'] = 'SearchText=' . urlencode($searchText) . ($searchTimestamp > 0 ? '&SearchTimestamp=' . $searchTimestamp : '') . '&BrowsePageLimit=' . $pageLimit . '&Mode=browse';
    return $Module->run('browse', array(), array("NodeList" => $searchResult, "Offset" => $Offset, "NodeID" => isset($subTreeArray[0]) && $subTreeArray[0] != 1 ? $subTreeArray[0] : null));
}
// --- Compatibility code start ---
if ($useSearchCode) {
    $tpl->setVariable("offset", $Offset);
    $tpl->setVariable("page_limit", $pageLimit);
    $tpl->setVariable("search_text_enc", urlencode($searchText));
    $tpl->setVariable("search_result", $searchResult["SearchResult"]);
    $tpl->setVariable("search_count", $searchResult["SearchCount"]);
    $tpl->setVariable("stop_word_array", $searchResult["StopWordArray"]);
开发者ID:legende91,项目名称:ez,代码行数:31,代码来源:search.php

示例2: fetchContentSearch

 public static function fetchContentSearch($searchText, $subTreeArray, $offset, $limit, $searchTimestamp, $publishDate, $sectionID, $classID, $classAttributeID, $ignoreVisibility, $limitation, $sortArray)
 {
     $searchArray = eZSearch::buildSearchArray();
     $parameters = array();
     if ($classID !== false) {
         $parameters['SearchContentClassID'] = $classID;
     }
     if ($classAttributeID !== false) {
         $parameters['SearchContentClassAttributeID'] = $classAttributeID;
     }
     if ($sectionID !== false) {
         $parameters['SearchSectionID'] = $sectionID;
     }
     if ($publishDate !== false) {
         $parameters['SearchDate'] = $publishDate;
     }
     if ($sortArray !== false) {
         $parameters['SortArray'] = $sortArray;
     }
     $parameters['SearchLimit'] = $limit;
     $parameters['SearchOffset'] = $offset;
     $parameters['IgnoreVisibility'] = $ignoreVisibility;
     $parameters['Limitation'] = $limitation;
     if ($subTreeArray !== false) {
         $parameters['SearchSubTreeArray'] = $subTreeArray;
     }
     if ($searchTimestamp) {
         $parameters['SearchTimestamp'] = $searchTimestamp;
     }
     $searchResult = eZSearch::search($searchText, $parameters, $searchArray);
     return array('result' => $searchResult);
 }
开发者ID:CG77,项目名称:ezpublish-legacy,代码行数:32,代码来源:ezcontentfunctioncollection.php

示例3: array

    } else {
        $subTreeList = array($http->variable('SubTreeArray'));
    }
    foreach ($subTreeList as $subTreeItem) {
        // as form input is generally a string, is_int cannot be used for checking the value type
        if (is_numeric($subTreeItem) && $subTreeItem > 0) {
            $subTreeArray[] = $subTreeItem;
        }
    }
}
$Module->setTitle("Search for: {$searchText}");
$classArray = eZContentClass::fetchList(eZContentClass::VERSION_STATUS_DEFINED, true, false, array('name' => 'asc'));
$sectionArray = eZSection::fetchList();
$searchArray = eZSearch::buildSearchArray();
if ($useSearchCode) {
    $searchResult = eZSearch::search($searchText, array('SearchSectionID' => $searchSectionID, 'SearchContentClassID' => $searchContentClassID, 'SearchContentClassAttributeID' => $searchContentClassAttributeID, 'SearchSubTreeArray' => $subTreeArray, 'SearchDate' => $searchDate, 'SearchTimestamp' => $searchTimestamp, 'SearchLimit' => $pageLimit, 'SearchOffset' => $Offset), $searchArray);
    if (strlen(trim($searchText)) == 0 && count($searchArray) > 0) {
        $searchText = 'search by additional parameter';
    }
}
$viewParameters = array('offset' => $Offset);
$searchData = false;
$tpl->setVariable("search_data", $searchData);
$tpl->setVariable('search_contentclass_id', $searchContentClassID);
$tpl->setVariable('search_contentclass_attribute_id', $searchContentClassAttributeID);
$tpl->setVariable('search_section_id', $searchSectionID);
$tpl->setVariable('search_date', $searchDate);
$tpl->setVariable('search_timestamp', $searchTimestamp);
$tpl->setVariable('search_sub_tree', $subTreeArray);
$tpl->setVariable('search_text', $searchText);
$tpl->setVariable('search_page_limit', $searchPageLimit);
开发者ID:mugoweb,项目名称:ezpublish-legacy,代码行数:31,代码来源:advancedsearch.php

示例4: search

 /**
  * Returns search results based on given post params
  *
  * @param mixed $args Only used if post parameter is not set
  *              0 => SearchStr
  *              1 => SearchOffset
  *              2 => SearchLimit (10 by default, max 50)
  * @return array
  */
 public static function search($args)
 {
     $http = eZHTTPTool::instance();
     if ($http->hasPostVariable('SearchStr')) {
         $searchStr = trim($http->postVariable('SearchStr'));
     } else {
         if (isset($args[0])) {
             $searchStr = trim($args[0]);
         }
     }
     if ($http->hasPostVariable('SearchOffset')) {
         $searchOffset = (int) $http->postVariable('SearchOffset');
     } else {
         if (isset($args[1])) {
             $searchOffset = (int) $args[1];
         } else {
             $searchOffset = 0;
         }
     }
     if ($http->hasPostVariable('SearchLimit')) {
         $searchLimit = (int) $http->postVariable('SearchLimit');
     } else {
         if (isset($args[2])) {
             $searchLimit = (int) $args[2];
         } else {
             $searchLimit = 10;
         }
     }
     // Do not allow to search for more then x items at a time
     $ini = eZINI::instance();
     $maximumSearchLimit = (int) $ini->variable('SearchSettings', 'MaximumSearchLimit');
     if ($searchLimit > $maximumSearchLimit) {
         $searchLimit = $maximumSearchLimit;
     }
     // Prepare node encoding parameters
     $encodeParams = array();
     if (self::hasPostValue($http, 'EncodingLoadImages')) {
         $encodeParams['loadImages'] = true;
     }
     if (self::hasPostValue($http, 'EncodingFetchChildrenCount')) {
         $encodeParams['fetchChildrenCount'] = true;
     }
     if (self::hasPostValue($http, 'EncodingFetchSection')) {
         $encodeParams['fetchSection'] = true;
     }
     if (self::hasPostValue($http, 'EncodingFormatDate')) {
         $encodeParams['formatDate'] = $http->postVariable('EncodingFormatDate');
     }
     // Prepare search parameters
     $params = array('SearchOffset' => $searchOffset, 'SearchLimit' => $searchLimit, 'SortArray' => array('published', 0), 'SortBy' => array('published' => 'desc'));
     if (self::hasPostValue($http, 'SearchContentClassAttributeID')) {
         $params['SearchContentClassAttributeID'] = self::makePostArray($http, 'SearchContentClassAttributeID');
     } else {
         if (self::hasPostValue($http, 'SearchContentClassID')) {
             $params['SearchContentClassID'] = self::makePostArray($http, 'SearchContentClassID');
         } else {
             if (self::hasPostValue($http, 'SearchContentClassIdentifier')) {
                 $params['SearchContentClassID'] = eZContentClass::classIDByIdentifier(self::makePostArray($http, 'SearchContentClassIdentifier'));
             }
         }
     }
     if (self::hasPostValue($http, 'SearchSubTreeArray')) {
         $params['SearchSubTreeArray'] = self::makePostArray($http, 'SearchSubTreeArray');
     }
     if (self::hasPostValue($http, 'SearchSectionID')) {
         $params['SearchSectionID'] = self::makePostArray($http, 'SearchSectionID');
     }
     if (self::hasPostValue($http, 'SearchDate')) {
         $params['SearchDate'] = (int) $http->postVariable('SearchDate');
     } else {
         if (self::hasPostValue($http, 'SearchTimestamp')) {
             $params['SearchTimestamp'] = self::makePostArray($http, 'SearchTimestamp');
             if (!isset($params['SearchTimestamp'][1])) {
                 $params['SearchTimestamp'] = $params['SearchTimestamp'][0];
             }
         }
     }
     if (self::hasPostValue($http, 'EnableSpellCheck') || self::hasPostValue($http, 'enable-spellcheck', '0')) {
         $params['SpellCheck'] = array(true);
     }
     if (self::hasPostValue($http, 'GetFacets') || self::hasPostValue($http, 'show-facets', '0')) {
         $params['facet'] = eZFunctionHandler::execute('ezfind', 'getDefaultSearchFacets', array());
     }
     $result = array('SearchOffset' => $searchOffset, 'SearchLimit' => $searchLimit, 'SearchResultCount' => 0, 'SearchCount' => 0, 'SearchResult' => array(), 'SearchString' => $searchStr, 'SearchExtras' => array());
     // Possibility to keep track of callback reference for use in js callback function
     if ($http->hasPostVariable('CallbackID')) {
         $result['CallbackID'] = $http->postVariable('CallbackID');
     }
     // Only search if there is something to search for
     if ($searchStr) {
         $searchList = eZSearch::search($searchStr, $params);
//.........这里部分代码省略.........
开发者ID:legende91,项目名称:ez,代码行数:101,代码来源:ezjscserverfunctionsjs.php


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