CirrusSearch
Elasticsearch-powered search for MediaWiki
Loading...
Searching...
No Matches
CirrusSearch\Search\ResultSet Class Reference

A set of results from Elasticsearch. More...

+ Inheritance diagram for CirrusSearch\Search\ResultSet:
+ Collaboration diagram for CirrusSearch\Search\ResultSet:

Public Member Functions

 __construct ( $searchContainedSyntax=false, \Elastica\ResultSet $elasticResultSet=null, TitleHelper $titleHelper=null)
 
 setSuggestionQuery (string $suggestionQuery, $suggestionSnippet=null)
 
 getTotalHits ()
 Some search modes return a total hit count for the query in the entire article database.
 
 hasSuggestion ()
 
 getSuggestionQuery ()
 
 getSuggestionSnippet ()
 
 extractResults ()
 
 addInterwikiResults (CirrusSearchResultSet $res, $type, $interwiki)
 
 getInterwikiResults ( $type=self::SECONDARY_RESULTS)
 
 hasInterwikiResults ( $type=self::SECONDARY_RESULTS)
 
 setRewrittenQuery (string $newQuery, $newQuerySnippet=null)
 
 hasRewrittenQuery ()
 
 getQueryAfterRewrite ()
 
 getQueryAfterRewriteSnippet ()
 
 getElasticResponse ()
 
 getElasticaResultSet ()
 
 count ()
 Count elements of an object https://php.net/manual/en/countable.count.php.
 
 numRows ()
 
 searchContainedSyntax ()
 Did the search contain search syntax? If so, Special:Search won't offer the user a link to a create a page named by the search string because the name would contain the search syntax.
 
 hasMoreResults ()
 
 shrink ( $limit)
 
 extractTitles ()
 Extract all the titles in the result set.
 

Protected Member Functions

 preCacheContainedTitles (\Elastica\ResultSet $resultSet)
 Loads the result set into the mediawiki LinkCache via a batch query.
 
 transformOneResult (\Elastica\Result $result)
 

Protected Attributes

 $results
 

Detailed Description

A set of results from Elasticsearch.

Extending this class from another extension is not supported, use BaseCirrusSearchResultSet

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. http://www.gnu.org/copyleft/gpl.html

Deprecated
use a subclass of BaseCirrusSearchResultSet

Constructor & Destructor Documentation

◆ __construct()

CirrusSearch\Search\ResultSet::__construct ( $searchContainedSyntax = false,
\Elastica\ResultSet $elasticResultSet = null,
TitleHelper $titleHelper = null )
Parameters
bool$searchContainedSyntax
\Elastica\ResultSet | null$elasticResultSet
TitleHelper | null$titleHelper
Deprecated
use a subclass of BaseCirrusSearchResultSet

Member Function Documentation

◆ addInterwikiResults()

CirrusSearch\Search\ResultSet::addInterwikiResults ( CirrusSearchResultSet $res,
$type,
$interwiki )
Parameters
CirrusSearchResultSet$res
int$typeOne of SearchResultSet::* constants
string$interwiki

Implements CirrusSearch\Search\CirrusSearchResultSet.

◆ count()

CirrusSearch\Search\ResultSet::count ( )

Count elements of an object https://php.net/manual/en/countable.count.php.

Returns
int The custom count as an integer.
Since
5.1.0

◆ extractTitles()

CirrusSearch\Search\ResultSet::extractTitles ( )

Extract all the titles in the result set.

Returns
Title[]

◆ getElasticaResultSet()

CirrusSearch\Search\ResultSet::getElasticaResultSet ( )
Returns
\Elastica\ResultSet|null

Implements CirrusSearch\Search\CirrusSearchResultSet.

◆ getElasticResponse()

CirrusSearch\Search\ResultSet::getElasticResponse ( )
Returns
\Elastica\Response|null

Implements CirrusSearch\Search\CirrusSearchResultSet.

◆ getInterwikiResults()

CirrusSearch\Search\ResultSet::getInterwikiResults ( $type = self::SECONDARY_RESULTS)
Parameters
int$type
Returns
ISearchResultSet[]

◆ getQueryAfterRewrite()

CirrusSearch\Search\ResultSet::getQueryAfterRewrite ( )
Returns
string|null

◆ getQueryAfterRewriteSnippet()

CirrusSearch\Search\ResultSet::getQueryAfterRewriteSnippet ( )
Returns
HtmlArmor|string|null

◆ getSuggestionQuery()

CirrusSearch\Search\ResultSet::getSuggestionQuery ( )
Returns
string|null

◆ getSuggestionSnippet()

CirrusSearch\Search\ResultSet::getSuggestionSnippet ( )
Returns
HtmlArmor|string|null Null is only returned if suggestion query is also null

◆ getTotalHits()

CirrusSearch\Search\ResultSet::getTotalHits ( )

Some search modes return a total hit count for the query in the entire article database.

This may include pages in namespaces that would not be matched on the given settings.

Return null if no total hits number is supported.

Returns
int|null

◆ hasInterwikiResults()

CirrusSearch\Search\ResultSet::hasInterwikiResults ( $type = self::SECONDARY_RESULTS)
Parameters
int$type
Returns
bool

◆ hasMoreResults()

CirrusSearch\Search\ResultSet::hasMoreResults ( )
Returns
bool True when there are more pages of search results available.

◆ hasRewrittenQuery()

CirrusSearch\Search\ResultSet::hasRewrittenQuery ( )
Returns
bool

◆ hasSuggestion()

CirrusSearch\Search\ResultSet::hasSuggestion ( )
Returns
bool

◆ numRows()

CirrusSearch\Search\ResultSet::numRows ( )
Returns
int

◆ preCacheContainedTitles()

CirrusSearch\Search\ResultSet::preCacheContainedTitles ( \Elastica\ResultSet $resultSet)
protected

Loads the result set into the mediawiki LinkCache via a batch query.

By pre-caching this we ensure methods such as Result::isMissingRevision() don't trigger a query for each and every search result.

Parameters
\Elastica\ResultSet$resultSetResult set from which the titles come

◆ searchContainedSyntax()

CirrusSearch\Search\ResultSet::searchContainedSyntax ( )

Did the search contain search syntax? If so, Special:Search won't offer the user a link to a create a page named by the search string because the name would contain the search syntax.

Returns
bool

◆ setRewrittenQuery()

CirrusSearch\Search\ResultSet::setRewrittenQuery ( string $newQuery,
$newQuerySnippet = null )
Parameters
string$newQuery
HtmlArmor | string | null$newQuerySnippet

Implements CirrusSearch\Search\CirrusSearchResultSet.

◆ setSuggestionQuery()

CirrusSearch\Search\ResultSet::setSuggestionQuery ( string $suggestionQuery,
$suggestionSnippet = null )
Parameters
string$suggestionQuery
HtmlArmor | string | null$suggestionSnippet

Implements CirrusSearch\Search\CirrusSearchResultSet.

◆ shrink()

CirrusSearch\Search\ResultSet::shrink ( $limit)
Parameters
int$limitShrink result set to $limit and flag if more results are available.

◆ transformOneResult()

CirrusSearch\Search\ResultSet::transformOneResult ( \Elastica\Result $result)
protected
Parameters
\Elastica\Result$resultResult from search engine
Returns
CirrusSearchResult Elasticsearch result transformed into mediawiki search result object.

The documentation for this class was generated from the following file: