Urfiner aka Nikolai Kochkin. You can find me in telegram: @Ulfberht

Extensions edit

Extensions mods edit

CirrusSearch edit

CirrusSearch search synonyms edit

That will add support for search synonyms on your wiki. That means, for example, that you will be able to find article "Tomato" by "pomodoro" request.

Example:

 
Amazon is found by "Aramzamzam" because the latest was added to a list of search synonyms


Modify extension:

 .../includes/Maintenance/AnalysisConfigBuilder.php  | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/includes/Maintenance/AnalysisConfigBuilder.php b/includes/Maintenance/AnalysisConfigBuilder.php
index 9a819579..ae2abec5 100644
--- a/includes/Maintenance/AnalysisConfigBuilder.php
+++ b/includes/Maintenance/AnalysisConfigBuilder.php
@@ -390,7 +390,7 @@ class AnalysisConfigBuilder {
 					// analyzer is the lack of english stop words.
 					'type' => 'custom',
 					'tokenizer' => 'standard',
-					'filter' => [ 'lowercase' ],
+					'filter' => [ 'lowercase', 'synonym' ],
 					'char_filter' => [ 'word_break_helper' ],
 				],
 				'plain_search' => [
@@ -491,6 +491,12 @@ class AnalysisConfigBuilder {
 					'tokenizer' => 'trigram',
 					'filter' => [ 'lowercase' ],
 				],
+				'synonym' => [ 
+					'type' => 'custom',
+					'tokenizer' => 'no_splitting',
+					'filter' => [ 'lowercase', 'synonym' ],
+				],
 			],
 			'filter' => [
 				'suggest_shingle' => [
@@ -530,6 +536,11 @@ class AnalysisConfigBuilder {
 					'type' => 'truncate',
 					'length' => self::KEYWORD_IGNORE_ABOVE,
 				],
+				'synonym' => [
+					'type' => 'synonym',
+					'synonyms_path' => '/path/to/elasticsearch/analysis/synonym.txt',
+				],
 			],
 			'tokenizer' => [
 				'prefix' => [

Modify

 /path/to/elasticsearch/analysis/synonym.txt

In format

word1, word1synonym1, synonym2
word2, word2synonym1

For example

vbr, veeam backup & replication

All in lowercase

After that:

cd extensions/CirrusSearch/maintenance

and

php UpdateSearchIndexConfig.php  --reindexAndRemoveOk --indexIdentifier=now