jenkins-bot has submitted this change and it was merged.
Change subject: Remove score display from search engine
......................................................................
Remove score display from search engine
Scores are an internal metric that should not be exposed to
users, plus most backends fail to even support it.
Removes PostgresSearch*-specific result classes as they're not
needed anymore.
Change-Id: I00acaabad0565b9a5b3524c992feea366eb74bcc
---
M includes/AutoLoader.php
M includes/api/ApiQuerySearch.php
M includes/search/SearchPostgres.php
M includes/search/SearchResult.php
M includes/specials/SpecialSearch.php
M languages/i18n/en.json
6 files changed, 6 insertions(+), 56 deletions(-)
Approvals:
Brion VIBBER: Looks good to me, approved
Siebrand: Looks good to me, but someone else must approve
jenkins-bot: Verified
diff --git a/includes/AutoLoader.php b/includes/AutoLoader.php
index b84feb2..fefb594 100644
--- a/includes/AutoLoader.php
+++ b/includes/AutoLoader.php
@@ -907,8 +907,6 @@
'RevisionDeleteUser' =>
'includes/revisiondelete/RevisionDeleteUser.php',
# includes/search
- 'PostgresSearchResult' => 'includes/search/SearchPostgres.php',
- 'PostgresSearchResultSet' => 'includes/search/SearchPostgres.php',
'SearchDatabase' => 'includes/search/SearchDatabase.php',
'SearchEngine' => 'includes/search/SearchEngine.php',
'SearchEngineDummy' => 'includes/search/SearchEngine.php',
diff --git a/includes/api/ApiQuerySearch.php b/includes/api/ApiQuerySearch.php
index 1c41113..5ed5873 100644
--- a/includes/api/ApiQuerySearch.php
+++ b/includes/api/ApiQuerySearch.php
@@ -157,9 +157,6 @@
if ( isset( $prop['timestamp'] ) ) {
$vals['timestamp'] = wfTimestamp(
TS_ISO_8601, $result->getTimestamp() );
}
- if ( !is_null( $result->getScore() ) && isset(
$prop['score'] ) ) {
- $vals['score'] = $result->getScore();
- }
if ( isset( $prop['titlesnippet'] ) ) {
$vals['titlesnippet'] =
$result->getTitleSnippet( $terms );
}
diff --git a/includes/search/SearchPostgres.php
b/includes/search/SearchPostgres.php
index 43fb016..914bc1c 100644
--- a/includes/search/SearchPostgres.php
+++ b/includes/search/SearchPostgres.php
@@ -35,14 +35,14 @@
* latest revision article text (pagecontent.old_text)
*
* @param string $term Raw search term
- * @return PostgresSearchResultSet
+ * @return SqlSearchResultSet
*/
function searchTitle( $term ) {
$q = $this->searchQuery( $term, 'titlevector', 'page_title' );
$olderror = error_reporting( E_ERROR );
$resultSet = $this->db->resultObject( $this->db->query( $q,
'SearchPostgres', true ) );
error_reporting( $olderror );
- return new PostgresSearchResultSet( $resultSet,
$this->searchTerms );
+ return new SqlSearchResultSet( $resultSet, $this->searchTerms );
}
function searchText( $term ) {
@@ -50,7 +50,7 @@
$olderror = error_reporting( E_ERROR );
$resultSet = $this->db->resultObject( $this->db->query( $q,
'SearchPostgres', true ) );
error_reporting( $olderror );
- return new PostgresSearchResultSet( $resultSet,
$this->searchTerms );
+ return new SqlSearchResultSet( $resultSet, $this->searchTerms );
}
/**
@@ -195,32 +195,4 @@
return true;
}
-} ## end of the SearchPostgres class
-
-/**
- * @ingroup Search
- */
-class PostgresSearchResult extends SearchResult {
- function __construct( $row ) {
- parent::__construct( $row );
- $this->score = $row->score;
- }
-
- function getScore() {
- return $this->score;
- }
-}
-
-/**
- * @ingroup Search
- */
-class PostgresSearchResultSet extends SqlSearchResultSet {
- function next() {
- $row = $this->resultSet->fetchObject();
- if ( $row === false ) {
- return false;
- } else {
- return new PostgresSearchResult( $row );
- }
- }
}
diff --git a/includes/search/SearchResult.php b/includes/search/SearchResult.php
index 453211b..d51bff7 100644
--- a/includes/search/SearchResult.php
+++ b/includes/search/SearchResult.php
@@ -143,13 +143,6 @@
}
/**
- * @return float|null If not supported
- */
- function getScore() {
- return null;
- }
-
- /**
* Lazy initialization of article text from DB
*/
protected function initText() {
diff --git a/includes/specials/SpecialSearch.php
b/includes/specials/SpecialSearch.php
index 26f67b1..5f16239 100644
--- a/includes/specials/SpecialSearch.php
+++ b/includes/specials/SpecialSearch.php
@@ -651,16 +651,6 @@
$lang = $this->getLanguage();
- // format score
- if ( is_null( $result->getScore() ) ) {
- // Search engine doesn't report scoring info
- $score = '';
- } else {
- $percent = sprintf( '%2.1f', $result->getScore() * 100
);
- $score = $this->msg( 'search-result-score'
)->numParams( $percent )->text()
- . ' - ';
- }
-
// format description
$byteSize = $result->getByteSize();
$wordCount = $result->getWordCount();
@@ -722,7 +712,7 @@
'<td style="vertical-align:
top;">' .
"{$link} {$redirect} {$section}
{$fileMatch}" .
$extract .
- "<div
class='mw-search-result-data'>{$score}{$desc} - {$date}{$related}</div>" .
+ "<div
class='mw-search-result-data'>{$desc} - {$date}{$related}</div>" .
'</td>' .
'</tr>' .
'</table>' .
@@ -733,6 +723,7 @@
$html = null;
+ $score = '';
if ( wfRunHooks( 'ShowSearchHit', array(
$this, $result, $terms,
&$link, &$redirect, &$section, &$extract,
@@ -741,7 +732,7 @@
) ) ) {
$html = "<li><div class='mw-search-result-heading'>" .
"{$link} {$redirect} {$section}
{$fileMatch}</div> {$extract}\n" .
- "<div
class='mw-search-result-data'>{$score}{$size} - {$date}{$related}</div>" .
+ "<div class='mw-search-result-data'>{$size} -
{$date}{$related}</div>" .
"</li>\n";
}
diff --git a/languages/i18n/en.json b/languages/i18n/en.json
index 9ca969a..7fd6849 100644
--- a/languages/i18n/en.json
+++ b/languages/i18n/en.json
@@ -885,7 +885,6 @@
"searchprofile-advanced-tooltip": "Search in custom namespaces",
"search-result-size": "$1 ({{PLURAL:$2|1 word|$2 words}})",
"search-result-category-size": "{{PLURAL:$1|1 member|$1 members}}
({{PLURAL:$2|1 subcategory|$2 subcategories}}, {{PLURAL:$3|1 file|$3 files}})",
- "search-result-score": "Relevance: $1%",
"search-redirect": "(redirect $1)",
"search-section": "(section $1)",
"search-file-match": "(matches file content)",
--
To view, visit https://gerrit.wikimedia.org/r/152286
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I00acaabad0565b9a5b3524c992feea366eb74bcc
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Chad <[email protected]>
Gerrit-Reviewer: Anomie <[email protected]>
Gerrit-Reviewer: Brion VIBBER <[email protected]>
Gerrit-Reviewer: Siebrand <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits