MediaWiki REL1_33
SqlSearchResultSet.php
Go to the documentation of this file.
1<?php
2
4
11 protected $resultSet;
13 protected $terms;
15 protected $totalHits;
16
17 function __construct( ResultWrapper $resultSet, $terms, $total = null ) {
18 $this->resultSet = $resultSet;
19 $this->terms = $terms;
20 $this->totalHits = $total;
21 }
22
23 function termMatches() {
24 return $this->terms;
25 }
26
27 function numRows() {
28 if ( $this->resultSet === false ) {
29 return false;
30 }
31
32 return $this->resultSet->numRows();
33 }
34
35 public function extractResults() {
36 if ( $this->resultSet === false ) {
37 return [];
38 }
39
40 if ( $this->results === null ) {
41 $this->results = [];
42 $this->resultSet->rewind();
43 while ( ( $row = $this->resultSet->fetchObject() ) !== false ) {
44 $this->results[] = SearchResult::newFromTitle(
45 Title::makeTitle( $row->page_namespace, $row->page_title ), $this
46 );
47 }
48 }
49 return $this->results;
50 }
51
52 function free() {
53 if ( $this->resultSet === false ) {
54 return false;
55 }
56
57 $this->resultSet->free();
58 }
59
60 function getTotalHits() {
61 if ( !is_null( $this->totalHits ) ) {
62 return $this->totalHits;
63 } else {
64 // Special:Search expects a number here.
65 return $this->numRows();
66 }
67 }
68}
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
and give any other recipients of the Program a copy of this License along with the Program You may charge a fee for the physical act of transferring a and you may at your option offer warranty protection in exchange for a fee You may modify your copy or copies of the Program or any portion of thus forming a work based on the and copy and distribute such modifications or work under the terms of Section provided that you also meet all of these that in whole or in part contains or is derived from the Program or any part to be licensed as a whole at no charge to all third parties under the terms of this License c If the modified program normally reads commands interactively when you must cause when started running for such interactive use in the most ordinary to print or display an announcement including an appropriate copyright notice and a notice that there is no and telling the user how to view a copy of this and can be reasonably considered independent and separate works in then this and its terms
Definition COPYING.txt:117
SearchResult[] $results
Cache of results - serialization of the result iterator as an array.
This class is used for different SQL-based search engines shipped with MediaWiki.
free()
Frees the result set, if applicable.
getTotalHits()
Some search modes return a total hit count for the query in the entire article database.
termMatches()
Fetch an array of regular expression fragments for matching the search terms as parsed by this engine...
ResultWrapper $resultSet
Result object from database.
string $terms
Requested search query.
int null $totalHits
Total number of hits for $terms.
extractResults()
Extract all the results in the result set as array.
__construct(ResultWrapper $resultSet, $terms, $total=null)
Result wrapper for grabbing data queried from an IDatabase object.