/**
  * Returns wikia Config for cross wiki search build on request data
  * @return Wikia\Search\Config
  */
 protected function getConfigCrossWiki()
 {
     $request = $this->getRequest();
     $searchConfig = new Wikia\Search\Config();
     $lang = $request->getArray('lang');
     if (in_array(self::ALL_LANGUAGES_STR, $lang)) {
         $lang = ['*'];
     }
     $searchConfig->setQuery($request->getVal('query', null))->setLimit($request->getInt('limit', static::CROSS_WIKI_LIMIT))->setPage($request->getVal('batch', 1))->setRank($request->getVal('rank', 'default'))->setHub($request->getArray('hub', null))->setInterWiki(true)->setCommercialUse($this->hideNonCommercialContent());
     if (!empty($lang)) {
         $searchConfig->setLanguageCode($lang);
     }
     //this will set different boosting
     $searchConfig->setBoostGroup('CrossWikiApi');
     return $searchConfig;
 }
Example #2
0
 /**
  * @group Slow
  * @slowExecutionTime 0.07465 ms
  * @covers Wikia\Search\Config::getTestProfile
  * @covers Wikia\Search\Config::initiateTestProfile
  */
 public function testGetTestProfileNonexistentTestGroup()
 {
     $config = new Config();
     $config->setBoostGroup('THIS_AINT_NO_TEST_GROUP');
     $this->assertInstanceOf('Wikia\\Search\\TestProfile\\Base', $config->getTestProfile(), 'A non-existent test group should back off to base');
 }