MediaWiki REL1_39
BaseSearchResultSet.php
Go to the documentation of this file.
1<?php
2
15abstract class BaseSearchResultSet implements ISearchResultSet {
16
20 private $bcIterator;
21
27 public function next() {
28 wfDeprecated( __METHOD__, '1.32' );
29 $it = $this->bcIterator();
30 $searchResult = $it->current();
31 $it->next();
32 return $searchResult ?? false;
33 }
34
39 public function rewind() {
40 wfDeprecated( __METHOD__, '1.32' );
41 $this->bcIterator()->rewind();
42 }
43
44 private function bcIterator() {
45 if ( $this->bcIterator === null ) {
46 // @phan-suppress-next-line PhanTypeMismatchProperty Expected
47 $this->bcIterator = 'RECURSION';
48 $this->bcIterator = $this->getIterator();
49 } elseif ( $this->bcIterator === 'RECURSION' ) {
50 // @phan-suppress-previous-line PhanTypeComparisonFromArray Use of string is a hack
51 // Either next/rewind or extractResults must be implemented. This
52 // class was potentially instantiated directly. It should be
53 // abstract with abstract methods to enforce this but that's a
54 // breaking change...
55 wfDeprecated( static::class . ' without implementing extractResults', '1.32' );
56 $this->bcIterator = new ArrayIterator( [] );
57 }
58 return $this->bcIterator;
59 }
60
69 public function termMatches() {
70 return [];
71 }
72
77 public function free() {
78 }
79}
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Logs a warning that a deprecated feature was used.
BaseSearchResultSet is the base class that must be extended by SearchEngine search result set impleme...
termMatches()
Fetch an array of regular expression fragments for matching the search terms as parsed by this engine...
free()
Frees the result set, if applicable.
next()
Fetches next search result, or false.
rewind()
Rewind result set back to beginning.
A set of SearchEngine results.