MediaWiki REL1_31
SqlSearchResultSet.php
Go to the documentation of this file.
1<?php
2
4
10 protected $resultSet;
11 protected $terms;
12 protected $totalHits;
13
14 function __construct( ResultWrapper $resultSet, $terms, $total = null ) {
15 $this->resultSet = $resultSet;
16 $this->terms = $terms;
17 $this->totalHits = $total;
18 }
19
20 function termMatches() {
21 return $this->terms;
22 }
23
24 function numRows() {
25 if ( $this->resultSet === false ) {
26 return false;
27 }
28
29 return $this->resultSet->numRows();
30 }
31
32 function next() {
33 if ( $this->resultSet === false ) {
34 return false;
35 }
36
37 $row = $this->resultSet->fetchObject();
38 if ( $row === false ) {
39 return false;
40 }
41
42 return SearchResult::newFromTitle(
43 Title::makeTitle( $row->page_namespace, $row->page_title ), $this
44 );
45 }
46
47 function rewind() {
48 if ( $this->resultSet ) {
49 $this->resultSet->rewind();
50 }
51 }
52
53 function free() {
54 if ( $this->resultSet === false ) {
55 return false;
56 }
57
58 $this->resultSet->free();
59 }
60
61 function getTotalHits() {
62 if ( !is_null( $this->totalHits ) ) {
63 return $this->totalHits;
64 } else {
65 // Special:Search expects a number here.
66 return $this->numRows();
67 }
68 }
69}
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
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...
next()
Fetches next search result, or false.
rewind()
Rewind result set back to beginning.
__construct(ResultWrapper $resultSet, $terms, $total=null)
Result wrapper for grabbing data queried from an IDatabase object.