function DrupalSolrMatchTestCase::_testQueryScores in Apache Solr Search 6
Same name and namespace in other branches
- 8 tests/solr_index_and_search.test \DrupalSolrMatchTestCase::_testQueryScores()
- 6.3 tests/solr_index_and_search.test \DrupalSolrMatchTestCase::_testQueryScores()
- 6.2 tests/solr_index_and_search.test \DrupalSolrMatchTestCase::_testQueryScores()
- 7 tests/solr_index_and_search.test \DrupalSolrMatchTestCase::_testQueryScores()
Test the scoring abilities of the engine.
Verify if a query produces normalized, monotonous scores.
File
- tests/
solr_index_and_search.test, line 183 - Tests for the apachsolr module: index and search.
Class
- DrupalSolrMatchTestCase
- @file Tests for the apachsolr module: index and search.
Code
function _testQueryScores($query, $set, $results) {
// Get result scores.
$scores = array();
foreach ($set as $item) {
$scores[] = $item->score;
}
// Check order.
$sorted = $scores;
sort($sorted);
$this
->assertEqual($scores, array_reverse($sorted), "Query order '{$query}'");
// Check range.
$this
->assertEqual(!count($scores) || min($scores) > 0.0 && max($scores) <= 1.0001, TRUE, "Query scoring '{$query}'");
}