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


PHP SearchResult类代码示例

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


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


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