Initializes Search for given language

@param int $languageId
322773
protected function initializeSearch($pageId, $languageId = 0)
    {
        if (!is_int($pageId)) {
            throw new \InvalidArgumentException('Invalid page ID = ' . $pageId, 1487332926);
        }
        if (!is_int($languageId)) { // @todo: Check if lang id is defined and present?
            throw new \InvalidArgumentException('Invalid language ID = ' . $languageId, 1487335178);
        }
        /* @var $connectionManager ConnectionManager */
        $connectionManager = GeneralUtility::makeInstance(ConnectionManager::class);
        $solrConnection = $connectionManager->getConnectionByPageId($pageId, $languageId);

        $this->search = $this->getSearch($solrConnection);
    }
776717
public function search($vocabularyId)
    {
        $this->loadModel('Taxonomy.Terms');
        $out = [];
        $text = $this->request->query['q'];
        $terms = $this->Terms
            ->find()
            ->select(['id', 'name'])
            ->where(['name LIKE' => "%%{$text}%%", 'vocabulary_id' => $vocabularyId])
            ->limit(10)
            ->all();

        foreach ($terms as $term) {
            $out[] = ['id' => $term->id, 'name' => $term->name];
        }

        die(json_encode($out));
    }
313195
protected function buildSitemap($rootPageId, $languageId)
    {

        if ($languageId !== null) {
            // Language lock enabled
            $sitemapFileName = 'sitemap-r%s-l%s.txt.gz';
        } else {
            $sitemapFileName = 'sitemap-r%s.txt.gz';
        }

        $generator = $this->objectManager->get('Metaseo\\Metaseo\\Sitemap\\Generator\\TxtGenerator');
        $content   = $generator->sitemap();

        $fileName = sprintf($sitemapFileName, $rootPageId, $languageId);
        $this->writeToFile(PATH_site . '/' . $this->sitemapDir . '/' . $fileName, $content);

        return true;
    }
1252004
public function findByPageIdAndByLanguageId($pageId, $languageId)
    {
        try {
            $this->initializeSearch($pageId, $languageId);
            $pageQuery = $this->queryBuilder->buildPageQuery($pageId);
            $response = $this->search->search($pageQuery, 0, 10000);
        } catch (NoSolrConnectionFoundException $exception) {
            return [];
        } catch (SolrCommunicationException $exception) {
            return [];
        }
        $data = $response->getParsedData();
        return $this->documentEscapeService->applyHtmlSpecialCharsOnAllFields($data->response->docs ?? []);
    }
980604
function removeTranslation( $languageID )
    {
        $language = eZContentLanguage::fetch( $languageID );

        if ( !$language )
        {
            return false;
        }

        // check if it is not the initial language
        $classInitialLanguageID = $this->attribute( 'initial_language_id' );
        if ( $classInitialLanguageID == $languageID )
        {
            return false;
        }

        $db = eZDB::instance();
        $db->begin();

        $classID = $this->attribute( 'id' );
        $languageID = $language->attribute( 'id' );

        // change language_mask of the object
        $languageMask = (int) $this->attribute( 'language_mask' );
        $languageMask = (int) $languageMask & ~ (int) $languageID;
        $this->setAttribute( 'language_mask', $languageMask );

        // Remove all names in the language
        $db->query( "DELETE FROM ezcontentclass_name
                     WHERE contentclass_id='$classID'
                       AND language_id='$languageID'" );

        $languageLocale = $language->attribute( 'locale' );
        $this->NameList->removeName( $languageLocale );
        $this->DescriptionList->removeName( $languageLocale );

        $this->store();

        // Remove names for attributes in the language
        $attributes = $this->fetchAttributes();
        foreach ( $attributes as $attribute )
        {
            $attribute->removeTranslation( $languageLocale );
            $attribute->store();
        }

        $db->commit();

        return true;
    }
902301
public function actionSelectFilters(int $categoryId, int $languageId, $id = null)
    {
        $category = Category::findOne($categoryId);
        if (empty($category)) throw new NotFoundHttpException();
        $filters = Filter::find()->where(['category_id' => $category->id])->all();
        $filter = (!empty($id)) ? Filter::findOne($id) : new Filter();

        if (Yii::$app->request->isPost) {
            $filter->load(Yii::$app->request->post());

            if ($filter->validate()) {
                $filter->category_id = $category->id;
                $filter->save();

                $this->trigger(self::EVENT_AFTER_EDIT_CATEGORY,
                    new CategoryEvent(['id' => $category->id]));

                Yii::$app->getSession()->setFlash('success', 'Data were successfully modified.');
                return $this->redirect(Yii::$app->request->referrer);
            }
        }

        return $this->render('save', [
            'viewName' => 'select-filters',
            'params' => [
                'languages' => Language::findAll(['active' => true]),
                'category' => $category,
                'selectedLanguage' => Language::findOne($languageId),
                'filters' => $filters,
                'newFilter' => new Filter(),
            ],
        ]);
    }
512093
protected function _addLanguage( MW_Container_Content_Interface $contentItem, $langid, array $ids )
	{
		$manager = MShop_Product_Manager_Factory::createManager( $this->_getContext() );
		$search = $manager->createSearch();

		if( !empty( $ids ) ) {
			$search->setConditions( $search->compare( '==', 'product.id', $ids ) );
		}

		$sort = array( $search->sort( '+', 'product.code' ) );
		$search->setSortations( $sort );

		$start = 0;

		do
		{
			$result = $manager->searchItems( $search, array('text') );

			foreach( $result as $item ) {
				$this->_addItem( $contentItem, $item, $langid );
			}

			$count = count( $result );
			$start += $count;
			$search->setSlice( $start );
		}
		while( $count == $search->getSliceSize() );
	}
730061
public function getByLangOrFirst($key, $languageId)
    {
        $templateId = EmailTemplate::getIdByKey($key);

        if ($template = EmailTemplateTranslation::findOne([
            'template_id' => $templateId,
            'language_id' => $languageId
        ])) {
            return Template::buildTemplate($template);
        }
        elseif ($templates = EmailTemplateTranslation::findAll([
            'template_id' => $templateId
        ])) {
            return Template::buildTemplate($templates[0]);
        }

        return null;
    }
1048656
protected function addViewLanguageQuery($queryStart, $table, $languageId, $languageAbbr)
    {
        $sLangAddition = $languageAbbr === null ? '' : "_{$languageAbbr}";

        $sViewTable = "oxv_{$table}{$sLangAddition}";

        if ($languageAbbr === null) {
            $sFields = $this->_getViewSelectMultilang($table);
            $sJoin = $this->_getViewJoinAll($table);
        } else {
            $sFields = $this->_getViewSelect($table, $languageId);
            $sJoin = $this->_getViewJoinLang($table, $languageId);
        }

        $sQuery = "{$queryStart} `{$sViewTable}` AS SELECT {$sFields} FROM {$table}{$sJoin}";
        $this->addQuery($sQuery);
    }
474959
@Override
  public final void setLang(final Languages pLang) {
    this.lang = pLang;
    if (this.itsId == null) {
      this.itsId = new IdI18nCurrency();
    }
    this.itsId.setLang(this.lang);
  }
340405
public function setEntry($language, $entryId, $entryValue)
    {
        $language   = (string)$language;
        $entryId    = (string)$entryId;
        $entryValue = (string)$entryValue;
        if (!isset($this->entries[$language]) && $entryValue) {
            $this->entries[$language] = array();
        }
        if ($entryValue) {
            $this->entries[$language][$entryId] = $entryValue;
        } else {
            if (isset($this->entries[$language][$entryId])) {
                unset($this->entries[$language][$entryId]);
            }
        }
        return $this;
    }
1196120
public function searchTerm($term, $vocabulary_id, $language_id = null, $exclude = [])
    {
        $language_id = $this->getLanguage($vocabulary_id, $language_id);

        $term = trim($term);
        if ($term == '') {
            return;
        }

        $query = TermData::select('taxonomy_terms.id')
            ->join('taxonomy_terms', 'taxonomy_terms.id', '=', 'taxonomy_terms_data.term_id')
            ->where('taxonomy_terms.vocabulary_id', $vocabulary_id)
            ->where('taxonomy_terms_data.language_id', $language_id)
            ->where('taxonomy_terms_data.title', $term);

        if (count($exclude)) {
            $query->whereNotIn('taxonomy_terms.id', $exclude);
        }

        return $query->value('id');
    }
940388
public function initializeSearchComponent()
    {
        if ($this->searchConfiguration['spellchecking']) {
            $this->query = $this->queryBuilder->startFrom($this->query)->useSpellcheckingFromTypoScript()->getQuery();
        }
    }
1133299
public function setLanguage($language) {
        if (!session_id()) {
            if ($this->sessionManager) {
                $this->sessionManager->start();
            }
        }
		$_SESSION['_fine_I18n_language'] = $language;
	}
1255658
public function getLicenseContent($languageId)
    {
        $licensePathElements = [
            $this->getSetupDirectory(),
            ucfirst($languageId),
            self::LICENSE_TEXT_FILENAME
        ];
        $licensePath = implode(DIRECTORY_SEPARATOR, $licensePathElements);

        $licenseContent = $this->getFileContents($licensePath);

        return $licenseContent;
    }
1138464
public function getPageByUid(int $uid, int $languageUid = null) {
    return $this->getPage($uid, $languageUid);
  }
1076345
public function setLanguageId($langid)
	{
		if ( $langid === $this->getLanguageId() ) { return; }

		$this->_values['langid'] = strtolower( (string) $langid );
		$this->setModified();
	}