Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4074810
SqlSearchResultSet.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
SqlSearchResultSet.php
View Options
<?php
use
MediaWiki\MediaWikiServices
;
use
MediaWiki\Title\Title
;
use
Wikimedia\Rdbms\IResultWrapper
;
/**
* This class is used for different SQL-based search engines shipped with MediaWiki
* @ingroup Search
*/
class
SqlSearchResultSet
extends
SearchResultSet
{
/** @noinspection PhpMissingParentConstructorInspection */
/** @var IResultWrapper Result object from database */
protected
$resultSet
;
/** @var string[] Requested search query */
protected
$terms
;
/** @var int|null Total number of hits for $terms */
protected
$totalHits
;
/**
* @param IResultWrapper $resultSet
* @param string[] $terms
* @param int|null $total
*/
public
function
__construct
(
IResultWrapper
$resultSet
,
array
$terms
,
$total
=
null
)
{
parent
::
__construct
();
$this
->
resultSet
=
$resultSet
;
$this
->
terms
=
$terms
;
$this
->
totalHits
=
$total
;
}
/**
* @return string[]
* @deprecated since 1.34
*/
public
function
termMatches
()
{
return
$this
->
terms
;
}
public
function
numRows
()
{
if
(
$this
->
resultSet
===
false
)
{
return
0
;
}
return
$this
->
resultSet
->
numRows
();
}
public
function
extractResults
()
{
if
(
$this
->
resultSet
===
false
)
{
return
[];
}
if
(
$this
->
results
===
null
)
{
$this
->
results
=
[];
$this
->
resultSet
->
rewind
();
$terms
=
MediaWikiServices
::
getInstance
()->
getContentLanguage
()
->
convertForSearchResult
(
$this
->
terms
);
foreach
(
$this
->
resultSet
as
$row
)
{
$result
=
new
SqlSearchResult
(
Title
::
makeTitle
(
$row
->
page_namespace
,
$row
->
page_title
),
$terms
);
$this
->
augmentResult
(
$result
);
$this
->
results
[]
=
$result
;
}
}
return
$this
->
results
;
}
public
function
getTotalHits
()
{
if
(
$this
->
totalHits
!==
null
)
{
return
$this
->
totalHits
;
}
else
{
// Special:Search expects a number here.
return
$this
->
numRows
();
}
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Aug 17 2026, 16:52 (10 w, 2 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
22/89/1188643089c6b73b6d8d0de44e7c
Default Alt Text
SqlSearchResultSet.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment