• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP SearchResult类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: test_getPromotion_missingPromotion_returnsNull

 public function test_getPromotion_missingPromotion_returnsNull()
 {
     $rawSearchResult = $this->getSearchResultAsSimpleXml();
     unset($rawSearchResult->promotion);
     $searchResult = new SearchResult($rawSearchResult->asXML());
     $this->assertNull($searchResult->getPromotion());
 }
开发者ID:mschop,项目名称:findologic_php_client,代码行数:7,代码来源:SearchResultTest.php


示例2: execute

 public function execute($body = null)
 {
     if ($body == null) {
         $body = $this->getBody();
     }
     $result = $this->client->search($body);
     $result = new SearchResult($result, $this->params);
     $suggest = $result->getSuggestions();
     if (!empty($suggest)) {
         $this->client->setSuggestions($suggest);
     }
     // reset search params after each search
     $this->params = null;
     return $result;
 }
开发者ID:coldtrick,项目名称:elasticsearch,代码行数:15,代码来源:SearchParams.php


示例3: setUp

 public function setUp()
 {
     $jsonPath = __DIR__ . '/' . self::JSON_MOCK_FILE;
     $this->jsonMock = file_get_contents($jsonPath);
     $searchResult = SearchResult::createFromJson($this->jsonMock);
     $this->searchResultFromJsonMock = $searchResult;
 }
开发者ID:nemoinho,项目名称:socialwalladapters,代码行数:7,代码来源:TwitterTestCase.php


示例4: searchBySphinx

	private function searchBySphinx($request, $response, $kw, $p)
	{/*{{{*/
        $doctorSearchd = SphinxSearchdBase::createSearchdByType('Doctor');
        $utf8Kw = mb_convert_encoding($kw, 'utf-8', 'gbk');
		$res = $doctorSearchd->query($utf8Kw, ($p - 1) * 15, 15);
        $searchResult = SearchResult::sphinxResult2searchResult($res, 'doctor', ($p - 1) * 15, 15);
        $response->totalPage = ceil($searchResult->total_found/$searchResult->pageSize);
		
		$results = array();
		foreach($searchResult->items as $item)
		{/*{{{*/
			$doctor = DAL::get()->find('doctor',$item->id);
			
            if($doctor->isNull() || $doctor->deleted > 0 )
            {
				continue;
			}
			
			$result = array();
			$result['id'] = $doctor->id;
			$result['name'] = $doctor->name;
			$result['title'] = $doctor->title;
			$result['hospital'] = $doctor->hospitalfaculty->hospital->name;
			$result['userid'] = $doctor->getUserId();
			$result['hospitalfacultyname'] = $doctor->hospitalfaculty->name ;
			$results[] = (object)$result;
		}/*}}}*/
		return $results;
	}/*}}}*/
开发者ID:sdgdsffdsfff,项目名称:hdf-client,代码行数:29,代码来源:userdoctorcontroller.php


示例5: next

 public function next()
 {
     if ($this->fetched || !$this->result) {
         return false;
     }
     $this->fetched = true;
     return SearchResult::newFromTitle($this->result);
 }
开发者ID:Kaph-Noir,项目名称:mediawiki,代码行数:8,代码来源:SearchNearMatchResultSet.php


示例6: next

 function next()
 {
     if ($this->resultSet === false) {
         return false;
     }
     $row = $this->resultSet->fetchObject();
     if ($row === false) {
         return false;
     }
     return SearchResult::newFromTitle(Title::makeTitle($row->page_namespace, $row->page_title), $this);
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:11,代码来源:SqlSearchResultSet.php


示例7: update

 public function update($pa_options = null)
 {
     $this->_generateSortableValue();
     // populate sort field
     // invalidate get() prefetch cache
     SearchResult::clearResultCacheForTable($this->tableName());
     // Invalid entire labels-by-id cache since we can't know what entries pertain to the label we just changed
     LabelableBaseModelWithAttributes::$s_labels_by_id_cache = array();
     // Unset label cache entry for modified label only
     unset(LabelableBaseModelWithAttributes::$s_label_cache[$this->getSubjectTableName()][$this->get($this->getSubjectKey())]);
     return parent::update($pa_options);
 }
开发者ID:kai-iak,项目名称:providence,代码行数:12,代码来源:BaseLabel.php


示例8: testGets

 public function testGets()
 {
     $o_search = caGetSearchInstance('ca_objects');
     $this->assertInstanceOf('SearchEngine', $o_search);
     $o_res = $o_search->search('*', array('sort' => 'ca_object_labels.name'));
     /** @var SearchResult $o_res */
     $this->assertInstanceOf('SearchResult', $o_res);
     $this->assertEquals(10, $o_res->numHits());
     SearchResult::clearGetWithTemplatePrefetch();
     // old values may be cached from previous tests
     $i = 0;
     while ($o_res->nextHit()) {
         $vs_label = $o_res->getWithTemplate('^ca_objects.preferred_labels');
         $this->assertGreaterThan(0, strlen($vs_label));
         $this->assertRegExp("/{$i}\$/", $vs_label);
         $i++;
     }
 }
开发者ID:samrahman,项目名称:providence,代码行数:18,代码来源:SearchResultGetTest.php


示例9: doSearch


//.........这里部分代码省略.........
             }
             $o_res = new WLPlugSearchEngineCachedResult($va_hits, $this->opn_tablenum);
             $vb_from_cache = true;
         } else {
             Debug::msg('cache expire for ' . $vs_cache_key);
             $o_cache->remove();
         }
     }
     if (!$vb_from_cache) {
         Debug::msg('SEARCH cache miss for ' . $vs_cache_key);
         $vs_char_set = $this->opo_app_config->get('character_set');
         $o_query_parser = new LuceneSyntaxParser();
         $o_query_parser->setEncoding($vs_char_set);
         $o_query_parser->setDefaultOperator(LuceneSyntaxParser::B_AND);
         $ps_search = preg_replace('![\']+!', '', $ps_search);
         try {
             $o_parsed_query = $o_query_parser->parse($ps_search, $vs_char_set);
         } catch (Exception $e) {
             // Retry search with all non-alphanumeric characters removed
             try {
                 $o_parsed_query = $o_query_parser->parse(preg_replace("![^A-Za-z0-9 ]+!", " ", $ps_search), $vs_char_set);
             } catch (Exception $e) {
                 $o_parsed_query = $o_query_parser->parse("", $vs_char_set);
             }
         }
         $va_rewrite_results = $this->_rewriteQuery($o_parsed_query);
         $o_rewritten_query = new Zend_Search_Lucene_Search_Query_Boolean($va_rewrite_results['terms'], $va_rewrite_results['signs']);
         $vs_search = $this->_queryToString($o_rewritten_query);
         //print "<div style='background:#FFFFFF; padding: 5px; border: 1px dotted #666666;'><strong>DEBUG: </strong>".$ps_search.'/'.$vs_search."</div>";
         // Filter deleted records out of final result
         if (isset($pa_options['deletedOnly']) && $pa_options['deletedOnly'] && $t_table->hasField('deleted')) {
             $this->addResultFilter($this->ops_tablename . '.deleted', '=', '1');
         } else {
             if ((!isset($pa_options['showDeleted']) || !$pa_options['showDeleted']) && $t_table->hasField('deleted')) {
                 $this->addResultFilter($this->ops_tablename . '.deleted', '=', '0');
             }
         }
         if (isset($pa_options['checkAccess']) && (is_array($pa_options['checkAccess']) && sizeof($pa_options['checkAccess']))) {
             $va_access_values = $pa_options['checkAccess'];
             $this->addResultFilter($this->ops_tablename . '.access', 'IN', join(",", $va_access_values));
         }
         $vb_no_types = false;
         if (is_array($va_type_ids = $this->getTypeRestrictionList()) && sizeof($va_type_ids) > 0) {
             if ($t_table->getFieldInfo('type_id', 'IS_NULL')) {
                 $va_type_ids[] = 'NULL';
             }
             $this->addResultFilter($this->ops_tablename . '.type_id', 'IN', join(",", $va_type_ids));
         } elseif (is_array($va_type_ids) && sizeof($va_type_ids) == 0) {
             $vb_no_types = true;
         }
         if (!$vb_no_types) {
             // Filter on source
             if (is_array($va_source_ids = $this->getSourceRestrictionList())) {
                 $this->addResultFilter($this->ops_tablename . '.source_id', 'IN', join(",", $va_source_ids));
             }
             if (in_array($t_table->getHierarchyType(), array(__CA_HIER_TYPE_SIMPLE_MONO__, __CA_HIER_TYPE_MULTI_MONO__))) {
                 $this->addResultFilter($this->ops_tablename . '.parent_id', 'IS NOT', NULL);
             }
             if (is_array($va_restrict_to_fields = caGetOption('restrictSearchToFields', $pa_options, null)) && $this->opo_engine->can('restrict_to_fields')) {
                 $this->opo_engine->setOption('restrictSearchToFields', $va_restrict_to_fields);
             }
             $o_res = $this->opo_engine->search($this->opn_tablenum, $vs_search, $this->opa_result_filters, $o_rewritten_query);
             // cache the results
             $va_hits = $o_res->getPrimaryKeyValues($vn_limit);
             $o_res->seek(0);
         } else {
             $va_hits = array();
         }
         if (isset($pa_options['sets']) && $pa_options['sets']) {
             $va_hits = $this->filterHitsBySets($va_hits, $pa_options['sets'], array('search' => $vs_search));
         }
         $vn_user_id = isset($pa_options['user_id']) && (int) $pa_options['user_id'] ? (int) $pa_options['user_id'] : (int) $AUTH_CURRENT_USER_ID;
         if ((!isset($pa_options['dontFilterByACL']) || !$pa_options['dontFilterByACL']) && $this->opo_app_config->get('perform_item_level_access_checking') && method_exists($t_table, "supportsACL") && $t_table->supportsACL()) {
             $va_hits = $this->filterHitsByACL($va_hits, $this->opn_tablenum, $vn_user_id, __CA_ACL_READONLY_ACCESS__);
         }
         if ($vs_sort != '_natural') {
             $va_hits = $this->sortHits($va_hits, $t_table->tableName(), $pa_options['sort'], isset($pa_options['sort_direction']) ? $pa_options['sort_direction'] : null);
         } elseif ($vs_sort == '_natural' && $vs_sort_direction == 'desc') {
             $va_hits = array_reverse($va_hits);
         }
         $o_res = new WLPlugSearchEngineCachedResult($va_hits, $this->opn_tablenum);
         // cache for later use
         if (!$vb_no_cache) {
             $o_cache->save($vs_cache_key, $this->opn_tablenum, $va_hits, array('created_on' => time()), null, $pa_options);
         }
         // log search
         $o_log = new Searchlog();
         $vn_search_form_id = isset($pa_options['form_id']) ? $pa_options['form_id'] : null;
         $vs_log_details = isset($pa_options['log_details']) ? $pa_options['log_details'] : '';
         $vs_search_source = isset($pa_options['search_source']) ? $pa_options['search_source'] : '';
         $vn_execution_time = $t->getTime(4);
         $o_log->log(array('user_id' => $vn_user_id, 'table_num' => $this->opn_tablenum, 'search_expression' => $ps_search, 'num_hits' => sizeof($va_hits), 'form_id' => $vn_search_form_id, 'ip_addr' => $_SERVER['REMOTE_ADDR'] ? $_SERVER['REMOTE_ADDR'] : null, 'details' => $vs_log_details, 'search_source' => $vs_search_source, 'execution_time' => $vn_execution_time));
     }
     if ($po_result) {
         $po_result->init($o_res, $this->opa_tables, $pa_options);
         return $po_result;
     } else {
         return new SearchResult($o_res, $this->opa_tables);
     }
 }
开发者ID:kai-iak,项目名称:pawtucket2,代码行数:101,代码来源:SearchEngine.php


示例10: SearchResult

<section id="searchsection">
<div id="searchbody">
<?php 
$result = new SearchResult('Kilpisjärvi (Lappland)', 2);
$result->show();
for ($i = 1; $i <= 5; $i++) {
    $result = new SearchResult('Favorisierte Wanderung ' . ($i + 1), rand(1, 3));
    $result->show();
}
?>
</div>
</section>
开发者ID:FFirmenich,项目名称:Global-HighKing,代码行数:12,代码来源:liked.php


示例11: count

    }
    if (isset($definitions)) {
        $totalDefinitionsCount = count($definitions);
        if (!$all && $totalDefinitionsCount > PREVIEW_LIMIT) {
            $definitions = array_slice($definitions, 0, PREVIEW_LIMIT);
            SmartyWrap::assign('totalDefinitionsCount', $totalDefinitionsCount);
        }
        $searchResults = SearchResult::mapDefinitionArray($definitions);
    }
}
$conjugations = NULL;
$declensions = NULL;
if ($searchType == SEARCH_INFLECTED || $searchType == SEARCH_LEXEM_ID || $searchType == SEARCH_FULL_TEXT || $searchType == SEARCH_MULTIWORD) {
    // Filter out hidden definitions
    $hiddenSources = array();
    SearchResult::filterHidden($searchResults, $hiddenSources);
    if (Config::get('global.aprilFoolsDay')) {
        foreach ($searchResults as $sr) {
            $sr->definition->htmlRep = StringUtil::iNoGrammer($sr->definition->htmlRep);
        }
    }
    SmartyWrap::assign('results', $searchResults);
    SmartyWrap::assign('hiddenSources', $hiddenSources);
    // Maps lexems to arrays of inflected forms (some lexems may lack inflections)
    // Also compute the text of the link to the paradigm div,
    // which can be 'conjugări', 'declinări' or both
    if (!empty($lexems)) {
        $conjugations = false;
        $declensions = false;
        foreach ($lexems as $l) {
            $lm = $l->getFirstLexemModel();
开发者ID:florinp,项目名称:dexonline,代码行数:31,代码来源:search.php


示例12: delete

 /**
  * Check user's item level access before passing delete to lower level libraries
  *
  */
 public function delete($pb_delete_related = false, $pa_options = null, $pa_fields = null, $pa_table_list = null)
 {
     global $AUTH_CURRENT_USER_ID;
     if ($this->getAppConfig()->get('perform_item_level_access_checking')) {
         if ($this->checkACLAccessForUser(new ca_users($AUTH_CURRENT_USER_ID)) < __CA_ACL_EDIT_DELETE_ACCESS__) {
             $this->postError(2580, _t("You do not have delete access for this item"), "BundlableLabelableBaseModelWithAttributes->delete()");
             return false;
         }
     }
     SearchResult::clearResultCacheForRow($this->tableName(), $this->getPrimaryKey());
     return parent::delete($pb_delete_related, $pa_options, $pa_fields, $pa_table_list);
 }
开发者ID:idiscussforum,项目名称:providence,代码行数:16,代码来源:BundlableLabelableBaseModelWithAttributes.php


示例13: util_assertModerator

<?php

require_once "../../phplib/util.php";
util_assertModerator(PRIV_EDIT);
util_assertNotMirror();
RecentLink::createOrUpdate('Greșeli de tipar');
$sourceClause = '';
$sourceId = 0;
$sourceUrlName = util_getRequestParameter('source');
if ($sourceUrlName) {
    $source = $sourceUrlName ? Source::get_by_urlName($sourceUrlName) : null;
    $sourceId = $source ? $source->id : 0;
    $sourceClause = $source ? "sourceId = {$sourceId} and " : '';
    SmartyWrap::assign('src_selected', $sourceId);
}
$defs = Model::factory('Definition')->raw_query("select * from Definition where {$sourceClause} id in (select definitionId from Typo) order by lexicon")->find_many();
SmartyWrap::assign('searchResults', SearchResult::mapDefinitionArray($defs));
SmartyWrap::assign('recentLinks', RecentLink::loadForUser());
SmartyWrap::displayAdminPage('admin/viewTypos.tpl');
开发者ID:florinp,项目名称:dexonline,代码行数:19,代码来源:viewTypos.php


示例14: util_getRequestParameter

$MAX_AFFECTED = 1000;
$search = util_getRequestParameter('search');
$replace = util_getRequestParameter('replace');
$sourceId = util_getRequestParameter('source');
$realRun = util_getRequestParameter('realRun');
$sourceClause = $sourceId ? "and sourceId = {$sourceId}" : '';
$count = Model::factory('Definition')->where_raw("status = 0 {$sourceClause} and binary internalRep like '%{$search}%'")->count();
if ($count > $MAX_AFFECTED) {
    if ($realRun) {
        FlashMessage::add("{$count} definiții se potrivesc, numai {$MAX_AFFECTED} au fost modificate.", 'info');
    } else {
        FlashMessage::add("{$count} definiții se potrivesc, maxim {$MAX_AFFECTED} vor fi modificate.");
    }
}
$defs = Model::factory('Definition')->where_raw("status = 0 {$sourceClause} and binary internalRep like '%{$search}%'")->order_by_asc('id')->limit($MAX_AFFECTED)->find_many();
$searchResults = SearchResult::mapDefinitionArray($defs);
foreach ($defs as $def) {
    $def->internalRep = str_replace($search, $replace, $def->internalRep);
    $ambiguousMatches = array();
    $def->internalRep = AdminStringUtil::internalizeDefinition($def->internalRep, $def->sourceId, $ambiguousMatches);
    $def->htmlRep = AdminStringUtil::htmlize($def->internalRep, $def->sourceId);
    // Complete or un-complete the abbreviation review
    if (!count($ambiguousMatches) && $def->abbrevReview == ABBREV_AMBIGUOUS) {
        $def->abbrevReview = ABBREV_REVIEW_COMPLETE;
    } else {
        if (count($ambiguousMatches) && $def->abbrevReview == ABBREV_REVIEW_COMPLETE) {
            $def->abbrevReview = ABBREV_AMBIGUOUS;
        }
    }
    if ($realRun) {
        $def->save();
开发者ID:nastasie-octavian,项目名称:DEXonline,代码行数:31,代码来源:bulkReplace.php


示例15: util_redirect

                        $lm->regenerateParadigm();
                    }
                }
            }
        }
    }
    util_redirect("placeAccents.php");
}
$chars = array();
$searchResults = array();
$lexems = Model::factory('Lexem')->raw_query("select * from Lexem where form not rlike '\\'' and not noAccent order by rand() limit 10")->find_many();
foreach ($lexems as $l) {
    $charArray = array();
    $form = mb_strtoupper($l->form);
    $len = mb_strlen($form);
    for ($i = 0; $i < $len; $i++) {
        $c = StringUtil::getCharAt($form, $i);
        $charArray[] = ctype_space($c) ? '&nbsp;' : $c;
    }
    $chars[$l->id] = $charArray;
    $definitions = Definition::loadByLexemId($l->id);
    $searchResults[$l->id] = SearchResult::mapDefinitionArray($definitions);
}
RecentLink::createOrUpdate('Plasare accente');
SmartyWrap::assign('sectionTitle', 'Plasare accente');
SmartyWrap::assign('lexems', $lexems);
SmartyWrap::assign('chars', $chars);
SmartyWrap::assign('searchResults', $searchResults);
SmartyWrap::assign("allStatuses", util_getAllStatuses());
SmartyWrap::assign('recentLinks', RecentLink::loadForUser());
SmartyWrap::displayAdminPage('admin/placeAccents.ihtml');
开发者ID:Jobava,项目名称:mirror-dexonline,代码行数:31,代码来源:placeAccents.php


示例16: showHit

 /**
  * Format a single hit result
  * @param SearchResult $result
  * @param string $terms partial regexp for highlighting terms
  */
 function showHit($result, $terms)
 {
     $fname = 'SpecialSearch::showHit';
     wfProfileIn($fname);
     global $wgUser, $wgContLang;
     $t = $result->getTitle();
     if (is_null($t)) {
         wfProfileOut($fname);
         return "<!-- Broken link in search result -->\n";
     }
     $sk =& $wgUser->getSkin();
     $contextlines = $wgUser->getOption('contextlines');
     if ('' == $contextlines) {
         $contextlines = 5;
     }
     $contextchars = $wgUser->getOption('contextchars');
     if ('' == $contextchars) {
         $contextchars = 50;
     }
     $link = $sk->makeKnownLinkObj($t);
     $revision = Revision::newFromTitle($t);
     $text = $revision->getText();
     $size = wfMsg('nbytes', strlen($text));
     $lines = explode("\n", $text);
     $max = IntVal($contextchars) + 1;
     $pat1 = "/(.*)({$terms})(.{0,{$max}})/i";
     $lineno = 0;
     $extract = '';
     wfProfileIn("{$fname}-extract");
     foreach ($lines as $line) {
         if (0 == $contextlines) {
             break;
         }
         ++$lineno;
         if (!preg_match($pat1, $line, $m)) {
             continue;
         }
         --$contextlines;
         $pre = $wgContLang->truncate($m[1], -$contextchars, '...');
         if (count($m) < 3) {
             $post = '';
         } else {
             $post = $wgContLang->truncate($m[3], $contextchars, '...');
         }
         $found = $m[2];
         $line = htmlspecialchars($pre . $found . $post);
         $pat2 = '/(' . $terms . ")/i";
         $line = preg_replace($pat2, "<span class='searchmatch'>\\1</span>", $line);
         $extract .= "<br /><small>{$lineno}: {$line}</small>\n";
     }
     wfProfileOut("{$fname}-extract");
     wfProfileOut($fname);
     return "<li>{$link} ({$size}){$extract}</li>\n";
 }
开发者ID:BackupTheBerlios,项目名称:blahtex,代码行数:59,代码来源:SpecialSearch.php


示例17: exportRecordsFromSearchResultToArray

 /**
  * Export set of records from a given SearchResult object to an array of strings with the individual exports, keyed by primary key.
  * The behavior is tailored towards the needs of the OAIPMHService.
  *
  * @param string $ps_exporter_code defines the exporter to use
  * @param SearchResult $po_result search result as object
  * @param  array $pa_options
  * 		'start' =
  *   	'limit' =
  * @return array exported data
  */
 public static function exportRecordsFromSearchResultToArray($ps_exporter_code, $po_result, $pa_options = null)
 {
     $vn_start = isset($pa_options['start']) ? (int) $pa_options['start'] : 0;
     $vn_limit = isset($pa_options['limit']) ? (int) $pa_options['limit'] : 0;
     ca_data_exporters::$s_exporter_cache = array();
     ca_data_exporters::$s_exporter_item_cache = array();
     require_once __CA_LIB_DIR__ . '/core/Search/SearchResult.php';
     if (!$po_result instanceof SearchResult) {
         return false;
     }
     if (!($t_mapping = ca_data_exporters::loadExporterByCode($ps_exporter_code))) {
         return false;
     }
     if (sizeof(ca_data_exporters::checkMapping($ps_exporter_code)) > 0) {
         return false;
     }
     $t_instance = $t_mapping->getAppDatamodel()->getInstanceByTableNum($t_mapping->get('table_num'));
     if ($vn_start > 0 && $vn_start < $po_result->numHits()) {
         $po_result->seek($vn_start);
     }
     $va_return = array();
     $vn_i = 0;
     while ($po_result->nextHit()) {
         if ($vn_limit && $vn_i >= $vn_limit) {
             break;
         }
         $vn_pk_val = $po_result->get($t_instance->primaryKey());
         $va_return[$vn_pk_val] = ca_data_exporters::exportRecord($ps_exporter_code, $vn_pk_val);
         $vn_i++;
     }
     return $va_return;
 }
开发者ID:samrahman,项目名称:providence,代码行数:43,代码来源:ca_data_exporters.php


示例18: searchDoctor

    /**
        * @brief 搜索订阅医生
        * @author lhl
        * @exampleUrl http://dev.mobile-api.haodf.com/patientapi/subscription_searchdoctor?keyword=吴鸣&pageId=1&pageSize=15&userId=581662815 
        *
        * @param $keyword 搜索字段 
        * @Param $pageId 当前页码
        * @Param $pageSize 每页显示数
        *
        * @return array('doctorid', 'name', 'fullGrade', 'hospitalName', 'hospitalFacultyName', 'goodVoteCount', 'specialize', 'logoUrl')
     */
    public function searchDoctor($userId, $keyword, $pageId = 1, $pageSize = 15)
	{/*{{{*/
        if($userId != $this->currentUserId)
        {
            $this->setErrorCode(309);
            return 0;
        }
        if('' == trim($keyword))
        {
            $this->setErrorCode(450);
            return 0;
        }
        $doctorSearchd = SphinxSearchdBase::createSearchdByType('Doctor');
        $utf8Kw = mb_convert_encoding($keyword, 'utf-8', 'gbk');
		$res = $doctorSearchd->query($utf8Kw, (int)(($pageId - 1 ) * $pageSize), (int)($pageSize));
        $searchResult = SearchResult::sphinxResult2searchResult($res, 'doctor', (int)(($pageId - 1 ) * $pageSize), (int)($pageSize));
		
		$myDoctorList = SubscriptionClient::getInstance()->getMyDoctors($userId);
        $subscriptionDoctor = array();
        foreach($myDoctorList as $myDoctor) 
        {
           $subscriptionDoctor[$myDoctor->doctor->id] = $myDoctor->id;
        }

		$results = array();
		foreach($searchResult->items as $item)
		{
			$doctor = DAL::get()->find('doctor',$item->id);
			
            if(false == $doctor->isNull() && $doctor->deleted == 0)
            {
                $result = $allHospitalFacultyNames = array();
                $result['doctorid'] = $doctor->id;
                $result['name'] = $doctor->name;
                $result['fullGrade'] = implode(" ",array($doctor->grade,$doctor->educateGrade));
                $primaryDoctors = DAL::get()->find_all_byPrimaryIds('Doctor', array($doctor->primaryId));
                foreach ($primaryDoctors as $primaryDoctor)
                {
                    $allHospitalFacultyNames[] = $primaryDoctor->hospitalfaculty->hospital->commonName.' '.$primaryDoctor->hospitalfaculty->name;
                }
                $result['hospitalName'] = implode("\n", $allHospitalFacultyNames);
                $result['hospitalFacultyName'] = '';
                $result['goodVoteCount'] = $doctor->goodVoteCount;
                $result['specialize'] = $doctor->specialize;
                $result['logoUrl'] = $doctor->getHeadImageForMobile();
                $result['mydoctorid'] = '';
                if(isset($subscriptionDoctor[$doctor->id]))
                {
                    $result['mydoctorid'] = $subscriptionDoctor[$doctor->id];
                }
                $results[] = $result;
            }
		}
        $this->content = $results;
        $this->pageInfo = array('pages' => ceil($searchResult->total_found / $searchResult->pageSize), 'pagesize' => $pageSize, 'nowpage' => $pageId, 'total' => $searchResult->total_found);
	}/*}}}*/
开发者ID:sdgdsffdsfff,项目名称:hdf-client,代码行数:67,代码来源:subscriptiondatabucket.php


示例19: buildSearchTable

 /**
  * 
  */
 public function buildSearchTable()
 {
     self::put('Zoekresultaten maken');
     // Personen
     $aPersons = Person::getAll();
     $personCount = 0;
     $deletePersonCount = 0;
     foreach ($aPersons as $oPerson) {
         $query = "SELECT DISTINCT(Team.competition_nefub_id), Competition.id\n\t\t\t\t\t\tFROM TeamPerson\n\t\t\t\t\t\tLEFT JOIN Team ON Team.nefub_id = TeamPerson.team_nefub_id\n\t\t\t\t\t\tLEFT JOIN Competition ON Team.competition_nefub_id = Competition.nefub_id\n\t\t\t\t\t\tWHERE TeamPerson.person_nefub_id = '" . $oPerson->nefub_id . "'\n\t\t\t\t\t\tAND Competition.season_nefub_id  = '" . Season::getInstance()->nefub_id . "'\n\t\t\t\t\t\tORDER BY Team.competition_nefub_id ASC";
         $aCompetitions = Competition::getAllFromQuery($query);
         $personCompetitions = array();
         foreach ($aCompetitions as $oCompetition) {
             if (trim($oCompetition->name)) {
                 $personCompetitions[] = $oCompetition->name;
             }
         }
         if (count($personCompetitions)) {
             $oSearchResult = SearchResult::selectByNefubId($oPerson->nefub_id, 'person');
             if (!$oSearchResult) {
                 $oSearchResult = new SearchResult();
                 $oSearchResult->nefub_id = $oPerson->nefub_id;
                 $oSearchResult->type = 'person';
                 $oSearchResult->url = '/persoon/' . $oPerson->nefub_id;
                 $personCount++;
             }
             $oSearchResult->name = $oPerson->name;
             $oSearchResult->subtitle = implode(', ', $personCompetitions);
             $oSearchResult->save();
         } else {
             $deletePersonCount += Database::delete_rows('SearchResult', array('nefub_id' => $oPerson->nefub_id, 'type' => 'person'));
         }
     }
     self::put($deletePersonCount . ' perso(o)n(en) verwijderd van zoekresultatenlijst');
     self::put($personCount . ' perso(o)n(en) toegevoegd aan zoekresultatenlijst');
     // Teams
     $aTeams = Team::getAll();
     $teamCount = 0;
     $deleteTeamCount = 0;
     foreach ($aTeams as $oTeam) {
         if ($oTeam->getCompetition() && $oTeam->season_nefub_id == Season::getInstance()->nefub_id) {
             $oSearchResult = SearchResult::selectByNefubId($oTeam->nefub_id, 'team');
             if (!$oSearchResult) {
                 $oSearchResult = new SearchResult();
                 $oSearchResult->nefub_id = $oTeam->nefub_id;
                 $oSearchResult->name = $oTeam->name;
                 $oSearchResult->type = 'team';
                 $oSearchResult->url = '/team/' . $oTeam->nefub_id;
                 $teamCount++;
             }
             $oSearchResult->subtitle = $oTeam->getCompetition()->name;
             $oSearchResult->save();
         } else {
             $deleteTeamCount += Database::delete_rows('SearchResult', array('nefub_id' => $oTeam->nefub_id, 'type' => 'team'));
         }
     }
     self::put($deleteTeamCount . ' team(s) verwijderd van zoekresultatenlijst');
     self::put($teamCount . ' team(s) toegevoegd aan zoekresultatenlijst');
 }
开发者ID:rjpijpker,项目名称:nefub-mobile,代码行数:61,代码来源:MapperRetriever.php


示例20: showInterwikiHit

 /**
  * Show single interwiki link
  *
  * @param SearchResult $result
  * @param string $lastInterwiki
  * @param string $query
  * @param array $customCaptions Interwiki prefix -> caption
  *
  * @return string
  */
 protected function showInterwikiHit($result, $lastInterwiki, $query, $customCaptions)
 {
     if ($result->isBrokenTitle()) {
         return '';
     }
     $title = $result->getTitle();
     $titleSnippet = $result->getTitleSnippet();
     if ($titleSnippet == '') {
         $titleSnippet = null;
     }
     $link = Linker::linkKnown($title, $titleSnippet);
     // format redirect if any
     $redirectTitle = $result->getRedirectTitle();
     $redirectText = $result->getRedirectSnippet();
     $redirect = '';
     if (!is_null($redirectTitle)) {
         if ($redirectText == '') {
             $redirectText = null;
         }
         $redirect = "<span class='searchalttitle'>" . $this->msg('search-redirect')->rawParams(Linker::linkKnown($redirectTitle, $redirectText))->text() . "</span>";
     }
     $out = "";
     // display project name
     if (is_null($lastInterwiki) || $lastInterwiki != $title->getInterwiki()) {
         if (array_key_exists($title->getInterwiki(), $customCaptions)) {
             // captions from 'search-interwiki-custom'
             $caption = $customCaptions[$title->getInterwiki()];
         } else {
             // default is to show the hostname of the other wiki which might suck
             // if there are many wikis on one hostname
             $parsed = wfParseUrl($title->getFullURL());
             $caption = $this->msg('search-interwiki-default', $parsed['host'])->text();
         }
         // "more results" link (special page stuff could be localized, but we might not know target lang)
         $searchTitle = Title::newFromText($title->getInterwiki() . ":Special:Search");
         $searchLink = Linker::linkKnown($searchTitle, $this->msg('search-interwiki-more')->text(), array(), array('search' => $query, 'fulltext' => 'Search'));
         $out .= "</ul><div class='mw-search-interwiki-project'><span class='mw-search-interwiki-more'>\n\t\t\t\t{$searchLink}</span>{$caption}</div>\n<ul>";
     }
     $out .= "<li>{$link} {$redirect}</li>\n";
     return $out;
 }
开发者ID:D66Ha,项目名称:mediawiki,代码行数:51,代码来源:SpecialSearch.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Search_Type_Factory_Interface类代码示例发布时间:2022-05-23
下一篇:
PHP SearchObjectFactory类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap