本文整理汇总了PHP中Helpers::search_link方法的典型用法代码示例。如果您正苦于以下问题:PHP Helpers::search_link方法的具体用法?PHP Helpers::search_link怎么用?PHP Helpers::search_link使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Helpers
的用法示例。
在下文中一共展示了Helpers::search_link方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_search_by_id_returns_single_record
function test_search_by_id_returns_single_record()
{
# Check that searching for an ID only gives you one result
$test_items = array('TKI80868', 'TKI80039', 'TKI80875');
foreach ($test_items as $value) {
$solr = new Solr();
$this->assertEqual(1, $solr->count($value), Helpers::search_link($value) . " should return only 1 result");
}
}
示例2: test_staging_urls_return_no_matches
function test_staging_urls_return_no_matches()
{
# Test paths for common staging urls
$test_items = array('staging.internal', 'dev.internal', 'preprod');
foreach ($test_items as $value) {
$solr = new Solr();
$this->assertEqual(0, $solr->count($value), "Search for " . Helpers::search_link($value) . " returns " . $solr->count() . " results, when none should be returned");
}
}
示例3: test_community_names_return_homepage_as_first_result
function test_community_names_return_homepage_as_first_result()
{
# Check that first result for each query is appropriate
# homepage id
$test_items = array('english online' => 'TKI80868', 'assessment online' => 'TKI58274', 'assessment' => 'TKI58274', 'education for enterprise' => 'TKI45249', 'digistore' => 'TKI59990', 'alternative education' => 'TKI17383', 'digital technology guidelines' => 'TKI50586', 'dtg' => 'TKI50586', 'e-asttle' => 'TKI38879', 'education for sustainability' => 'TKI50157', 'literacy online' => 'TKI58077', 'education outside the classroom' => 'TKI58260', 'esol online' => 'TKI13739', 'gifted and talented' => 'TKI17424', 'gifted and talented online' => 'TKI17424', 'he kohinga rauemi a-ipurangi' => 'TKI50637', 'new zealand curriculum' => 'TKI46672', 'tax citizenship' => 'TKI80668', 'arts online' => 'TKI31449', 'arts' => 'TKI31449', 'educational leaders' => 'TKI57127', 'home-school partnerships' => 'TKI59527', 'home school partnerships' => 'TKI59527', 'te tere auraki' => 'TKI28409', 'success for boys' => 'TKI50135', 'software for learning' => 'TKI50191');
foreach ($test_items as $key => $value) {
$solr = new Solr();
$this->assertEqual($value, $solr->first($key), "{$value} wasn't first result for query " . Helpers::search_link($key));
}
}
开发者ID:robomc,项目名称:solr-tests,代码行数:10,代码来源:first_result_for_community_name_not_community_homepage.php
示例4: test_phrases_in_index_return_matches
function test_phrases_in_index_return_matches()
{
# Checks first that searching for the phrase inside quotes does match
# If it does, checks for matches without quotes.
$test_items = array('"animals in circuses"', '"This Chinese official"', '"This Taihape Area School"', '"refers to Waitangi as"', '"posted on any forum"', '"highest level of their interest and ability"');
foreach ($test_items as $value) {
$solr = new Solr();
if ($solr->count($value) >= 1) {
$value = trim($value, '"');
$solr = new Solr();
$this->assertNotEqual(0, $solr->count($value), Helpers::search_link($value) . " has " . $solr->count() . " results");
}
}
}
示例5: assessSimilarity
function assessSimilarity($array, $strict = 1, $drift = 2)
{
foreach ($array as $key => $value) {
$solr = new Solr();
$results = $solr->search($key, count($value) * $drift);
$matches = 0;
foreach ($results as $pid) {
if (in_array($pid, $value)) {
$matches++;
}
}
$this->assertTrue($matches * $strict >= count($value), "Search for " . Helpers::search_link($key) . " returned " . $matches . " of it's expected results in the top " . count($value) * $drift);
}
}
示例6: test_legacy_paths_not_indexed_with_nonlegacy_domains
function test_legacy_paths_not_indexed_with_nonlegacy_domains()
{
# Searches for legacy urls on non-legacy domains, like:
# gifted.tki.org.nz/m/search/
$test_domains = array('gifted.tki.org.nz', 'www.wicked.org.nz', 'assessment.tki.org.nz', 'nzcurriculum.tki.org.nz', 'secondary.tki.org.nz', 'englishonline.tki.org.nz', 'artsonline.tki.org.nz');
$test_paths = array('/e/community/ncea/', '/e/community/maorieducation/', '/e/community/pasifika/', '/m/search/', '/e/search/', '/r/literacy_numeracy/professional/teachers_notes/ready_to_read/');
foreach ($test_domains as $domain) {
foreach ($test_paths as $path) {
$solr = new Solr();
$query = $domain . $path;
$this->assertEqual(0, $solr->count($query), Helpers::search_link($query) . " should return no results");
}
}
}
示例7: test_nzmaths_where_appropriate
function test_nzmaths_where_appropriate()
{
# Checks that first 10 results for nzmaths related keywords
# return good proportion of MZMaths items. Ensures fix for
# previous function doesn't work too well.
$test_items = array('ALiM school stories nzmaths', 'Algebra information', 'Attribute Blocks: Exploring Shape', 'scuba');
foreach ($test_items as $value) {
$solr = new Solr();
$pids = $solr->search($value, 50);
$i = 0;
foreach ($pids as $id) {
if (preg_match('/nzmaths/', $id)) {
$i++;
}
}
$this->assertTrue($i > 0, "Search for " . Helpers::search_link($value) . " has insufficient nzmaths items");
}
}