DCausse has uploaded a new change for review.
https://gerrit.wikimedia.org/r/317505
Change subject: Do not fail the query with insource:// queries running without
weh
......................................................................
Do not fail the query with insource:// queries running without weh
The experimental highlighter is required to highlight insource://
queries. Simply return the Title instead of a failing the whole query
if it's not available.
Bug: T148107
Change-Id: I1452744c1533c5bf6bd0e535757f958a9fe65626
---
M includes/Search/ResultsType.php
1 file changed, 10 insertions(+), 8 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CirrusSearch
refs/changes/05/317505/1
diff --git a/includes/Search/ResultsType.php b/includes/Search/ResultsType.php
index ffd6f88..1da0d2e 100644
--- a/includes/Search/ResultsType.php
+++ b/includes/Search/ResultsType.php
@@ -394,11 +394,7 @@
];
if ( count( $highlightSource ) ) {
- if ( !$wgCirrusSearchUseExperimentalHighlighter ) {
- throw new \RuntimeException( 'regex is only
supported with $wgCirrusSearchUseExperimentalHighlighter = true' );
- }
- $config[ 'fields' ][ 'source_text.plain' ] = $text;
- $this->configureHighlightingForSource( $config,
$highlightSource );
+ $this->configureHighlightingForSource( $config,
$highlightSource, $text );
return $config;
}
$experimental = [];
@@ -489,9 +485,11 @@
/**
* @param array &$config
* @param array $highlightSource
+ * @param array $options various options
*/
- private function configureHighlightingForSource( array &$config, array
$highlightSource ) {
- global $wgCirrusSearchRegexMaxDeterminizedStates;
+ private function configureHighlightingForSource( array &$config, array
$highlightSource, array $options ) {
+ global $wgCirrusSearchRegexMaxDeterminizedStates,
+ $wgCirrusSearchUseExperimentalHighlighter;
$patterns = [];
$locale = null;
$caseInsensitive = false;
@@ -502,7 +500,10 @@
$caseInsensitive |= $part[ 'insensitive' ];
}
}
- if ( count( $patterns ) ) {
+ if ( count( $patterns ) &&
$wgCirrusSearchUseExperimentalHighlighter ) {
+ // highlight for regex queries is only supported by the
experimental
+ // highlighter.
+ $config['fields']['source_text.plain'] = $options;
$options = [
'regex' => $patterns,
'locale' => $locale,
@@ -527,6 +528,7 @@
}
}
if ( count( $queryStrings ) ) {
+ $config['fields']['source_text.plain'] =
$options;
$bool = new \Elastica\Query\BoolQuery();
foreach ( $queryStrings as $queryString ) {
$bool->addShould( $queryString );
--
To view, visit https://gerrit.wikimedia.org/r/317505
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I1452744c1533c5bf6bd0e535757f958a9fe65626
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CirrusSearch
Gerrit-Branch: master
Gerrit-Owner: DCausse <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits