MediaWiki REL1_34
BaseSearchResultSet.php
Go to the documentation of this file.
1<?php
2
14abstract class BaseSearchResultSet implements ISearchResultSet {
15
19 private $bcIterator;
20
26 public function next() {
27 wfDeprecated( __METHOD__, '1.32' );
28 $it = $this->bcIterator();
29 $searchResult = $it->current();
30 $it->next();
31 return $searchResult ?? false;
32 }
33
38 public function rewind() {
39 wfDeprecated( __METHOD__, '1.32' );
40 $this->bcIterator()->rewind();
41 }
42
43 private function bcIterator() {
44 if ( $this->bcIterator === null ) {
45 $this->bcIterator = 'RECURSION';
46 $this->bcIterator = $this->getIterator();
47 } elseif ( $this->bcIterator === 'RECURSION' ) {
48 // Either next/rewind or extractResults must be implemented. This
49 // class was potentially instantiated directly. It should be
50 // abstract with abstract methods to enforce this but that's a
51 // breaking change...
52 wfDeprecated( static::class . ' without implementing extractResults', '1.32' );
53 $this->bcIterator = new ArrayIterator( [] );
54 }
55 return $this->bcIterator;
56 }
57
66 public function termMatches() {
67 return [];
68 }
69
74 public function free() {
75 }
76}
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Throws a warning that $function is deprecated.
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...
ArrayIterator null $bcIterator
Iterator supporting BC iteration methods.
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.