Smalyshev has uploaded a new change for review.
https://gerrit.wikimedia.org/r/235141
Change subject: Allow search in different language
......................................................................
Allow search in different language
Change-Id: I6ae6751addb4b47ccdb026558af2165da903e88a
---
M includes/CirrusSearch.php
1 file changed, 11 insertions(+), 2 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CirrusSearch
refs/changes/41/235141/1
diff --git a/includes/CirrusSearch.php b/includes/CirrusSearch.php
index 9359c2e..aed2ac6 100644
--- a/includes/CirrusSearch.php
+++ b/includes/CirrusSearch.php
@@ -4,6 +4,7 @@
use CirrusSearch\Search\FullTextResultsType;
use CirrusSearch\Searcher;
use CirrusSearch\Search\ResultSet;
+use CirrusSearch\SearchConfig;
/**
* SearchEngine implementation for CirrusSearch. Delegates to
@@ -121,8 +122,17 @@
}
$context = RequestContext::getMain();
+ $request = $context->getRequest();
$user = $context->getUser();
- $searcher = new Searcher( $this->offset, $this->limit, null,
$this->namespaces, $user, $this->indexBaseName );
+
+ if ( $request && $request->getVal( 'cirrusLang' ) ) {
+ $config = new SearchConfig( $request->getVal(
'cirrusLang' ) );
+ $this->indexBaseName = $config->getWikiId();
+ $searcher = new Searcher( $this->offset, $this->limit,
new SearchConfig( $request->getVal( 'cirrusLang' ) ), $this->namespaces, $user,
$this->indexBaseName );
+ } else {
+ $searcher = new Searcher( $this->offset, $this->limit,
null, $this->namespaces, $user, $this->indexBaseName );
+ }
+
// Ignore leading ~ because it is used to force displaying
search results but not to effect them
if ( substr( $term, 0, 1 ) === '~' ) {
@@ -141,7 +151,6 @@
$searcher->setSort( $this->getSort() );
}
- $request = $context->getRequest();
$dumpQuery = $request && $request->getVal( 'cirrusDumpQuery' )
!== null;
$searcher->setReturnQuery( $dumpQuery );
$dumpResult = $request && $request->getVal( 'cirrusDumpResult'
) !== null;
--
To view, visit https://gerrit.wikimedia.org/r/235141
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I6ae6751addb4b47ccdb026558af2165da903e88a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CirrusSearch
Gerrit-Branch: master
Gerrit-Owner: Smalyshev <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits