|
static | getNamespaceText (Title $title) |
| Get the textual representation of a namespace with underscores stripped, varying by gender if need be (using Title::getNsText()).
|
|
static | doPoolCounterWork ( $type, $user, $workCallback, $busyErrorMsg=null) |
| Wraps the complex pool counter interface to force the single call pattern that Cirrus always uses.
|
|
static | parsePotentialPercent ( $str) |
|
static | parseSettingsInMessage ( $message) |
| Parse a message content into an array.
|
|
static | overrideYesNo (&$dest, $request, $name) |
| Set $dest to the true/false from $request->getVal( $name ) if yes/no.
|
|
static | overrideNumeric (&$dest, $request, $name, $limit=null, $upperLimit=true) |
| Set $dest to the numeric value from $request->getVal( $name ) if it is <= $limit or => $limit if upperLimit is false.
|
|
static | getDefaultBoostTemplates (?SearchConfig $config=null) |
| Get boost templates configured in messages.
|
|
static | stripQuestionMarks ( $term, $strippingLevel) |
| Strip question marks from queries, according to the defined stripping level, defined by $wgCirrusSearchStripQuestionMarks.
|
|
static | getExecutionId () |
| Identifies a specific execution of php.
|
|
static | resetExecutionId () |
| Unit tests only.
|
|
static | getRequestSetToken () |
| Get a token that (hopefully) uniquely identifies this search.
|
|
static | generateIdentToken ( $extraData='') |
|
static | getExecutionContext () |
|
static | identifyNamespace ( $namespace, $method='naive', ?Language $language=null) |
| Identify a namespace by attempting some unicode folding techniques.
|
|
static | isEmpty ( $v) |
| Helper for PHP's annoying emptiness check.
|
|
static | setIfDefined (array $sourceArray, $sourceKey, array &$destArray, $destKey=null, $mapFn=null, $checkEmpty=true) |
| Helper function to conditionally set a key in a dest array only if it is defined in a source array.
|
|
static | getStatsFactory () |
|
static | looksLikeAutomation (SearchConfig $config, string $ip, array $headers) |
|
static | processSearchRawReturn ( $result, WebRequest $request, CirrusDebugOptions $debugOptions) |
| If we're supposed to create raw result, create and return it, or output it and finish.
|
|
Random utility functions that don't have a better home.
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
static CirrusSearch\Util::setIfDefined |
( |
array | $sourceArray, |
|
|
| $sourceKey, |
|
|
array & | $destArray, |
|
|
| $destKey = null, |
|
|
| $mapFn = null, |
|
|
| $checkEmpty = true ) |
|
static |
Helper function to conditionally set a key in a dest array only if it is defined in a source array.
This is just to help DRY up what would otherwise could be a long series of if ( isset($sourceArray[$key] )) { $destArray[$key] = $sourceArray[$key] } statements. This also supports using a different key in the dest array, as well as mapping the value when assigning to $sourceArray.
Usage: $arr1 = ['KEY1' => '123']; $arr2 = [];
setIfDefined($arr1, 'KEY1', $arr2, 'key1', 'intval'); // $arr2['key1'] is now set to 123 (integer value)
setIfDefined($arr1, 'KEY2', $arr2); // $arr2 stays the same, because $arr1 does not have 'KEY2' defined.
- Parameters
-
array | $sourceArray | the array from which to look for $sourceKey |
string | $sourceKey | the key to look for in $sourceArray |
array | &$destArray | by reference destination array in which to set value if defined |
string | null | $destKey | optional, key to use instead of $sourceKey in $destArray. |
callable | null | $mapFn | optional, If set, this will be called on the value before setting it. |
bool | $checkEmpty | If false, emptyiness of result after $mapFn is called will not be checked before setting on $destArray. If true, it will, using Util::isEmpty. Default: true |
- Returns
- array
static CirrusSearch\Util::stripQuestionMarks |
( |
| $term, |
|
|
| $strippingLevel ) |
|
static |
Strip question marks from queries, according to the defined stripping level, defined by $wgCirrusSearchStripQuestionMarks.
Strip all ?s, those at word breaks, or only string-final. Ignore queries that are all punctuation or use insource. Don't remove escaped \?s, but unescape them.
- Parameters
-
string | $term | |
string | $strippingLevel | Either "all", "break", or "final" |
- Returns
- string modified term, based on strippingLevel