Index: core/install/upgrades.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- core/install/upgrades.php	(revision 16632)
+++ core/install/upgrades.php	(date 1525960790000)
@@ -2358,6 +2358,35 @@
 			$this->deleteThumbnails();
 		}
 
+		/**
+		 * Update to 5.2.2-B3
+		 *
+		 * @param string $mode when called mode {before, after)
+		 */
+		public function Upgrade_5_2_2_B3($mode)
+		{
+			if ( $mode != 'before' ) {
+				return;
+			}
+
+			/** @var kMultiLanguageHelper $ml_helper */
+			$ml_helper = $this->Application->recallObject('kMultiLanguageHelper');
+
+			// Make some page revision fields translatable.
+			$ml_helper->createFields('page-revision');
+
+			/** @var PageHelper $page_helper */
+			$page_helper = $this->Application->recallObject('PageHelper');
+			$table_name = TABLE_PREFIX . 'PageRevisions';
+			$sql = 'SELECT RevisionId
+					FROM ' . $table_name;
+			$ids = $this->Conn->GetColIterator($sql);
+
+			foreach ( $ids as $id ) {
+				$this->Conn->doUpdate($page_helper->getRevisionContent($id), $table_name, 'RevisionId = ' . $id);
+			}
+		}
+
 		/**
 		 * Deletes folders, containing thumbnails recursively.
 		 *
Index: core/install/upgrades.sql
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- core/install/upgrades.sql	(revision 16632)
+++ core/install/upgrades.sql	(date 1525960994000)
@@ -2952,3 +2952,6 @@
 WHERE PhraseKey = 'LA_TITLE_SYSTEMTOOLSDEPLOY';
 
 INSERT INTO SystemSettings VALUES(DEFAULT, 'EmailDelivery', '2', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsMailling', 'la_config_EmailDelivery', 'radio', NULL, '1=la_opt_EmailDeliveryQueue||2=la_opt_EmailDeliveryImmediate', 50.11, 0, 1, NULL);
+
+# ===== v 5.2.2-B3 =====
+INSERT INTO SearchConfig VALUES ('Categories', 'PageContent', 1, 1, 'lu_fielddesc_category_PageContent', 'lc_field_PageContent', 'In-Portal', 'la_text_category', 22, DEFAULT, 1, 'text', 'MULTI:PageRevisions.PageContent', '{ForeignTable}.PageId = {LocalTable}.CategoryId AND {ForeignTable}.RevisionNumber = {LocalTable}.LiveRevisionNumber', NULL, NULL, NULL, NULL, NULL);
Index: core/kernel/db/cat_event_handler.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- core/kernel/db/cat_event_handler.php	(revision 16632)
+++ core/kernel/db/cat_event_handler.php	(date 1525960790000)
@@ -1519,10 +1519,17 @@
 					$condition_mode = 'HAVING';
 				}
 				else {
+					$multi_lingual = false;
+
+					if ( $exploded[0] == 'MULTI' ) {
+						$multi_lingual = true;
+						$foreign_field = $exploded[1];
+					}
+
 					$exploded = explode('.', $foreign_field);
 					$foreign_table = TABLE_PREFIX.$exploded[0];
 
-					if($record['CustomFieldId']) {
+					if ( $record['CustomFieldId'] || $multi_lingual ) {
 						$exploded[1] = 'l'.$lang.'_'.$exploded[1];
 					}
 
Index: core/units/helpers/page_helper.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- core/units/helpers/page_helper.php	(revision 16632)
+++ core/units/helpers/page_helper.php	(date 1525972548000)
@@ -438,4 +438,48 @@
 
 		return $content_block->isLoaded();
 	}
+
+	/**
+	 * Returns revision content
+	 *
+	 * @param integer $page_revision_id Page revision Id.
+	 *
+	 * @return string
+	 */
+	public function getRevisionContent($page_revision_id)
+	{
+		/** @var kMultiLanguageHelper $ml_helper */
+		$ml_helper = $this->Application->recallObject('kMultiLanguageHelper');
+		$primary_lang_id = $this->Application->GetDefaultLanguageId();
+		$field_sql = array();
+
+		foreach ( $ml_helper->getLanguages() as $lang_id ) {
+			$content = 'l' . $lang_id . '_Content';
+			$field_sql[] = 'GROUP_CONCAT(IF(
+				COALESCE(' . $content . ', "") = "",
+				IF(l' . $primary_lang_id . '_Content = "", NULL, l' . $primary_lang_id . '_Content),
+				IF(' . $content . ' = "", NULL, ' . $content . ')
+			) SEPARATOR " ") AS l' . $lang_id . '_PageContent';
+		}
+
+		$sql = 'SELECT ' . implode(', ', $field_sql) . '
+				FROM ' . TABLE_PREFIX . 'PageContent
+				WHERE RevisionId = ' . $page_revision_id;
+		$content = $this->Conn->GetRow($sql);
+
+		return array_map(array($this, 'makeSearchable'), $content);
+	}
+
+	/**
+	 * Unescapes and removes tags
+	 *
+	 * @param string $content Content.
+	 *
+	 * @return string
+	 */
+	protected function makeSearchable($content)
+	{
+		return strip_tags(html_entity_decode($content, ENT_QUOTES));
+	}
+
 }
Index: core/units/page_revisions/page_revision_eh.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- core/units/page_revisions/page_revision_eh.php	(revision 16632)
+++ core/units/page_revisions/page_revision_eh.php	(date 1525960790000)
@@ -372,4 +372,28 @@
 
 		return $max_revision + 1;
 	}
+
+	/**
+	 * Updates searchable page content
+	 *
+	 * @param kEvent $event Event.
+	 *
+	 * @return void
+	 */
+	protected function OnAfterPageContentChangedHook(kEvent $event)
+	{
+		/** @var kDBItem $content */
+		$content = $event->MasterEvent->getObject();
+
+		/** @var kDBItem $object */
+		$object = $event->getObject(array('skip_autoload' => true));
+		$revision_id = $content->GetDBField('RevisionId');
+		$object->Load($revision_id);
+
+		/** @var PageHelper $page_helper */
+		$page_helper = $this->Application->recallObject('PageHelper');
+		$object->SetDBFieldsFromHash($page_helper->getRevisionContent($revision_id));
+		$object->Update();
+	}
+
 }
Index: core/units/page_revisions/page_revisions_config.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- core/units/page_revisions/page_revisions_config.php	(revision 16632)
+++ core/units/page_revisions/page_revisions_config.php	(date 1525960790000)
@@ -21,6 +21,19 @@
 	'EventHandlerClass' => Array ('class' => 'PageRevisionEventHandler', 'file' => 'page_revision_eh.php', 'build_event' => 'OnBuild'),
 	'TagProcessorClass' => Array ('class' => 'PageRevisionTagProcessor', 'file' => 'page_revision_tp.php', 'build_event' => 'OnBuild'),
 
+	'Hooks' => array(
+	   array(
+			'Mode' => hAFTER,
+			'Conditional' => false,
+			'HookToPrefix' => 'content',
+			'HookToSpecial' => '*',
+			'HookToEvent' => array('OnAfterItemCreate', 'OnAfterItemUpdate', 'OnAfterItemDelete'),
+			'DoPrefix' => '',
+			'DoSpecial' => '',
+			'DoEvent' => 'OnAfterPageContentChangedHook',
+		),
+	),
+
 	'AutoLoad' => true,
 
 	'QueryString' => Array (
@@ -74,6 +87,11 @@
 			'not_null' => 1, 'default' => 0
 		),
 		'FromRevisionId' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
+		'PageContent' => array(
+			'type' => 'string',
+			'formatter' => 'kMultiLanguage', 'db_type' => 'longtext',
+			'default' => null,
+		),
 		'CreatedById' => Array (
 			'type' => 'int',
 			'formatter' => 'kLEFTFormatter', 'options' => Array (USER_ROOT => 'root', USER_GUEST => 'Guest'), 'left_sql' => 'SELECT %s FROM ' . TABLE_PREFIX . 'Users WHERE %s', 'left_key_field' => 'PortalUserId', 'left_title_field' => USER_TITLE_FIELD, 'error_msgs' => Array ('invalid_option' => '!la_error_UserNotFound!'), 'sample_value' => 'Guest', 'required' => 1,
